Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

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.

 

Replies 5 (5)

mkevinosullivan
Shopify Staff (Retired)
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`

 

To learn more visit the Shopify Help Center or the Community Blog.

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.

JonathanMucha
Shopify Partner
5 0 0

Bump...

Is anyone else experiencing this issue?

Thanks!
JM.

dto1902
Shopify Partner
5 0 4

Hi Jonathan, I have the same problem, did you manage to solve it?

wellbranding
Tourist
10 0 1

Experiencing same issue. How it is possible that official sample is so bad???