app.yaml resources suggestions for static hosting

112 views
Skip to first unread message

ja...@thebabyboxco.com

unread,
May 11, 2017, 5:59:16 PM5/11/17
to Google App Engine
I'm using nodejs flex environment and express.static middleware for hosting a static site, a mix of html, javascript, css and images that has about 30 rps

It seems the defaults on flex environment isn't powerful enough to serve static files in under 100ms. I've fixed this problem by increasing the cpu count and ram of the base instance to:

resources:
cpu: 2
memory_gb: 7.6
disk_size_gb: 10

and have a minimum instance count of 

automatic_scaling:
min_num_instances: 4
max_num_instances: 20

can anyone recommend the proper sizing for resource instances and proper automatic scaling for this workload?

Thanks!
Jason

***NOTICE***
This e-mail message is confidential, is intended only for the named recipient(s) above, and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law.  If you have received this message in error, or are not a named recipient(s), you are hereby notified that any dissemination, distribution or copying of this e-mail is strictly prohibited.  If you have received this message in error, please immediately notify the sender by return e-mail and delete this e-mail message from your computer.  Thank you.

Justin Beckwith

unread,
May 11, 2017, 8:07:23 PM5/11/17
to google-a...@googlegroups.com, node-team
Are you *only* doing static hosting?  Or is there a dynamic aspect as well?

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ff2bcca2-5b3b-487c-8119-2063497557ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Justin Beckwith | Google Cloud Platform | @justinbeckwith | http://jbeckwith.com

E EE

unread,
May 11, 2017, 8:12:28 PM5/11/17
to Google App Engine
30 requests per second for static resources is small enough to be insignificant. You should be able to serve it happily with a micro instance, so something seems very wrong here.

It is possible that app engine has a lot of latency, so out of those 100ms, only 1ms or less is spent in your web server, the rest of the 99 in the app engine infrastructure. In this case throwing more resources on the machine is not going to do much.

Attila-Mihaly Balazs

unread,
May 12, 2017, 2:52:46 AM5/12/17
to Google App Engine
AFAIK two big limitations of the FLEX environment are the slow startup of new instances (10s of seconds vs. under 1 second for AppEngine Standard) and the fact that the default images are all configured to serve requests sequentially. You almost surely be better off moving the static files to an AppEngine standard module (standard and flex can co-exist in the same project, in different modules) and use the dispatcher (https://cloud.google.com/appengine/docs/standard/python/config/dispatchref) to serve the static files from there. Just don't forget to modify "expiration" in app.yaml since the default of 10 minutes is veeery short.

Attila

Blaine Garrett

unread,
May 15, 2017, 6:28:36 PM5/15/17
to Google App Engine
If you are only doing static code (i.e. express is just serving files), you may consider just using a standard env (python or go for simplicity). From my understanding Flex env will add a fair amount of overhead. 
I started a github project years ago for this purpose: https://github.com/blainegarrett/gae-static It is basically just the app.yaml that makes a difference.

I have a personal project that is a api client node app that once built simply is deployed as static assets using this approach.

Hope that helps. 
~ Blaine

Alex Martelli

unread,
May 15, 2017, 7:28:16 PM5/15/17
to google-a...@googlegroups.com
Another possibility for a static-only site, recommended for example in the short, useful video Moving existing applications to Google Cloud Platform, is to use Google Cloud Storage. Here's a tutorial on how best to achieve this.

Alex

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
Message has been deleted

A. Kong

unread,
Jul 26, 2017, 9:09:15 PM7/26/17
to Google App Engine
With the google cloud storage option to serve static files, what is the best way to manage it with the local development environment?

Background: I am thinking of switching from standard to flex environment. I am  using python runtime, so the switch can let me to switch from python 2.7 to python 3 too.  I use webpack to emit a final bundled javascript. In a standard environment I can put the file in the static folder as specified in app.yaml. 

But if I were to serve this javascript file out of google CDN, how should I go about setting up my dev environment?   I certainly do not want to deploy scripts whenever I made some minor changes. I think it might be possible to use a env variable to control the behaviour. (e,g. use flask to serve static file when in dev, but use CDN otherwise)

What is your setup in your cases?
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages