Lighttpd, MySQL, and Low Memory configurations

Most of the time, a low memory profile will limit connections, thus limiting the amount of requests/visitors that can get to your site in a timely fashion. If your site gets a lot of visitors on a low-mem profile, you'll see queues piling up for certain services (mysql and apache most likely).

There's no such thing as a low-mem profile that can handle heaps of requests, you're basically trading off speed for expandability, if that makes any sense.

I've been used to lighttpd for the past 3 years and slowly forgot how bloated apache really is, and with my current default lamp settings, apache seems to be quite a hog compared to how lighttpd was handling things. Your main issue would be mysql, especially if you're running lighty. IMO, on a 720 with default settings on all services, you'll be fine with a moderate-high load.

2 Replies

You won't be able to get a definitive answer here, because Drupal is the most important variable here. Depending on which modules you use and how your pages are composed, Drupal can be anything from a lightweight PHP script to a 100-database-queries-and-100MB-memory-per-request monster.

One thing that's really good about lighttpd + fastcgi is that you're very unlikely to have an out-of-memory crash even when you get a lot of visitors. Static requests use virtually no RAM, and you'll be serving at most PHPFCGICHILDREN dynamic requests at the same time. (All the other requests will be queued.) This is the setting that controls how much resources Drupal will use, which is directly related to how hard MySQL will have to work. 8 is a reasonable value for a quad-core server, and you can expect PHP to use 150-250MB of RAM. This also means that MySQL gets at most 8 connections at any given time.

As for MySQL, the "low-memory" profile with a keybuffer of 16KB, in my opinion, is way too low for today's high-powered Linodes. Those were designed for yesteryear's VPSs with 128MB of RAM. The keybuffer should be at least as large as the size of all your indexes after the content is loaded, which I assume would quickly grow to a few megabytes for an average forum site. This is crucial for database performance. Low-memory might sound good, but you need to keep in mind that 720MB (1024 after the recent upgrade?) is hardly the "low-memory" VPS of 2006.

As a very rough rule of thumb, I'd give 20-25% of my RAM to the PHP FastCGI processes, 25-30% to MySQL, 10-20% to all the other processes (lighttpd, postfix, etc.), and leave the rest for buffers and cache. Anything more will probably hurt performance due to excessive I/O. Anything less and you're probably not making full use of the resources you paid for.

I used to have a database-heavy PHP site on a Linode 720 running on lighttpd and MySQL, and I had no problem serving over 50K pages per hour. YMMV.

Drupal is indeed the important variable here. 100 MySQL statement/request is a bit of "understatement" – my Drupal site front page constantly getting > 250 MySQL statements for a logged in user. Lighty itself should have no problem. For my Drupal site, which is also hosted on a 720 (haven't rebooted after Linode upgraded the RAM), does around 200k page views/day. I am using Nginx rather than Lighttpd, and during peak hours it can do up to ~75 req/sec easily, holding around 300 connections (keep alive at around 15 seconds).

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct