Redwood Deployed on AWS Performance Issues?

Hey all,

I want to start off by saying that I am no infrastructure engineer, so there may be obvious places to improve this setup but I’m just not sure where to go or who to ask. So I figured at least if I ask here, other RedwoodJS users might benefit too!

I’ve deployed my RedwoodJS app using FlightControl on AWS. The actual deployments work really well, and I’ve loved my experience with FlightControl so far. However, I’ve noticed that my app seems to load considerably slower in the deployed environment.

Everything seems to take around a full second or more to load no matter what I do, and I’ve made sure that everything is deployed in the region closest to me (us-west, I live in Arizona) to minimize geographic latency. It uses the default flightcontrol.json file that’s created after running yarn rw setup deploy flightcontrol.

Has anyone else experienced this, or does anyone have ideas for how I can improve the response time? Is this just what it’s like to have a static site on CloudFront communicating with an API in Fargate? Any insight would be fantastic, thanks!

EDIT: Adding my flightcontrol.json file for clarity.

{
  "$schema": "https://app.flightcontrol.dev/schema.json",
  "environments": [
    {
      "id": "development",
      "name": "Development",
      "region": "us-west-1",
      "source": {
        "branch": "main"
      },
      "services": [
        {
          "id": "redwood-api",
          "name": "Redwood API",
          "type": "fargate",
          "buildType": "nixpacks",
          "cpu": 0.25,
          "memory": 0.5,
          "installCommand": "NODE_ENV=development yarn install --immutable",
          "buildCommand": "yarn rw deploy flightcontrol api",
          "startCommand": "yarn rw deploy flightcontrol api --serve",
          "port": 8911,
          "healthCheckPath": "/graphql/health",
          "envVariables": {
            "REDWOOD_WEB_URL": {
              "fromService": {
                "id": "redwood-web",
                "value": "origin"
              }
            },
            "DATABASE_URL": {
              "fromService": {
                "id": "db",
                "value": "dbConnectionString"
              }
            }
          }
        },
        {
          "id": "redwood-web",
          "name": "Redwood Web",
          "type": "static",
          "buildType": "nixpacks",
          "singlePageApp": true,
          "installCommand": "NODE_ENV=development yarn install --immutable",
          "buildCommand": "yarn rw deploy flightcontrol web",
          "outputDirectory": "web/dist",
          "envVariables": {
            "REDWOOD_API_URL": {
              "fromService": {
                "id": "redwood-api",
                "value": "origin"
              }
            }
          }
        },
        {
          "id": "db",
          "name": "Database",
          "type": "rds",
          "engine": "postgres",
          "engineVersion": "14",
          "applyChangesImmediately": true,
          "instanceSize": "db.t4g.small",
          "port": 5432,
          "storage": 20,
          "maxStorage": 100,
          "private": true
        }
      ]
    }
  ]
}

For anyone that’s curious, I did increase the Fargate CPU and Memory to 1 and 2GB, respectively, which seemed to help a little. Still feels like initial page loads (getting the JavaScript and rendering, not the API calls) are taking a full second or two, so not sure if there’s some Cloudfront configuration I need to mess with more or what. I’ll report back when I figure something out.