It has been around two months since we started to port an existing application on Google App engine. It used Hibernate for persistence, Wicket framework for web layer and Spring as an Ioc container. Looking at the will it play on appengine we had to change Hibernate to use either JPA or JDO. We decided on JPA purely on the basis of experience we had on JPA compared to JDO. Wicket is semi compatible and we made it work by the three standard workarounds described here.
Changing the persistence layer from Hibernate to JPA was the most challenging task. Not only we had to break the relationships between entities because of the Datastore’s notion of entity groups but also due to several performance optimizations we had to do later. We will have a look at how can we use keys-only query in JPA to increase performance.
We had trouble mapping the associations in JPA for Google App engine for which we blogged about the case for unowned keys and managing multiple parent problem. Understanding of Entity Groups and transactions are extremely important for implementing persistence on Google App Engine. This becomes especially important for porting an application to Google App engine.
In our application there were certain parts we could find were expensive either in terms of CPU usage or in Datastore calls. We were able to optimize application performance using keys-only queries.
While working on high traffic web-sites, software developers are often confronted with the question of how to increase performance of the application. I would like to talk about one of the commonly recurring scenarios:
- The application does lot of computation to gather requested information. These computations are quite memory intensive
- The results are generally stored in a normalized manner in an RDBMS before being rendered to the caller
- The same information is requested by multiple clients resulting in multiple RDBMS hits and thus resulting in performance deterioration
In this context, we thought of using a Caching framework which help us in significantly reducing the DB hits and hence get a noticeable performance gain in terms of response times.
There are many frameworks available today which provide object level caching. I will be sharing my experience about Memcached framework. As explained on their home page, it’s an open source caching system which also provides distributed object caching support. The list of clients using Memcached to alleviate Database load is pretty impressive. Please visit their web-site for more information.