Speed is everywhere …

31 Jan

From the nuts and bolts to how you present data to your visitors – you can squeeze speed out in many ways.

The (relatively) popular talk is about optimizing the user-download sequence to wring out as much performance as you possibly can. I’ve talked about this in the context of CSS sprites (great for speed oomph).

But there are other things you can do at the server-level that often get skipped over.

Two quick examples:

Our weather widget is pretty popular. It is now used on over 200,000 unique pages. Every pageview on one those pages = a call to our server. So of course we cache the HTML we output, but that still means our hard disks get hit for every request. So we looked closely and saw that the cache never grew bigger than 2 gb. The solution? A server with 8 gb ram, 4 gb for normal memory options, and a 4 gb ramdisk that is used for the cache output. This saves a lot of wear and tear on the HDs themselves, while letting us respond faster than ever.

Second example – re-writing URLs. Often times people use mod_rewrite through a .htaccess file. The problem with that is say you have a file 5 folders deep: /home/folder1/folder2/folder3/folder4/file-here Every time file-here is called, the server is checking all five folders for the existence of a .htaccess file. If it finds one, it has to open it and read it. The solution is to edit your configuration file (eg apache’s conf file) and put the mod_rewrite there. This way you save five file checks (and potentially one or two file reads) for every single hit.

This is of course just the tip of the iceberg – a lot of other things you can do to wring out more out of your server(s).

6 Responses to Speed is everywhere …



January 31st, 2008 at 5:44 pm

I never would’ve thought about that .htaccess problem in a million years. That tidbit is a gem



February 1st, 2008 at 10:43 am

Great post Ahmed. That’s thinking outside the box.



February 1st, 2008 at 4:06 pm

RAM is cheap, run everything on ram :)



February 1st, 2008 at 11:22 pm

For those that are too lazy to create their own sprites, you can use an online generator:

You can also download the source:

(more info http://ajaxian.com/archives/css-sprite-generator-source-code-released )



February 2nd, 2008 at 12:09 am

Yeah in my post on CSS I linked to that first link – but the second one is useful too :)



March 3rd, 2008 at 6:57 pm

For RamDisk there seems to be a 512mb limit in linux. any docs you can point how to raise that limit?