http://pl.atyp.us/content/tech/servers.html
####
the Four Horsemen of Poor Performance:
- Data copies
- Context switches
- Memory allocation
- Lock contention
There will also be a catch-all section at the end, but these are the biggest performance-killers. If you can handle most requests without copying data, without a context switch, without going through the memory allocator and without contending for locks, you'll have a server that performs well even if it gets some of the minor parts wrong.
Low-level optimization is generally the last resort of someone who screwed up the design.