Writing a high performance scalable web application requires close attention to details. Jello improves the performance of your application by caching query requests results. Even so, you can still easily fall into performance traps if you don't know where to look for them.
Jello will make the best effort trying cache REST queries and keep the results cached as long as they are still valid. In order to achieve this, the built-in cache mechanism takes into account the dependencies between different entities and the data access privileges defined for each entity. Based on the data model, it might cache queries from different users separately or not cache other queries at all. The cache manager keeps track of changes in the database like adding, updating, and deleting of instances and will invalidate cached queries accordingly.
Jello cache implementation uses the underline Google App Engine Memcache API.
By default, Jello cache is active for the production server and off for the developer server, cached query results will remain valid as long as possible, and the entire cache will be reset upon deployment of a new application version. To override this behavior, you can add the following to app.yaml (or to web.xml). (See also the application configuration file):
app.yaml:servlet: jello.JelloServlet name: Jello init_params: # Default is 'true' jello.cache.active: false # Default is 'true' jello.cache.flushOnDeploy: false # Default is -1 (as long as possible) jello.cache.validTimeSeconds: 3600
<servlet-name>Jello</servlet-name> <servlet-class>jello.JelloServlet</servlet-class> <init-param> <param-name>jello.cache.active</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>jello.cache.flushOnDeploy</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>jello.cache.validTimeSeconds</param-name> <param-value>3600</param-value> </init-param>
Jello cache's underlying implementation uses the GAE Memcache Java API. Refer to GAE documentation for more information about the Memcache configuration and quotes.
The following actions are available both from the JAVA API and the REST API
1 2 3 4 5 6 7 8 9 10 | jello.cache.MemCache { public static Boolean isActive(); public static String setActive(Boolean flag); public static String flush(); public static String setValidTimeSeconds(Integer seconds); } |
/jello/data/jello.cache/MemCache/isActive() /jello/data/jello.cache/MemCache/setActive("flag":false) /jello/data/jello.cache/MemCache/flush() /jello.cache/MemCache/setValidTimeSeconds(seconds:86400)
Use $debugLevel 3 and up to include cache information in the REST result
Avoid full requests for entities with lots of instances. Use $top query option whenever possible.
Skipping records causes a performance hit since all the records up to the skipping position are still retrieved internally. If possible, try to utilize the query $cursor support instead.
This option will force a full scan of the entity's records even for subset requests. Try to add $filter whenever applicable.
Limiting the number of records retrieved is one thing, but one can go even further and optimize the size of each returned record.
Use $select wherever applicable to include only the necessary information in the response.
Sometimes, it is desired to execute an action asynchronously, especially if you know this action's execution time might exceed App Engine 60 seconds limit. See Asynchronous actions for more details.
Was this page helpful? Let us know how we did:
Last updated December 30, 2015.