Server memory tuning

6 views
Skip to first unread message

Lewis G Rosenthal

unread,
Sep 25, 2009, 11:06:58 PM9/25/09
to Apache2 Mailing List
As it should do no real harm to try to optimize things anyway, in an
ongoing effort to figure out what's making PHP complain for some of us
(me, in particular, but we should all benefit from these exchanges), and
following onto some of the advice I've passed on concerning shared
memory and such (which first came to my attention as it pertained to
NetWare; later in the NetWare 6.0 Support Pack cycle, as more and more
*nix apps were ported to NetWare, we started seeing some real issues
with memory fragmentation - later, NetWare 6.5 addressed many of these
with new garbage collection routines and memory optimization methods,
but the underlying problem still exists, so OS/2 is in good company),
I've implemented a few tweaks tonight (and in recent weeks) which I
thought I'd share.

Steve suggested some time ago that I dump my DOS environment on the
server (it runs no DOS apps, anyway). The first time around, this simply
didn't go very well, and I was unable to initialize the desktop (huh?).
Tonight, however, I was successful in finally exorcising all vestiges of
the DOS environment by making the following changes to CONFIG.SYS:

1. setting PROTECTONLY=YES;
2. REMming all \OS2\MDOS drivers;
3. REMming \TCPIP\BIN\VDOSTCP.SYS and \MPTN\BIN\VDOSTCP.VDD
4. REMming FILES=, FCBS,= and DOS= (for the sake of completeness)

The system restarted nicely.

I then tried to turn off swapping (MEMMAN=NOSWAP,PROTECT), however, I
found that even with a 2GB system, I appeared to be running dangerously
low on available RAM. This server never swaps, which I confirmed via
Theseus before making the first reboot (which was after a day's uptime).
I selected System | Swapper and got:

Analysis of the SWAPPER.DAT file:
There are 512 disk frames in SWAPPER.DAT (each is 4K bytes).
There are 0 frames used. (0K => 0.000M)
There are 512 frames free. (2048K => 2.000M)
There are 512 frames total. (2048K => 2.000M)

However, upon reboot, as I said, the system appeared to be dangerously
low on RAM (not as reported by Theseus, but the Sentinel Memory Watcher
widget on the Xcenter showed about 300KB (yes, KB) unused out of
2,048MB, and another status monitor also showed very low resources.
Apache took about four retries to start up, each one lasting about ten
seconds before it finally appeared to want to stay up for at least a few
minutes. So, I turned swapping back on and rebooted. Everything settled
down to normal (for this box, at least).

Next, I looked at the actual process usage on the box, which is
typically under 50. Using Theseus, I selected System | General System |
General System Information, and looked up QSV_MAXPROCESSES, which was
1025. I lowered this in CONFIG.SYS to 256 via the PROCESSES=256 kernel
directive. Checking THREADS, I had a THREADS setting of 1024, but since
I rarely see anything over 250, I lowered this to 512 (THREADS=512). I
then rebooted without incident. Apache came up and stayed up for about a
half hour before hupping itself <sigh>, but everything else seems to be
neat and tidy, and the desktop feels a bit more responsive when Firefox
is running (though this may be entirely subjective, like when you're
running low on fuel, finally make it to the station, and somehow, the
car just seems to run better when you leave :-) .

Anyway, if any major change in behavior is noted, I'll post it.
Hopefully, between us, we can nail down these (this?) Apache and PHP
(and MySQL?) issue(s).

Cheers/2

BTW, here is the working set from Theseus after 359 intervals
(abbreviated for brevity):

hh:mm:ss.tt now ws accessed Free Idle
contributed total
22:25:43.63 9.531M 9.531M 9.531M1798.762M 1.137M
38 46
22:25:48.64 7.500M 10.324M 10.324M1798.758M 1.137M
38 46
22:25:53.67 6.824M 10.344M 10.344M1798.758M 1.137M
38 46
22:25:58.68 7.258M 10.430M 10.430M1798.785M 1.137M
38 46
22:26:03.71 7.879M 10.691M 10.691M1798.785M 1.137M
38 46
[...]
22:55:19.58 7.887M 29.516M 75.547M1806.566M 0.703M
38 46
22:55:24.61 16.063M 30.117M 75.750M1813.859M 1.504M
39 44
22:55:29.62 10.422M 29.793M 75.930M1825.563M 1.398M
38 43
22:55:34.63 24.207M 32.332M 76.215M1807.934M 0.703M
42 46 <-VNC session started!
22:55:39.65 22.688M 44.988M 76.406M1794.336M 0.703M
39 46

359 samples collected.
Total
Absolute minimum amount of memory: 39.137M
Recommended amount of memory: 54.652M
Total amount of accessed memory: 76.406M

Compare this to a working set I took on Sept 7:

Working Set for the entire System:
(RAM in machine = 524172 pages => 2096688K => 2047.547M.)
Use the 'Functions' pull-down or the 'Popup Menu'
to start and stop the data collection.
Collection started: interval = 5, Working Set is 12 intervals.
current time --------- Total ---------- ------ ------ ----
Process -----
hh:mm:ss.tt now ws accessed Free Idle
contributed total
16:54:52.20 15.629M 15.629M 15.629M1722.832M 0.520M
42 50
16:54:57.23 14.316M 19.047M 19.047M1722.844M 0.520M
44 50
16:55:02.23 15.629M 20.074M 20.074M1722.844M 0.520M
42 50
16:55:07.27 15.090M 21.723M 21.723M1722.750M 0.520M
42 50
[...]
17:10:45.86 19.895M 28.543M 131.137M1712.234M 0.520M
42 50
17:10:50.82 22.102M 28.637M 131.145M1712.219M 0.520M
42 50
17:10:55.83 12.207M 28.543M 131.145M1712.230M 0.520M
42 50
17:11:00.84 14.797M 28.715M 131.191M1712.055M 0.520M
42 50

194 samples collected.
Total
Absolute minimum amount of memory: 49.988M
Recommended amount of memory: 83.922M
Total amount of accessed memory: 131.191M

Of course this doesn't report the amount of fragmentation in the shared
memory area, but I need for the system to run for some time before I can
get an accurate read on that.

--
Lewis
-------------------------------------------------------------
Lewis G Rosenthal, CNA, CLP, CLE
Rosenthal & Rosenthal, LLC www.2rosenthals.com
Need a managed Wi-Fi hotspot? www.hautspot.com
Secure, stable, operating system www.ecomstation.com
-------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages