Pages

Saturday, December 13, 2008

more server tuning

In my quest to try out new things and make my rented virtual server run a bit smoother I tried two (for me) new tools:

memcached: I never had a need to use it, because at work we just do websites which nobody looks at. We could really have used this at guideguide, where we basically used mysql to cache some often used data which didn't work too well.

Installation was very easy on CentOS and mediawiki and Django have direct support for memcached. I just had to enable it and change the code for api.bicingwatch.com to make use of the cache.

lighttpd: On the previous krass.com server, which had about ten times more memory I used two apache instances. One for the static stuff and as reverse proxy for the second one for the mod_perl server. Now I am using lighttpd for the static and reverse proxy. I am not 100% convinced by the syntax, but it is rather easy to setup and allows some refactoring of the config with include files.

So for example I have in the main config:

$HTTP["host"] == "api.bicingwatch.com" {
server.name = "api.bicingwatch.com"
server.document-root = "/....../bicingwatch/site_media"
include "proxy-localhost.conf"
}

And in proxy-localhost.conf

$HTTP["url"] !~ "\.(js|css|gif|jpg|png|ico|txt|swf|html|htm)$" {
setenv.add-response-header = ( "X-Forwarded-Host" => server.name )

proxy.server = (
"" => (
( "host" => "127.0.0.1", "port" => 8000 )
)
)
}


And on port 8000 is the apache and mod_python installation I had before.

Seems to work ok, so that is another thing gone from my todo list.

No comments:

Post a Comment