Zak B. Elep: Apache2 Worker MPM on Low Memory Servers
If you're running Apache2 on a memory-constrained system (like in a
virtual machine,) you may want to choose the prefork MPM to save memory at
the cost of more process forks. However, if you have more than one CPU on that
same machine, you may also want to consider using the threaded worker MPM
and tweak its
MaxClients and ThreadsPerChild settings from the default
configuration.
On a typical apache2 installation on a Debian system, the worker MPM
configuration looks like this:
<IfModule mpm_worker_module>
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Using these default settings on a resource-constrained system (say a server
with 128MB of RAM but with no swap) would be overkill, and the web server
processes will definitely eat up all of that memory, leaving little or no room
for even simple CGI scripts.
In my setup, I experimented with tweaking the values above to get apache2 to
serve without eating up too much precious memory. I found that the important
values to consider here are MaxClients, which dictate how many clients can
connect simultaneously to my server, and ThreadsPerChild, which specifies how
many threads of execution can run in a child/worker process. My resulting
config becomes:
<IfModule mpm_worker_module>
MaxClients 15
MinSpareThreads 3
MaxSpareThreads 7
ThreadsPerChild 3
MaxRequestsPerChild 200
</IfModule>
With this setup, I free up a significant amount of RAM from apache2's hold whle
maximizing my thread usage in each worker process; at the same time, I avoid
keeping each child process for too long by setting a maximum number of requests
each worker can serve, preventing the workers to bloat too much when handling
CGI.
I also tweaked the KeepAliveTimeout setting to just 2 seconds (instead of the
default 15) so that each worker process can go to the next request quickly and
preventing them from being tied up to a connection for too long. I also set
the Timeout to 30 seconds.
Something I never really mentioned was the purchase of the foldable bike:
a
But what is new now is that I finally gave in and bought a road bike, once
again off craigslist. My daily commute is about ten miles one-way, which
works out to about 35 to 40 minutes of cycling, plus a few minutes of
locking/un-locking, changing, etc.
I had used my trusted (yet heavier) touring bike with its steel frame a
number of times, but felt that a road bike may make for a faster ride. While
it saves a few minutes, it is not really a time saver as the bike-train-bike
commute also takes around 40 to 50 minutes. That said, riding is simply a
nice way to clear the head before or
after work. I am back on the schedule I tried for a few weeks last summer /
fall: running on Tuesday and Thursday leaves Monday, Wednesday and Friday
for the bike commute. So far, I am 8 for 9 over the last three weeks. On the
downside: one rather wet ride home, and already to minor flats that (luckily)
still allowed riding home. The hardest part is meeting up with some other
riders at 6:00am meaning that I am now getting up at 5:00am whether I am
running or not. But all told a nice way to get some exercise in outside of
running.
My
Starting to play with eeePC.
Thanks to ASUS,
I am now playing with an eeePC.
With the help of Andrew Lee, I have set up LXDE environment,
with full wifi support (through madwifi), and other goodies.
I'm now looking into making the boot time shorter.
I like the concept of finit, which is just to rewrite most
initialization in C, nothing can beat that. However, Debian
in general will need something more extensible than that.
insserv and CONCURRENCY=shell helped the boot time a bit
but it's still in the orders of approx. 60 seconds, which isn't
quite fast enough.
"your download link will arrive momentarily at the email address you submitted.
to ensure the email does not get marked as spam, please instruct your email
client to accept mail from nin.com."
I wonder how many spambots are busy blasting off zillions of spams with headers
forged to be from nin.com as we speak? Best of all, the spams can be
customised, you know that many of the people getting them will enjoy this
music.
(Sometimes I wish I could take advantage of these money-making opportunities
as they present themselves to me..)
Sarah and I are doing the Tour de Cure again this year, like we
Some of you might have noticed that in the recent weeks I wasn't active at all online. This was because I was on a vacation in Italy. On the way back I was eager to write about my experiences, but after entering Romania, I found out that may parents had been involved in a motorcycle accident due to a careless driver.
The SANE project is working on improving SANE, extending the API and ABI in a backward-compatible manner and bumping the version from 1.0.x to 1.1.x to celebrate that.
The timetable has been posted, and calls for a release of SANE 1.1.0 on July, 30th.
This will be too late for the Lenny freeze by a few weeks, which means Lenny is set to be released with SANE 1.0.19.
SANE 1.0.19 is a good, solid release, which is good news. I’m not sure 1.1.0 will be as solid as 1.0.19 is, so I won’t try to rush 1.1.0 into Lenny at the last minute.
Until the Lenny freeze, I’m going to augment the current SANE 1.0.19 with code from the SANE CVS, concentrating mostly on bugfixes and self-contained new hardware support and features.
Hence, if there is something in the SANE CVS that you would like to see in Lenny: test it, then tell me about it. You have until the end of June to do so.
Currently on my TODO list:
Well a brief post about what I've been up to over the past few days.
An alioth project was created for the maintainance of
A