System Information
- Strapi Version: 3.2.5
- Operating System: Heroku
- Database: postgres
- Node Version: Heroku defaults?
- NPM Version: Heroku defaults?
- Yarn Version: Heroku defaults?
I have an app that uses Strapi & GraphQL, with the strapi app deployed on Heroku and a NextJS front end deployed on Netlify.
In production, I am getting pretty lengthy cold starts when loading the apollo queries on the homepage. Once the app is running the queries run super fast. In dev, everything works great.
I just switched the frontend to use rest endpoints instead of the graphQl queries, and the cold starts are basically gone now, so seems to be something Apollo related? Or maybe a Heroku thing?
Any recommendation on how to optimize these queries to eliminate the cold start? Or tooling to even see where the bottleneck is?
dependencies
:
"knex": "<0.20.0",
"pg": "^8.3.3",
"sqlite3": "latest",
"strapi": "^3.2.5",
"strapi-admin": "^3.2.5",
"strapi-connector-bookshelf": "^3.2.5",
"strapi-plugin-content-manager": "^3.2.5",
"strapi-plugin-content-type-builder": "^3.2.5",
"strapi-plugin-email": "^3.2.5",
"strapi-plugin-graphql": "^3.2.5",
"strapi-plugin-upload": "^3.2.5",
"strapi-plugin-users-permissions": "^3.2.5",
"strapi-provider-upload-cloudinary": "^3.2.5",
"strapi-utils": "^3.2.5"
and the config/env/production
module.exports = ({ env }) => ({
defaultConnection: "default",
connections: {
default: {
connector: "bookshelf",
settings: {
client: "postgres",
host: env("DATABASE_HOST"),
port: env.int("DATABASE_PORT"),
database: env("DATABASE_NAME"),
username: env("DATABASE_USERNAME"),
password: env("DATABASE_PASSWORD"),
schema: "public",
ssl: { rejectUnauthorized: false }
},
options: {}
}
}
});