I'm still having a big trouble in my server. I can't find the solution, so i need your help I'm having a problem similar to the described here: http://www.howtoforge.com/forums/showthread.php?t=49398. I created an earlier post here: http://www.howtoforge.com/forums/showthread.php?t=56003 The situation: I made MySQL tuning (this morning, i don't have the minimum 48hrs for full statistics. This is the tuning-primer.sh script output: Code: root@server01:~# ./tuning-primer.sh -- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery - MySQL Version 5.1.58-1ubuntu1-log x86_64 Uptime = 0 days 0 hrs 45 min 25 sec Avg. qps = 22 Total Questions = 62276 Threads Connected = 1 Warning: Server has not been running for at least 48hrs. It may not be safe to use these recommendations To find out more information on how each of these runtime variables effects performance visit: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html Visit http://www.mysql.com/products/enterprise/advisors.html for info about MySQL's Enterprise Monitoring and Advisory Service SLOW QUERIES The slow query log is enabled. Current long_query_time = 10.000000 sec. You have 348 out of 62297 that take longer than 10.000000 sec. to complete Your long_query_time seems to be fine BINARY UPDATE LOG The binary update log is NOT enabled. You will not be able to do point in time recovery See http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html WORKER THREADS Current thread_cache_size = 8 Current threads_cached = 7 Current threads_per_sec = 0 Historic threads_per_sec = 0 Your thread_cache_size is fine MAX CONNECTIONS Current max_connections = 100 Current threads_connected = 1 Historic max_used_connections = 11 The number of used connections is 11% of the configured maximum. Your max_connections variable seems to be fine. INNODB STATUS Current InnoDB index space = 192 K Current InnoDB data space = 128 K Current InnoDB buffer pool free = 91 % Current innodb_buffer_pool_size = 8 M Depending on how much space your innodb indexes take up it may be safe to increase this value to up to 2 / 3 of total system memory MEMORY USAGE Max Memory Ever Allocated : 140 M Configured Max Per-thread Buffers : 456 M Configured Max Global Buffers : 90 M Configured Max Memory Limit : 546 M Physical Memory : 1.96 G Max memory limit seem to be within acceptable norms KEY BUFFER Current MyISAM index space = 17 M Current key_buffer_size = 64 M Key cache miss rate is 1 : 384 Key buffer free ratio = 79 % Your key_buffer_size seems to be fine QUERY CACHE Query cache is enabled Current query_cache_size = 16 M Current query_cache_used = 14 M Current query_cache_limit = 2 M Current Query cache Memory fill ratio = 93.42 % Current query_cache_min_res_unit = 4 K However, 11629 queries have been removed from the query cache due to lack of memory Perhaps you should raise query_cache_size MySQL won't cache query results that are larger than query_cache_limit in size SORT OPERATIONS Current sort_buffer_size = 2 M Current read_rnd_buffer_size = 256 K Sort buffer seems to be fine JOINS Current join_buffer_size = 2.00 M You have had 0 queries where a join could not use an index properly Your joins seem to be using indexes properly OPEN FILES LIMIT Current open_files_limit = 1024 files The open_files_limit should typically be set to at least 2x-3x that of table_cache if you have heavy MyISAM usage. Your open_files_limit value seems to be fine TABLE CACHE Current table_open_cache = 457 tables Current table_definition_cache = 256 tables You have a total of 258 tables You have 269 open tables. The table_cache value seems to be fine You should probably increase your table_definition_cache value. TEMP TABLES Current max_heap_table_size = 128 M Current tmp_table_size = 128 M Of 1691 temp tables, 30% were created on disk Perhaps you should increase your tmp_table_size and/or max_heap_table_size to reduce the number of disk-based temporary tables Note! BLOB and TEXT columns are not allow in memory tables. If you are using these columns raising these values might not impact your ratio of on disk temp tables. TABLE SCANS Current read_buffer_size = 128 K Current table scan ratio = 49 : 1 read_buffer_size seems to be fine TABLE LOCKING Current Lock Wait ratio = 1 : 24150 Your table locking seems to be fine Mysqltuner.pl script says: Code: >> MySQLTuner 1.2.0 - Major Hayden <[email protected]> >> Bug reports, feature requests, and downloads at http://mysqltuner.com/ >> Run with '--help' for additional options and output filtering -------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.1.58-1ubuntu1-log [OK] Operating on 64-bit architecture -------- Storage Engine Statistics ------------------------------------------- [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 49M (Tables: 227) [--] Data in InnoDB tables: 128K (Tables: 8) [!!] Total fragmented tables: 16 -------- Security Recommendations ------------------------------------------- [OK] All database users have passwords assigned -------- Performance Metrics ------------------------------------------------- [--] Up for: 50m 13s (74K q [24.606 qps], 1K conn, TX: 837M, RX: 20M) [--] Reads / Writes: 94% / 6% [--] Total buffers: 218.0M global + 4.6M per thread (100 max threads) [OK] Maximum possible memory usage: 674.2M (33% of installed RAM) [OK] Slow queries: 0% (430/74K) [OK] Highest usage of available connections: 11% (11/100) [OK] Key buffer size / total MyISAM indexes: 64.0M/17.7M [OK] Key buffer hit rate: 99.8% (4M cached / 8K reads) [OK] Query cache efficiency: 61.7% (42K cached / 68K selects) [!!] Query cache prunes per day: 456890 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 2K sorts) [!!] Temporary tables created on disk: 31% (1K on disk / 3K total) [OK] Thread cache hit rate: 98% (11 created / 1K connections) [OK] Table cache hit rate: 20% (269 open / 1K opened) [OK] Open file limit used: 50% (512/1K) [OK] Table locks acquired immediately: 99% (29K immediate / 29K locks) [OK] InnoDB data size / buffer pool: 128.0K/8.0M -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance MySQL started within last 24 hours - recommendations may be inaccurate When making adjustments, make tmp_table_size/max_heap_table_size equal Reduce your SELECT DISTINCT queries without LIMIT clauses Variables to adjust: query_cache_size (> 16M) tmp_table_size (> 128M) max_heap_table_size (> 128M) In certain (randomly, i think) moments every about 1-2 days, my server hangs. The free memory going down to zero and i have maaaany php-cgi processes from the same website. The website has not a great traffic; about 300 unique visits per day. When the server hangs, i must restart apache (the server in on heavy load, so it needs 2-3 minutes for completing the operation) Then, EVERY TIME the server hangs, i must restart amavis and clamav, that dies without any reason: Code: root@server01:~# service amavis status * amavisd is not running root@server01:~# service clamav-daemon status * clamd is not running root@server01:~# I've put in crontab a script that seek & destroy zombie processes every 10 minutes: http://www.mariusv.com/automatic-zombie-processes-killing-shell-script/ But the server continues hanging up, going in heavy load. My personal blog (http://www.skyflash.it is the only site up & running in the server and uses SuExec and FastCGI ISPConfig is 3.0.4.2 Please, help me
Apache2 error.log Code: root@server01:~# tail -f /var/log/apache2/error.log PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0 [Fri Feb 10 12:00:23 2012] [error] [client 93.67.224.50] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/20080305599/giurisprudenza/nota-aams-sul-pagamento-del-preu.html [Fri Feb 10 12:00:38 2012] [error] [client 93.67.224.50] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/chi-siamo.html [Fri Feb 10 12:00:53 2012] [error] [client 93.67.224.50] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/20080305599/giurisprudenza/nota-aams-sul-pagamento-del-preu.html [Fri Feb 10 12:08:40 2012] [error] [client 88.48.249.194] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/ [Fri Feb 10 12:12:09 2012] [error] [client 95.241.54.145] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/20090204828/circolari-unindustria/circ.-252-autoliquidazione-dei-premi-inail-2008-2009.html [Fri Feb 10 12:12:30 2012] [error] [client 95.241.54.145] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/20090204828/circolari-unindustria/circ.-252-autoliquidazione-dei-premi-inail-2008-2009.html [Fri Feb 10 12:19:02 2012] [error] [client 87.22.9.107] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/20090204828/circolari-unindustria/circ.-252-autoliquidazione-dei-premi-inail-2008-2009.html [Fri Feb 10 12:19:11 2012] [error] [client 87.22.9.107] File does not exist: /var/www/piwik.js, referer: http://www.acmi.ws/20090204828/circolari-unindustria/circ.-252-autoliquidazione-dei-premi-inail-2008-2009.html [Fri Feb 10 12:24:25 2012] [error] [client 93.63.146.178] File does not exist: /var/www/piwik.js I removed NOW the wrong piwik.js directives from the external website that was pointing to a service i've disabled in my blog (web2) Website error.log Code: root@server01:~# tail -f /var/www/clients/client1/web2/log/error.log [Fri Feb 10 12:21:10 2012] [warn] [client 193.47.80.51] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/web/skyflash/www.skyflash.it/public_html/wp-content/uploads/2006/06/500px-GP2X.jpg) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:21:10 2012] [warn] [client 193.47.80.51] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/web/skyflash/www.skyflash.it/public_html/wp-content/uploads/2006/06/germania2006.gif) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:21:10 2012] [warn] [client 193.47.80.51] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/web/skyflash/www.skyflash.it/public_html/wp-content/uploads/2006/06/telecomando.jpg) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:22:23 2012] [warn] [client 123.125.68.84] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/web/skyflash/www.skyflash.it/public_html/wp-content/uploads/2006/04/d2d.jpg) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:22:29 2012] [warn] [client 207.241.237.232] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/vhosts/skyflash.it/httpdocs/wp-content/uploads/2007/01/10milioni_ds.jpg) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:22:29 2012] [warn] [client 207.241.237.232] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/vhosts/skyflash.it/httpdocs/wp-content/uploads/2006/07/ds_04.jpg) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:22:29 2012] [warn] [client 207.241.237.232] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/web/skyflash/www.skyflash.it/public_html/wp-content/uploads/2006/04/ds_New_Super_Mario_Bros.png) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:22:29 2012] [warn] [client 207.241.237.232] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/web/skyflash/www.skyflash.it/public_html/wp-content/uploads/2006/04/dslair2.jpg) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:22:40 2012] [warn] [client 94.228.34.224] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/vhosts/skyflash.it/httpdocs/wp-content/uploads/2007/05/wiider1.png) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 [Fri Feb 10 12:25:03 2012] [warn] [client 141.105.120.150] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/vhosts/skyflash.it/httpdocs/wp-content/uploads/2008/10/windows_xp_logo.png) is not within the allowed path(s): (/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/skyflash.it/web:/srv/www/skyflash.it/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web2/web/wp-content/themes/freshnews/functions/admin-functions.php on line 588 Errors about old paths caused by the migration from the old hosting service to the actual VPS
Some new indications in server's Apache error.log Code: [Fri Feb 10 14:40:03 2012] [error] mod_fcgid: fcgid process manager died, restarting the server [Fri Feb 10 14:40:03 2012] [notice] SIGHUP received. Attempting to restart [Fri Feb 10 14:40:04 2012] [notice] Digest: generating secret for digest authentication ... [Fri Feb 10 14:40:04 2012] [notice] Digest: done [Fri Feb 10 14:40:04 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) [Fri Feb 10 14:40:04 2012] [notice] Apache/2.2.20 (Ubuntu) DAV/2 mod_fcgid/2.3.6 PHP/5.3.6-13ubuntu3.3 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.7(2011-06-30) mod_ssl/2.2.20 OpenSSL/1.0.0e configured -- resuming normal operations
Looks like a problem with disk I/O to me. You should try to optimize MySQL server settings and set up caching for your web sites (maybe in combination with memcached or with a memory file system like tmpfs). You might also want to check your Apache settings: http://www.howtoforge.com/configuring_apache_for_maximum_performance
This is the output of tuning-primer after i modified some mysqld settings: Code: root@server01:~# ./tuning-primer.sh -- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery - MySQL Version 5.1.58-1ubuntu1-log x86_64 Uptime = 0 days 14 hrs 31 min 13 sec Avg. qps = 15 Total Questions = 802751 Threads Connected = 1 Warning: Server has not been running for at least 48hrs. It may not be safe to use these recommendations To find out more information on how each of these runtime variables effects performance visit: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html Visit http://www.mysql.com/products/enterprise/advisors.html for info about MySQL's Enterprise Monitoring and Advisory Service SLOW QUERIES The slow query log is enabled. Current long_query_time = 10.000000 sec. You have 4947 out of 802772 that take longer than 10.000000 sec. to complete Your long_query_time seems to be fine BINARY UPDATE LOG The binary update log is NOT enabled. You will not be able to do point in time recovery See http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html WORKER THREADS Current thread_cache_size = 8 Current threads_cached = 7 Current threads_per_sec = 0 Historic threads_per_sec = 0 Your thread_cache_size is fine MAX CONNECTIONS Current max_connections = 100 Current threads_connected = 1 Historic max_used_connections = 33 The number of used connections is 33% of the configured maximum. Your max_connections variable seems to be fine. INNODB STATUS Current InnoDB index space = 192 K Current InnoDB data space = 128 K Current InnoDB buffer pool free = 91 % Current innodb_buffer_pool_size = 8 M Depending on how much space your innodb indexes take up it may be safe to increase this value to up to 2 / 3 of total system memory MEMORY USAGE Max Memory Ever Allocated : 304 M Configured Max Per-thread Buffers : 456 M Configured Max Global Buffers : 154 M Configured Max Memory Limit : 610 M Physical Memory : 1.96 G Max memory limit seem to be within acceptable norms KEY BUFFER Current MyISAM index space = 12 M Current key_buffer_size = 64 M Key cache miss rate is 1 : 6489 Key buffer free ratio = 77 % Your key_buffer_size seems to be fine QUERY CACHE Query cache is enabled Current query_cache_size = 80 M Current query_cache_used = 76 M Current query_cache_limit = 4 M Current Query cache Memory fill ratio = 95.87 % Current query_cache_min_res_unit = 4 K However, 68135 queries have been removed from the query cache due to lack of memory Perhaps you should raise query_cache_size MySQL won't cache query results that are larger than query_cache_limit in size SORT OPERATIONS Current sort_buffer_size = 2 M Current read_rnd_buffer_size = 256 K Sort buffer seems to be fine JOINS Current join_buffer_size = 2.00 M You have had 2 queries where a join could not use an index properly You should enable "log-queries-not-using-indexes" Then look for non indexed joins in the slow query log. If you are unable to optimize your queries you may want to increase your join_buffer_size to accommodate larger joins in one pass. Note! This script will still suggest raising the join_buffer_size when ANY joins not using indexes are found. OPEN FILES LIMIT Current open_files_limit = 1110 files The open_files_limit should typically be set to at least 2x-3x that of table_cache if you have heavy MyISAM usage. Your open_files_limit value seems to be fine TABLE CACHE Current table_open_cache = 500 tables Current table_definition_cache = 16384 tables You have a total of 202 tables You have 227 open tables. The table_cache value seems to be fine TEMP TABLES Current max_heap_table_size = 256 M Current tmp_table_size = 256 M Of 15040 temp tables, 32% were created on disk Perhaps you should increase your tmp_table_size and/or max_heap_table_size to reduce the number of disk-based temporary tables Note! BLOB and TEXT columns are not allow in memory tables. If you are using these columns raising these values might not impact your ratio of on disk temp tables. TABLE SCANS Current read_buffer_size = 128 K Current table scan ratio = 154 : 1 read_buffer_size seems to be fine TABLE LOCKING Current Lock Wait ratio = 1 : 6331 Your table locking seems to be fine It tells me i must expand the max_heap_table_size to a value > 256M. I try 352MB? In this section, what setting you suggest me? Code: QUERY CACHE Query cache is enabled Current query_cache_size = 80 M Current query_cache_used = 76 M Current query_cache_limit = 4 M Current Query cache Memory fill ratio = 95.87 % Current query_cache_min_res_unit = 4 K However, 68135 queries have been removed from the query cache due to lack of memory Perhaps you should raise query_cache_size MySQL won't cache query results that are larger than query_cache_limit in size Last thing: amavis and clamav are dead again
You should raise the query_cache_size value, but the value depends on how much memory you have available.