Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What would be the system tunables to enhance serving static content? Like increase/decrease swappines, how to max out disk caching and so on...

share|improve this question

migrated from Jun 27 '11 at 23:15

This question came from our site for professional and enthusiast programmers.

small or large files? – Karoly Horvath Jun 27 '11 at 22:50
Are you seeing much swap traffic with vmstat 1? – sarnold Jun 27 '11 at 22:51
I'm betting an untuned server, even a not very grunty one, could push out more content than a gigabit ethernet could take. Just make sure you've got enough memory so you're not swapping. – Paul Tomblin Jun 27 '11 at 23:36
The main optimization for static content would be to do some benchmarks to see if lighttpd is faster than apache. – Paul Tomblin Jun 27 '11 at 23:37
Just a few notes: I'm using nginx to serve that content; the average object size is 25k. My question is if you have some tips for optimizing the OS - have it to cache more aggressively, reduce the time to first byte sent over TCP, so on. Thanks. – Calin Don Jun 28 '11 at 11:31

If you're looking for hardcore static performance, look into nginx. A web server that specializes specifically in serving static content.

You will find that Apache can serve static content quite quickly too if you don't use complex features or .htaccess files, etc.

Caching and connection handling are best left to the tunable features of the service daemon you choose.

Technically for any form of IO/general performance you want 0 swappiness - as that correlates to a memory problem (either too little memory, poor use, or legitimate consumption).

share|improve this answer
I'm already using nginx and I know that it can saturate 1Gbps connection. The question is if there any tunables to reduce the time from HDD to TCP, basically reduce the time to first byte. – Calin Don Jun 28 '11 at 11:37
Depending on your memory consumption you could look into this: – thinice Jun 28 '11 at 13:40
Do you have an idea of what level of disk latency you have with a random request? – thinice Jun 28 '11 at 14:04 are the relevant data from server monitoring. As you can see every kernel part is doing it's job good and I don't have specifically a problem with disk latency, but rather I'm asking for good practices when it comes to this type of server workload. – Calin Don Jun 29 '11 at 10:55
Memmcached doesn't seem a good solution for this, since it is introducing additional networking overhead. I'm trying to minimize the time from file to the network (reducing the latency). – Calin Don Jun 29 '11 at 10:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.