slow load times on deployed Shopify-app-node clone app

JonathanMucha
Shopify Partner
5 0 0

Hello. Recently I've been exploring deployment options for the base node/react app generated by the Shopify CLI and I've noticed something odd:

      No matter which option I choose for deployment (Heroku, Google App Engine, and Google Cloud Run are the three I've tested), the initial load time is extremely high (typically between 11 and 21 seconds!). Subsequent load times are much more reasonable, anywhere from a few hundred milliseconds, to 2 seconds on the slow side.

     Through my research I've discovered that part of the problem is "Cold Boot Times" for the different deployment options listed above. This makes some sense of course, since the hosting server needs to spin up an instance to serve the initial request. However the added startup time due to the cold boot of an initial instance doesn't appear to be the only problem here, since deploying a similar next/koa app without the shopify-api (v1.2.1) and koa-shopify-auth (v4.1.2) modules produces cold boot times that are between 1 and 3 seconds.

This issue is quite a large one, as apps are rejected during the review process for slow load times, a reasonable cause for rejection to be sure. However, it seems as though the Shopify provided example app wouldn't pass the shopify review process either.

My questions are:

  1. What deployment options has this example app been tested on, and what initial load times are generally seen?
  2. What about the koa-shopify-auth, and shopify-api modules cause such an extreme performance reduction, compared to an app that has neither of those modules installed?
  3. How have other developers navigated this issue in their own applications?

Thank you all for your help!

Jonathan.

 

0 Likes
mkevinosullivan
Shopify Staff
Shopify Staff
7 3 3

It sounds like the development version is being deployed, which includes just-in-time compilation of assets, etc.  You'll need to build a production version

$ npm run build        # which runs `next build`

then run/deploy the application using

$ npm run start        # which runs `NODE_ENV=production node server.js`

 

0 Likes
JonathanMucha
Shopify Partner
5 0 0

@mkevinosullivan, thank you so much for the prompt reply. Unfortunately, this is not the case.

Specifically in App Engine (my preferred hosting solution at the moment) the deployment knows to start the app using the specified script in package.json:

The start script is the one provided by the shopify cli:

 

"start": "cross-env NODE_ENV=production node ./server/index.js"

 

Do you have any other suggestions for this issue?

Thank you again!

JM.

0 Likes
JonathanMucha
Shopify Partner
5 0 0

Bump...

Is anyone else experiencing this issue?

Thanks!
JM.

0 Likes