Apr 13, 2011

Site Optimization

Posted Apr 13, 2011

A little background first. I use Picasa Web Albums (PWA) 's several REST-ful API's for mvergel.com's gallery. Basically I query what I need to PWA and it returns an xml feed that can be parsed by gdata library.

The problem now is that there are several key areas where this web application starts to struggle:

  1. Java web application start-up
    Unlike its Python counterpart, Java has a significant start-up time, worse, Google App Engine (GAE) shuts the Virtual Machine down when there is no-one accessing your site.

    Previously (or even up to now), the workaround is to constantly ping your site to simulate web access. This, however, makes a considerable performance hit to GAE since it will eat resources up if most developers perform this quick-fix.

    GAE recognized this problem and announced an official feature to fix this problem starting version 1.4.0. It's called the Always On feature. This solution will cost developers $0.30 a day in their billing, which is not a bad price, but I opt to keep my personal charity website as cost-effective as possible so I didn't avail for this feature.

  2. Getting contents from Picasa
    This is the highlight of my recent site optimization. The new version of the site already implements a cache instead of always getting the information from Picasa. The original idea was to cache the xml feeds. It worked on my local server, but once deployed to GAE, an error was thrown regarding SSL handshake. I found an issue in their buglist about this problem but could not wait for a fix that time.

    I resorted to a new implementation: storing each album and picture data on my server. This is more tedious compared to just storing the whole xml cache, but it worked for me. The overall responsiveness of the gallery is better.

Still, when accessing the site for the first time, it's still bounded to the Java application start-up I mentioned in #1. Is $0.30/day worth it to remove that the start-up time (around 2-3 seconds)?

No comments:

Post a Comment