Fitting mysql and apache on a lowend linode
9 Replies
Tasks: 32 total, 1 running, 31 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0% user, 0.0% system, 0.0% nice, 100.0% idle
Mem: 59912k total, 41864k used, 18048k free, 6804k buffers
Swap: 263160k total, 5872k used, 257288k free, 16296k cached
CPU states: 0.0% user, 0.0% system, 0.0% nice, 100.0% idle
Mem: 59908K total, 53568K used, 6340K free, 8812K buffers
Swap: 191456K total, 12816K used, 178640K free, 18256K cached
First I compile MySQL with the following options:
./configure –prefix=/usr/local/mysql --enable-thread-safe-client --enable-assembler --with-low-memory --enable-local-infile
Secondly I use the my-small.cnf file
cp /usr/local/mysql/share/mysql/my-small.cnf /etc/my.cnf
Lastly I choose to enable skip-networking in my.cnf because I do not need it (everyone connects via local socket), we can assume this saves a few kilobytes of memory!(lol)
For apache2, I compile with:
./configure --enable-deflate --enable-logio --enable-log-config --enable-headers --enable-ssl --enable-http --enable-rewrite --enable-so --prefix=/usr/local/apache
Additionally I have apache use /dev/urandom as a place for entroy because /dev/random is supposed to take more CPU ?
The one thing I have yet to figure out myself is how to tweak all those MPM settings. shrug
Hope these random bits of info help
Bill Clinton
However I don't have any users yet since I am waiting on DNS servers to start directing the traffic to me. I have uses phpmyadmin and phpwiki on it without any issues.
Also, Bill, I don't think /dev/urandom vs /dev/random is a CPU issue too much. The only difference is that when the kernel hasn't got enough entropy built up, /dev/random blocks and waits for more to come (from I/O, e.g.) whereas /dev/urandom will always return something, and that something may theoretically be predictable. In practice it may not matter.
There has been a few occasions when things have almost ground to a halt and the load average has shot up to around 12 and sendmail has rejected connections. I haven't been able to link it to any flurry of activity in the logs so now I'm dumping ps aux to a file every minute so if it happens again I'll hopefully have a snapshot of what's happening.
Having said that, things seem to be going particularly well right now. Last night I upraded MySQL to 4.0.18 from the rpm and Spamassassin to 2.6.3. I've been finding things a bit slow in general lately even when the load average is low but suddenly everything is running very well again like it was when I joined. I'm not sure if its related to my upgrades or the 2.4.25 kernel upgrade or something has just happened on Host 8.
You didn't mention if you are running Spamassassin but it is quite a memory hog. Maybe there is a lower footprint alternative.
I'm experimenting with a small query cache (2Mb) with MySQL. I'm not sure if its making much difference yet but I suspect even a small cache could make a big difference depending on the query behaviour of your applications especially if you could modify the code so that only the small frequent, seldom changed queries are in the cache.
I have a question. I compilied PHP with most of the extras. My libphp4.so file is a bit over 11 Mb. Does that have an effect on the memory that Apache uses? I seems like it should but 'top' lists the httpd processes size as a bit over 3332 Kb. Is it worth me trying to reduce the libphp4.so file size by taking out features I'm not using?
Cheers
Ross
@tetranz:
My libphp4.so file is a bit over 11 Mb. Does that have an effect on the memory that Apache uses?
No, it does not have an effect on the memory apache uses.
Chances are your libphp4.so file has not been stripped of its debugging information. By doing "strip libphp4.so" you will remove such information and greatly reduce the size of your file.
Whether a module is stripped or not does not have an effect on the performance of that file or the applications that use that file
Blll Clinton
http://www.sqlite.com/
For PHP 4.3x users, you can just do a pear install sqlite on the command line and then add extension=sqlite.so to your php.ini. Debian users will want to have php4-dev, php4-cgi, and php4-pear installed first for this to work. You do not need sqlite installed.
@tetranz:
There has been a few occasions when things have almost ground to a halt and the load average has shot up to around 12 and sendmail has rejected connections. I haven't been able to link it to any flurry of activity in the logs so now I'm dumping ps aux to a file every minute so if it happens again I'll hopefully have a snapshot of what's happening.
I doubt that this has much to do with your specific configuration. A Linode can grind to a halt at load 12 without even doing anything, if other Linodes on the box are thrashing the disk. It happens sometimes. I am currently monitoring my Linode64 on host5 by doing an uptime every 15 seconds to see the load. I haven't looked at the results in a couple of days but in my first few days of monitoring I saw my Linode's host shoot up to 3, 4, 5, and yes, even 12, when it wasn't even doing anything. This would happen a few times per day. I'll post a summary once I have collected a week's worth of data.