Dougal Campbell's geek ramblings

WordPress, web development, and world domination.

Improve Apache thread memory usage

Thing I learned today at CoderFaire Atlanta:

If you are using Apache with the worker MPM model (or the experimental event worker) under Linux, you can probably improve your memory usage. By default, there is an 8MB stack size per thread, which turns out to be overkill. If you change the size to 1MB, you can save a ton of memory:


<IfModule mpm_worker_module>
StartServers 8
MaxClients 512
MinSpareThreads 64
MaxSpareThreads 128
ThreadsPerChild 32
ThreadLimit 512

# If this isn’t set, the OS’ default will be used (8 MB)
# which is way more than necessary
ThreadStackSize 1048576

</IfModule>

This should help my server do less memory thrashing when I get traffic spikes.

 

About Dougal Campbell

Dougal is a web developer, and a "Developer Emeritus" for the WordPress platform. When he's not coding PHP, Perl, CSS, JavaScript, or whatnot, he spends time with his wife, three children, a dog, and a cat in their Atlanta area home.
This entry was posted in Tech and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to Improve Apache thread memory usage

  1. Pingback: The WordPress Weekend Roundup - WP Daily

Leave a Reply to saddington Cancel reply

%d bloggers like this: