Daily Archives: October 27, 2009

Apache vs. lighttpd

I’ve had a somewhat recurring problem that Apache on my server is a memory hog. The machine has a full GB of RAM now, but even so, heavy activity from spidering bots or reddit can bring it to its knees.

I’ve been trying to figure out what to do about it. I run Apache on there, and here’s an idea of what it hosts:

  • This blog, and two others like it, using WordPress
  • Several sites that are nothing but static files
  • gitweb
  • A redmine (ruby on rails) site
  • Several sites running MoinMoin
  • A set of tens of thousands of redirects from mailing list archives I used to host over to gmane (this had negligible impact on resource use when I added it)
  • A few other smaller PHP apps

Due to PHP limitations, it will only work with the Apache prefork or itk MPMs. That constrains the entire rest of the system to those particular MPMs. Other than PHP, most of the rest of these sites are running using FastCGI — that includes redmine and MoinMoin, although gitweb is a plain cgi. Many of these sites, such as this blog, have changed underlying software over the years, and I use mod_rewrite to issue permanent redirects from old URLs to their corresponding new ones as much as possible.

I do have two IPs allocated to the server, and so I can run multiple webservers if desired.

lighttpd is a lightweight webserver. I’ve browsed their documentation some, and I’m having a lot of trouble figuring out whether it would help me any. The way I see it, I have four options:

  1. Keep everything as it is now
  2. Stick with Apache, discard mod_php and use FastCGI for PHP, and pick some better MPM (whatever that might be)
  3. Keep Apache for PHP and move the rest to lighttpd
  4. Move everything to lighttpd, with FastCGI for PHP

I know Apache pretty well, and lighttpd not at all, so if all else is equal, I’d want to stick with Apache. But I’m certainly not above trying something else.

One other wrinkle is that right now everything runs as www-data — PHP, MoinMoin, static sites, everything. That makes me nervous, and I’d like to run some sites under different users for security. I’m not sure if Apache or lighttpd is better for that.

If anybody has thoughts, I’m all ears.

Ahh, updates…

It’s been awhile since I’ve made a blog post, and it will probably soon be evident why.

For myself, I am taking two college classes — philosophy and gerontology — this semester, and still working full time. That’s busy right there. I’m really enjoying them, and in particular enjoying the philosophy class. I will, at long last, graduate this December.

Oliver is about 3 months old now. He’s starting to smile at us more, make his cute little baby noises more, and is very interested in taking in all of his surroundings. He has his opinions about things, but isn’t expressing them too loudly just yet.

Jacob, on the other hand, is sometimes.

Our person from Parents As Teachers was talking to him for his 3-year-old evaluation. She said, “Jacob, are you a boy or a girl?” “I a kitty.” “Are you a boy kitty or a girl kitty?” “I just a PLAIN kitty. Meow.”

He seems to delight in catching someone saying or doing something in a manner he considers wrong. “No, not like THAT!” is heard a lot in our house these days. Or perhaps, “No, not RAILROAD tracks. They TRAIN tracks, dad!”

Jacob’s imagination is very active. Sometimes if it is time to go use the potty, he will insist that we all stop because a freight train is going through the kitchen, the crossing guard lights are flashing, so we have to STOP. He pretends to be kitties, runaway bunnies (he has a book called Runaway Bunny), and occasionally other things.