Faster online and offline image for IMAGE-ONLY users
Some of our users are in environments where they can’t embed the hab.la javascript directly onto their websites. As a workaround we developed a method of showing an image that displays hab.la status on their websites.
A few days ago, I noticed that the status display was a little slow for my liking. In fact, it was running as a normal CGI ( a big no no), but since not to many people were using it, it’s performance wasn’t that big of a deal.
Today, I increased performance by 1800%, speeding up the status image response time from ~0.474 seconds to ~0.026 seconds.
ben@lyle:/var/www/online# time curl "http://dyn.hab.la/online/image2.cgi/4324-24618-10-8812/image.png" real 0m0.474s user 0m0.016s sys 0m0.004s
Versus:
ben@lyle:/var/www/online# time curl "http://hab.la/status/4324-24618-10-8812/image.png" real 0m0.026s user 0m0.012s sys 0m0.004s
What sped it up so much? First, I replaced the CGI script, with a very lightweight webserver. This made it so that python didn’t have to instantiate from scratch every time image.cgi was loaded. Second, I replaced the old calls to our RPC server, with newer calls to our memcacheD servers. There are still too many MySQL calls in this process, but optimizing those into pure memcache can wait for a while.
To learn more about using Hab.la without Javascript, take a look at My blog post or our tutorial for websites without Javascript.

Comments [0]