I have some re-architecting to do with my current setup. Right now on a 2G slice, I can only run 50 apache processes, and that seems to hit its limit every couple of days where there are 50 processes all serving requests which I can see with /server-status, and service gets highly degraded.
I would like to run a threaded Apache but I do not know if that is stable with mod_php. If it's not then I will likely need to do a nginx proxy, which I'm trying to avoid just because of the extra configuration, etc, needed to maintain it. I'm really trying to avoid nginx since apache has served me greatly and I think this is a mod_php issue that can be handled. Also the apps I'm currently supporting, one of them drupal based, has media files all over the place, so configured another server to intercept media requests would be more of an art than a science.
I've been happy with a streamlined apache but that is near impossible with mod_php and apache prefork. I'm not sure if it's a configuration problem or if it's just a result of the architecture I've chosen. An alternative I've had limited success with php is mod_fcgi, or fastcgi. I've had great success with my django apps using mod_fcgi but php has been unstable. But I haven't run it on a production site yet ... Ideally I would use mod_fcgi for my php apps and mod_wsgi for my python apps. This keeps Apache quite lean and on top of that if it's threaded then it should be able to handle lots of traffic without the memory limitations that apache prefork has. So this is my dilemma, I may need to invest in a new slice to play around with a threaded apache and then migrate stuff. But this is at least a week of work, any advice is appreciated.
well i got more responses on HN than here ... so add your bits there.
I don't know never used iowait... I'll look into it. What command do I use?
Well all my log files are rotating normally as far as I know ... here's the global log files. I love logrotate.d.
slice:~# ls -al /var/log/apache2/error.log
-rw-r----- 1 root adm 280975 Apr 2 12:05 /var/log/apache2/error.log
slice:~# ls -al /var/log/apache2/access.log
-rw-r----- 1 root adm 1190895 Apr 2 13:50 /var/log/apache2/access.log
The only bottleneck I have seen is in mysql ... which is hard to debug.
http://andric.us/load/localdomain/localhost.localdomain.html
So you think there is definitely something that is hanging up the apache processes. So my next question is,if it happens again, is there a way to poke apache to figure out what is the processes doing besides /server-status which just tells me they are all in W (writing) mode?
here's the output I let it run for a couple mins
slice:~# mysqladmin -u root -p ext -ri 30 | grep Created_tmp_disk
Enter password:
| Created_tmp_disk_tables | 130498 |
| Created_tmp_disk_tables | 32 |
| Created_tmp_disk_tables | 11 |
| Created_tmp_disk_tables | 19 |
| Created_tmp_disk_tables | 10 |
So the problem is mysql. http://andric.us/load/localdomain/localhost.localdomain.html
I get these slow queries every now and then, probably from the insane drupal install, and then apache gets hung up. Either because of IO or db. So I can do a mysqlslowqueries ... here's some of the output.
Count: 1 Time=46.00s (46s) Lock=0.00s (0s) Rows=5.0 (5), windyc[windyc]@local host
SELECT * FROM node n LEFT JOIN radioactivity dn ON n.nid = dn.id LEFT JOIN drigg_node dn2 ON dn2.dnid = n.nid WHERE ( N=N AND !(n.type='S' AND dn2.killed =N ) ) AND ( n.type='S' AND status=N AND promote=N ) ORDER BY dn.energy DESC LIMIT N
I will look into the radioactivity module then on one of the drupal installs i guess.
Yep sounds good. Unfortunately I'm running etch so ...
slice:~# apt-cache policy mysql-server
mysql-server:
Installed: 5.0.32-7etch1
Candidate: 5.0.32-7etch8
Version table:
5.0.51a-24~bpo40+1 0
1 http://www.backports.org etch-backports/main Packages
5.0.32-7etch8 0
500 http://ftp.us.debian.org etch/main Packages
500 http://security.debian.org etch/updates/main Packages
*** 5.0.32-7etch1 0
100 /var/lib/dpkg/status
I may have to go with a backport or move off etch to get the mysql tmpfs patch you mentioned.
Are there any issues with upgrading from mysql 5.0 to 5.1? Just a minor rev right, my dbs won't break?
Hah! Sorry for the noise ... ok back to tmpfs and memcache then!
blender, so you mentioned "Another thing you might consider to speed it up is use the memcache module and get the cache tables out of the DB", I just want to clarify what you meant by this. Am I right in thinking that I can configure mysql to use memcached as its tmpfs rather than disk? what did you mean by "memcache module"? I assumed http://danga.com/memcached/ .
Cool thanks, will keep you posted...
# mount -t ramfs ramfs /mysql_ramfs/
# chown mysql:mysql /mysql_ramfs/
# grep tmp /etc/mysql/my.cnf
tmpdir = /mysql_ramfs
tmp_table_size = 256M