A good exercise for an inexperienced system administrator to become a little more experienced is to run a stable server with the most minimal amount of RAM possible. For example, try running a mail server, webserver, and database server on one computer or virtual host. If you get enough spam going to the mail server, chances are it will be enough to take down a server with 256MB of RAM and 512MB of swap. Your job is to configure all the daemons on the box so that they don’t crash and take the whole box down with it.
Here’s a tip that will help. Most default linux installs, I know for sure with Ubuntu, do not have reasonable process limits set for smaller amounts of RAM. Apache is one program in particular that is grossly too big–the max limit is set to 150 processes. Now, look for other memory pigs… there’s another one which by default has no upper process limit set.
Daemons generally work like this: a process has so many threads or children that it can handle (simultaneous connections). So when a process like Apache reaches its limit for the amount of connects it can handle, what it does is fork (create) more Apache processes that can handle more connections. The problem with this is that each new process reserves more memory from the heap, and eventually all the memory on the server (especially on servers with small amounts of RAM) will get used up and then bad things will happen.
It’s amazing how many people will just say, oh we need a better server and throw more and more money on it, when in fact all they need to do is just set some process limits on the daemons running on their boxes. Sure, your email will be a little bit slower, but I’m pretty sure you’re not really in a rush to get deals on prescription drugs.
Related posts: