How can I get the requests of my Google AppEngine application to perform better and faster (i.e. less load times and less CPU usage)? I'm specifically referring to imporvements for the server-side portion of the app, and not the client-side.
相关问题
- java.lang.NullPointerException at java.io.PrintWri
- Faster loop: foreach vs some (performance of jsper
- Why wrapping a function into a lambda potentially
- __call__() missing 1 required positional argument:
- Ado.net performance:What does SNIReadSync do?
相关文章
- Is there a size limit for HTTP response headers on
- appcfg.py command not found
- DOM penalty of using html attributes
- Which is faster, pointer access or reference acces
- Django is sooo slow? errno 32 broken pipe? dcramer
- Understanding the difference between Collection.is
- Google app engine datastore string encoding proble
- parallelizing matrix multiplication through thread
I'd recommend using Appstats to see where in your app there's bottlenecks.
I use memcache which significantly increased my app's performance. I hope it also can be usable for you. When using memcache in combination with a HTTP header setting the cache-control I've gotten significant improvements in response times.
One often overlooked aspect is that various Appengine related services support asynchronous processing, for example Datastore:
https://cloud.google.com/appengine/docs/java/datastore/async
and URL Fetch:
https://cloud.google.com/appengine/docs/python/urlfetch/asynchronousrequests
If you have requests that do various tasks you can see if they can be parallelized.
Use appengine Appstats to see where actually your application uses more cpu resources.Try to find out the reason for that and look for alternative solution. In python you can do lot of optimisation. M
Make use of memcache api which makes data fetch easy and fast. Avoid unnecessary fetch() and get().
Avoid doing a lot of RPCs while using db.reference() property. Nick's blog on this explains about this.
Modeling in appengine matters a lot in performance. Make sure you have the right model designed for your application.
Avoid doing get and fetch unless until you really need them.
This is not really an optimization but the choice of framework is really important here. Most legacy framework in Java and Python(Django,..) are not designed to startup fast because it just isn't important in traditional hosting. Consider using an App Engine specific framework like Tipfy, Kai, Webapp, ... (Python) or slim3, ... (Java).
Ideally, you should organize your data so that each user request needs only one call to the datastore, preferably a db.get because queries are significantly slower. To achieve this, you'll often need to denormalize your data, and maintain the different copies in sync using entity groups and transactions.
When making more than one urlfetch or API call, you can speed up the process by making the calls in parallel using the non-blocking(async) syntax. Caching whenever possible is of course really important too.
If you haven't yet, I recommend watching Google's IO talks (2010 & 2011), in particular this year's Scaling App Engine Applications which does a very good job of describing server-side best practices.