PDA

View Full Version : HELP: Inproving Mysql


The Realist
Thu 26th Sep '02, 3:33pm
Hi All,

My server keeps failing and loads going high. Here is my details and can the server be improved at all.

Server is:

• Celeron 1 Ghz processor, 512 MB ram
• Linux RedHat 7.2
• Apache 1.3.22
• PHP 4.2.2
• MySQL Ver 3.23.41
• Perl 5.6.1

Php info

HERE (http://www.deahost.com/phpinfo.php)

Other details below:

Thu Sep 26 19:25:40 GMT 2002


7:25pm up 1:44, 2 users, load average: 0.14, 0.41, 0.49
220 processes: 219 sleeping, 1 running, 0 zombie, 0 stopped
Mem: 511732K av, 489632K used, 22100K free, 1444K shrd, 47472K buff
Swap: 1052216K av, 2396K used, 1049820K free 180284K cached



Http processes currently running = 89
Mysql processes currently running = 76

Netstat information summary
1 SYN_RECV
2 FIN_WAIT2
23 ESTABLISHED
29 LISTEN
33 TIME_WAIT

+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| Aborted_clients | 0 |
| Aborted_connects | 35 |
| Bytes_received | 3557257 |
| Bytes_sent | 64093280 |
| Connections | 3404 |
| Created_tmp_disk_tables | 63 |
| Created_tmp_tables | 1917 |
| Created_tmp_files | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_delete | 139 |
| Handler_read_first | 1892 |
| Handler_read_key | 229110 |
| Handler_read_next | 340745 |
| Handler_read_prev | 240 |
| Handler_read_rnd | 66532 |
| Handler_read_rnd_next | 1233747 |
| Handler_update | 4655 |
| Handler_write | 28976 |
| Key_blocks_used | 781 |
| Key_read_requests | 425923 |
| Key_reads | 758 |
| Key_write_requests | 4858 |
| Key_writes | 2723 |
| Max_used_connections | 68 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 210 | 21% of table_cache in use
| Open_files | 375 |
| Open_streams | 0 |
| Opened_tables | 216 |
| Questions | 37066 |
| Select_full_join | 7 |
| Select_full_range_join | 36 |
| Select_range | 587 |
| Select_range_check | 0 |
| Select_scan | 10148 |
| Slave_running | OFF |
| Slave_open_temp_tables | 0 |
| Slow_launch_threads | 0 |
| Slow_queries | 0 | (execution time > 10 secs)
| Sort_merge_passes | 0 |
| Sort_range | 1251 |
| Sort_rows | 77606 |
| Sort_scan | 3525 |
| Table_locks_immediate | 34325 |
| Table_locks_waited | 1 |
| Threads_cached | 7 |
| Threads_created | 69 |
| Threads_connected | 63 |
| Threads_running | 2 |
| Uptime | 6168 | 1 hr 42 mins 48 secs
+--------------------------+----------+


Key Reads/Key Read Requests = 0.001780 (Cache hit = 99.99822%)
Key Writes/Key Write Requests = 0.560519
Connections/second = 0.552 (/hour = 1986.770)
KB received/second = 0.563 (/hour = 2027.043)
KB sent/second = 10.148 (/hour = 36531.712)
Temporary Tables Created/second = 0.311 (/hour = 1118.872)
Opened Tables/second = 0.035 (/hour = 126.070)
Slow Queries/second = 0.000 (/hour = 0.000)
% of slow queries = 0.000%
Queries/second = 6.009 (/hour = 21633.852)


[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable = max_connections=500
set-variable = key_buffer=16M
set-variable = myisam_sort_buffer_size=64M
set-variable = join_buffer=1M
set-variable = record_buffer=1M
set-variable = sort_buffer=2M
set-variable = table_cache=1024
set-variable = thread_cache_size=256
set-variable = wait_timeout=3600
set-variable = connect_timeout=10
set-variable = max_allowed_packet=16M
set-variable = max_connect_errors=10

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192

[mysqldump]
quick
set-variable = max_allowed_packet=16M

7:40pm up 1:59, 2 users, load average: 0.44, 0.44, 0.44

Thu Sep 26 19:40:34 GMT 2002
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| Aborted_clients | 0 |
| Aborted_connects | 40 |
| Bytes_received | 3953441 |
| Bytes_sent | 70218795 |
| Connections | 3876 |
| Created_tmp_disk_tables | 70 |
| Created_tmp_tables | 2102 |
| Created_tmp_files | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_delete | 154 |
| Handler_read_first | 2073 |
| Handler_read_key | 246585 |
| Handler_read_next | 379874 |
| Handler_read_prev | 240 |
| Handler_read_rnd | 75255 |
| Handler_read_rnd_next | 1416226 |
| Handler_update | 4969 |
| Handler_write | 31700 |
| Key_blocks_used | 806 |
| Key_read_requests | 464869 |
| Key_reads | 781 |
| Key_write_requests | 5241 |
| Key_writes | 2958 |
| Max_used_connections | 68 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 210 |
| Open_files | 375 |
| Open_streams | 0 |
| Opened_tables | 216 |
| Questions | 41353 |
| Select_full_join | 8 |
| Select_full_range_join | 38 |
| Select_range | 705 |
| Select_range_check | 0 |
| Select_scan | 11455 |
| Slave_running | OFF |
| Slave_open_temp_tables | 0 |
| Slow_launch_threads | 0 |
| Slow_queries | 0 |
| Sort_merge_passes | 0 |
| Sort_range | 1444 |
| Sort_rows | 87876 |
| Sort_scan | 3890 |
| Table_locks_immediate | 37944 |
| Table_locks_waited | 2 |
| Threads_cached | 5 |
| Threads_created | 69 |
| Threads_connected | 64 |
| Threads_running | 1 |
| Uptime | 7060 |
+--------------------------+----------+


Thanks,

Brian :)

The Realist
Fri 27th Sep '02, 8:56am
Anyone with any help on this?

Regards,

Brian

eva2000
Fri 27th Sep '02, 11:12am
doesn't look like mysql is the problem from what you provided

you might want to upgrade apache to 1.3.26 and mysql to 3.23.52 and php to 4.2.3

what other sites share your server ? what other scripts you have installed ? how many users online does your vB get ? what vB version ?

The Realist
Fri 27th Sep '02, 11:30am
I have 39 other domains on the server which 2 are also forums but not VB. Scripts I have not looked at yet but will get back to you? or is there an easy way to find them?

My VB forums get a very low usage and I know its not that.

I will consider upgrading but I just had a look at my top in SSH and it went up to 15.00 at one point.

I have also posted HERE (http://forum.rackshack.net/showthread.php?s=&threadid=11005) looking for help, perhaps you could give some pointers with this post as well.

Thanks,

Brian

Originally posted by eva2000
doesn't look like mysql is the problem from what you provided

you might want to upgrade apache to 1.3.26 and mysql to 3.23.52 and php to 4.2.3

what other sites share your server ? what other scripts you have installed ? how many users online does your vB get ? what vB version ?

eva2000
Fri 27th Sep '02, 11:34am
what do you have maxclients set to in httpd.conf ?

also looks like you may have phpa configured incorrectly

what's your forum url ? i'd upgrade to latest phpa version and pay attention to changes and additions to phpa configuration in php.ini

The Realist
Fri 27th Sep '02, 12:06pm
Im not realy worried about the forum, it effects the whole server and all the domains on it. Max clients I have increased to as follows:

KeepAlive: On
MaxKeepAliveRequests: 100
KeepAliveTimeout: 15
MinSpareServers: 25
MaxSpareServers: 50
StartServers: 25
MaxClients: 550

forum URL: www.skytronic-forums.com

What do I need to look at in php.ini regarding these phpa erors?

Thanks,

Brian


Originally posted by eva2000
what do you have maxclients set to in httpd.conf ?

also looks like you may have phpa configured incorrectly

what's your forum url ? i'd upgrade to latest phpa version and pay attention to changes and additions to phpa configuration in php.ini

eva2000
Fri 27th Sep '02, 12:10pm
change in httpd.conf to below and restart apache

KeepAlive: On
MaxKeepAliveRequests: 100
KeepAliveTimeout: 15
MinSpareServers: 10
MaxSpareServers: 15
StartServers: 25
MaxClients: 150

eva2000
Fri 27th Sep '02, 12:11pm
as to phpa errors read i mentioned about this on June 15 at http://i4net.tv/marticle/get.php?action=getarticle&articleid=31

read http://www.php-accelerator.co.uk/server_hang.php but latest phpa 1.3.2 rev2 shouldn't have this problem

The Realist
Fri 27th Sep '02, 12:14pm
It Baffles me here because it says in the error log the following:

Fri Sep 27 11:40:14 2002] [error] server reached MaxClients setting, consider raising the MaxClients setting

The current settings are:

MaxClients: 550

Yours:

MaxClients: 150

Why does the error say to increase the max clients?

Thanks, changing setings now.

Brian

Originally posted by eva2000
change in httpd.conf to below and restart apache

KeepAlive: On
MaxKeepAliveRequests: 100
KeepAliveTimeout: 15
MinSpareServers: 10
MaxSpareServers: 15
StartServers: 25
MaxClients: 150

eva2000
Fri 27th Sep '02, 12:18pm
Originally posted by The Realist
It Baffles me here because it says in the error log the following:

Fri Sep 27 11:40:14 2002] [error] server reached MaxClients setting, consider raising the MaxClients setting

The current settings are:

MaxClients: 550

Yours:

MaxClients: 150

Why does the error say to increase the max clients?

Thanks, changing setings now.

Brian yes you need to raise maxclients because your server ain't handling the number of concurrent connections... but because your raise the maxclients you're letting in more mysql concurrent connections than your server can handle... catch 22 due to underpowered hardware