App Proxy Latency on HTTP request

Tourist
11 0 1

Hello all!

We are building a proxied app for a client that has a custom shopping guide component (http://pocparties.com/apps/drupal-product-builder/baby-shower for example).

As you can see, the application is large (several megabytes). So it is a large page. My question is why, when we load it on our own server (not through the proxy), is the request instantaneous (just a couple of seconds). When we load it through the proxy, Shopify takes upwards of 15 seconds to process the request. I do realize the page is large so the load time on the front-end will be a bit longer (hence the loader bar). But why is the request taking so long?

Just wondering if anyone else has encountered this issue or if there are any possible workarounds? We do plan on (eventually) splitting the builder into ajax steps but in the short term we have a very slow loading page.

Any insight would be amazing. Thanks so much guys!

- Jesse Michel | Shopify Expert
0 Likes
Shopify Expert
3841 0 270

Proxy results you provide are a string. So when a request hits your server from the proxy, that takes time. Some servers are idle and only spin up to process a request when hit with one. That can be 6 seconds... not saying yours idles but hey... 

Now you respond. You decide to build some massive megabytes string. You return that string out the door as the response. One stinking huge asset. A massive string. 

Now Shopify gets that string and parses it for Liquid. LadeeDa... that takes time. You think a computer can parse a few megs of Liquid quick.. but hey... 

Now once Shopify chews through your string, it combines your string with the shop's chrome... and you're rendered. 

My guess is the system is only messed up if you send a simple string with a teeny bit of Liquid and that still takes 15 seconds. That indicates either your server is not networking right, or Shopify Proxy services are truly slow. 

Did you test that? 

Did you try a simpler approach like embedding your mega App inside an <iframe>?

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Shopify Partner
1501 105 300

Hi Jesse,

Can't see the app through the link you posted above.

I don't have experience using app proxies, but could it be that you're seeing such delays because the app proxy is effectively not caching your target while the browser is. I'd bet that if you turned of the browser cache and loaded your app as is, it would also take MUCH longer to load considering it's a few MBs.

Just a thought.

I turn coffee in to code - since 1998
0 Likes
Highlighted
Shopify Expert
3841 0 270

The App Proxy is not the problem. After all, it is nothing more than a GET or POST you make to your server. If your server is failing to respond in 15 seconds with a payload, that is on you to figure out. Shopify plays little role in this short of the security aspect ensuring the Proxy calls are authentic. 

@Karl might be on to something there about cache. You might also consider that sending MB of data is awkward? Are you sure that is a good architecture? The two things App Proxy are used for 99.0% of the time are:

  1. sending Liquid that Shopify renders for you
  2. sending JSON that you render with JS and templates etc.
Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Tourist
11 0 1

Hey Ya'll,

Thank you for these thoughtful responses! I got locked out of my forums account for a while (continually contacted Shopify to try to get access, to no avail). Finally I got access so I just got these replies.

Not sure if I can formally do this but we can consider this topic "closed". I am no longer working on this project actively, and we haven't really approached a project in a similar way since.

Your feedback will be super helpful if I need to refer back to here in the future.

Thanks again, everyone!

 

- Jesse Michel | Shopify Expert
0 Likes