Lighttpd + Django + SQLite

January 20, 2009

I just finished rewriting my entire site again. I switched out virtually every element of my former stack, so I thought that it might be worth mentioning how I have things working now. I did a lot of custom configuration, so I will probably post more details of my setup at a later time, but for now I will at least explain what tools I chose to use.

For my webserver, I am now using Lighttpd. I chose this because in general it is more lightweight and faster than Apache. There is a popular trend these days toward Nginx because because it is also very lightweight and serves static files even faster than Lighttpd, but I went with Lighttpd because it has a more developed community.

I moved from PHP to Django. I have been playing with Django for a while now and I thought it would be fun to use it for something other than just private projects. In case you haven't heard of it, Django is a web framework written in Python. It seems to be fairly similar to many of the other frameworks except that it is written in Python. I chose it mostly because I prefer Python to Ruby, Perl, or PHP. Python is a well developed language with lots of libraries. I'm not particularly opposed to PHP, Ruby, or Perl, I just prefer Python.

I also moved from MySQL to SQLite3. My database for this site is quite tiny, so there was really no reason for the overhead of a full MySQL server. The memory footprint of SQLite is tiny, and it does simple SELECTs quickly which is the majority of my DB traffic.

I'm also using memcached for both view and database caching. This helps to relieve both CPU and database load. I wasn't having any particular issues with either of these, but things do move a little snappier now. I tested various aspects of the site using Seige, and found that using memcached cut response times by a factor of about 4 for reads on the main page.

Check out my other pages tagged "blog".