GoogleCloudPlatform / appengine-symfony-starter-project

Symfony Starter Project on Google App Engine
Apache License 2.0
42 stars 13 forks source link

Slow performance #11

Open jt2k opened 8 years ago

jt2k commented 8 years ago

I think I must have missed something. Getting just the Hello World to load is taking around 5-10 seconds per page load locally and around 800-1000ms running on App Engine. Locally (running dev_appserver.py), I can see a bunch of requests for cache files. Each cache file request does a HEAD request and a GET request against the local cloud storage interface:

HEAD /_ah/gcs/[bucket-name]/symfony/cache-None/...
GET /_ah/gcs/[bucket-name]/symfony/cache-None/...

Obviously, this slow performance is not what everyone else is getting. What did I miss?

bshaffer commented 8 years ago

Yes, I am seeing this same behavior. I've been looking into ways to mitigate this, such as pre-deploy cache warmup. So far nothing stands out as a quick fix.

jt2k commented 8 years ago

This is happening for me on every load, even after the cache has been warmed. Each request has to load every cache file, and every one does a HEAD and GET request to GCS. Is there something that you are doing to minimize load times after the cache is warmed?

bshaffer commented 8 years ago

I am experimenting with using app/console cache:warmup --env prod, and if this doesn't work I will try using a Memcache stream wrapper.

marslangoog commented 8 years ago

Enabling optimistic caching will help too: https://cloud.google.com/appengine/docs/php/googlestorage/advanced#cached_file_reads

bshaffer commented 8 years ago

@marslangoog we are already doing that, and it doesn't seem to matter. Requests take from .7 to 1.2 seconds.

bshaffer commented 8 years ago

I have added a Memcache Stream Wrapper which has improved performance from .3 to .7 seconds. This still seems slow, but it's certainly an improvement.

craigiswayne commented 8 years ago

Just checked our your last few changes @bshaffer, they definitely improve performance. Thank you!

FossPrime commented 7 years ago

I'll just throw this out there... also checkout Silex, the PHP Microframework. The Google bookshelf examples are based on it... specially #2. It's extremely easy to adapt them to GAE Standard Env. You can also throw it on https://github.com/bezoerb/generator-grunt-symfony and it will work, webpack, jshint and php server build tools all come with it. You'll just need to fuss with the app.yaml skip-files to make it upload in a reasonable time. I may put in a pull request to address it.

On an almost stock bookshelf #2 app, I'm getting 115ms response times (excluding network latency), and around 30mb memory usage. Load tested it with 25 concurrent users, not a hitch... could probably hit 300 in a single F1 instance.

elonmallin commented 7 years ago

@bshaffer I tried your memcache wrapper but couldn't get it working. I got some errors but they might be related to that I'm using the shared/free memcache and it's too small. Are you using the shared one too? Maybe someone here knows what this error could mean:

17:49:31.154 (INFO)
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
17:49:31.154 (ERROR)
A problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. (Error code 204)
PhilippeBoisney commented 7 years ago

Same problem than @jt2k ... When I run the Hello World app locally, it takes 10 seconds per page to load. Any solution to disable cache or maybe load it locally when running on dev server ?