PDA

View Full Version : Server Optimization Request


DTC
Sun 27th Feb '05, 10:37pm
1. Is this on dedicated or shared virual server. Dedicated

2. Dual Xeon 2.4
2 GB Ram
Dual SATA HD's Raid 1
RHE Linux 2.4.21-27.0.1 SMP
Apache 1.3.33
PHP 4.3.10
MySql 4.0.22

3. Any innodb type databases/tables on your server? No

4. If possible how mysql was compiled/installed Thru CPanel

5. your top stats

19:37:56 up 15 days, 12:29, 2 users, load average: 6.11, 5.37, 4.93
632 processes: 626 sleeping, 5 running, 1 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 69.1% 0.0% 13.1% 0.0% 0.5% 0.0% 17.1%
cpu00 68.0% 0.0% 11.1% 0.1% 0.7% 0.0% 19.8%
cpu01 77.7% 0.0% 12.6% 0.0% 0.0% 0.0% 9.5%
cpu02 63.5% 0.0% 13.8% 0.0% 0.7% 0.0% 21.8%
cpu03 67.1% 0.0% 15.0% 0.0% 0.5% 0.0% 17.1%
Mem: 2055392k av, 1968652k used, 86740k free, 0k shrd, 180468k buff
1346524k actv, 271620k in_d, 31220k in_c
Swap: 4096532k av, 0k used, 4096532k free 1094548k cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1881 mysql 18 0 65400 63M 1564 R 10.2 3.1 1:32 2 mysqld
1363 mysql 17 0 65400 63M 1564 R 9.9 3.1 2:20 0 mysqld
563 mysql 17 0 65400 63M 1564 S 9.0 3.1 3:05 3 mysqld
552 mysql 17 0 65400 63M 1564 S 8.4 3.1 3:16 1 mysqld
1874 mysql 17 0 65400 63M 1564 S 7.8 3.1 1:41 1 mysqld
744 mysql 17 0 65400 63M 1564 R 6.2 3.1 3:21 3 mysqld
559 mysql 16 0 65400 63M 1564 S 4.9 3.1 3:28 3 mysqld
11748 nobody 16 0 19136 18M 14176 S 4.3 0.9 5:47 0 httpd
3154 nobody 16 0 13880 13M 9384 S 2.4 0.6 0:12 0 httpd
4327 nobody 15 0 11824 11M 7268 S 2.1 0.5 0:01 3 httpd
29626 nobody 15 0 16680 16M 11968 S 1.9 0.8 2:02 1 httpd
5847 nobody 16 0 26008 25M 18832 S 1.6 1.2 181:07 1 httpd
4164 nobody 15 0 11236 10M 6896 S 1.5 0.5 0:02 0 httpd
688 mysql 17 0 65400 63M 1564 S 1.3 3.1 2:52 3 mysqld
3655 nobody 15 0 12916 12M 8376 S 1.3 0.6 0:06 3 httpd
5830 nobody 16 0 25324 24M 18988 S 1.1 1.2 185:37 2 httpd
4419 nobody 20 0 8588 8588 5312 R 1.0 0.4 0:00 1 httpd
4420 nobody 19 0 8592 8592 5312 S 0.9 0.4 0:00 2 httpd
984 nobody 15 0 17904 17M 9744 S 0.8 0.8 0:39 2 httpd
2375 nobody 15 0 13996 13M 9360 S 0.7 0.6 0:26 2 httpd
22198 root 16 0 1984 1984 896 R 0.5 0.0 8:24 1 top
3240 nobody 15 0 13668 13M 9060 S 0.5 0.6 0:12 0 httpd
4417 nobody 20 0 8280 8280 5112 S 0.4 0.4 0:00 1 httpd
4418 nobody 20 0 8272 8272 5136 S 0.4 0.4 0:00 0 httpd
372 mysql 15 0 65400 63M 1564 S 0.2 3.1 3:47 1 mysqld
4416 nobody 19 0 5760 5760 4040 S 0.2 0.2 0:00 2 httpd
1880 mysql 15 0 65400 63M 1564 S 0.1 3.1 1:56 3 mysqld
1 root 15 0 508 508 452 S 0.0 0.0 0:30 0 init
2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1
4 root RT 0 0 0 0 SW 0.0 0.0 0:00 2 migration/2
5 root RT 0 0 0 0 SW 0.0 0.0 0:00 3 migration/3
6 root 15 0 0 0 0 SW 0.0 0.0 0:00 3 keventd
7 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
8 root 34 19 0 0 0 SWN 0.0 0.0 0:00 1 ksoftirqd/1
9 root 34 19 0 0 0 SWN 0.0 0.0 0:00 2 ksoftirqd/2
10 root 34 19 0 0 0 SWN 0.0 0.0 0:00 3 ksoftirqd/3
11 root 15 0 0 0 0 SW 0.0 0.0 1:54 0 kswapd
12 root 15 0 0 0 0 SW 0.0 0.0 16:45 1 kscand
13 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 bdflush
14 root 15 0 0 0 0 SW 0.0 0.0 1:19 3 kupdated
15 root 25 0 0 0 0 SW 0.0 0.0 0:00 1 mdrecoveryd
24 root 25 0 0 0 0 SW 0.0 0.0 0:00 1 scsi_eh_1
27 root 15 0 0 0 0 SW 0.0 0.0 1:49 3 kjournald


6. my.cnf

# Example mysql config file for large systems.
#
# This is for large system with memory = 512M where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# One can in this file use all long options that the program supports.
# If you want to know which options a program support, run the program
# with --help option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 32M
max_allowed_packet = 16M
table_cache = 1024
sort_buffer_size = 1M
read_buffer_size = 1M
join_buffer_size = 1M
myisam_sort_buffer_size = 64M
thread_cache = 64
query_cache_size= 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 4
max_connections = 500
wait_timeout = 1800
connect_timeout = 10
max_connect_errors = 10
query_cache_limit = 1M
query_cache_type = 1
skip-innodb
# Added slow query logs
log_slow_queries = /var/log/slow-queries.log
long_query_time = 5
# log_long_format
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
#log-bin
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
#server-id = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin
# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 64M
#bdb_max_lock = 100000
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 256M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 64M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M
[mysqlhotcopy]
interactive-timeout


7. MySql extended-status:

+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 0 |
| Aborted_connects | 35 |
| Bytes_received | 74829325 |
| Bytes_sent | 1065687877 |
| Com_admin_commands | 0 |
| Com_alter_table | 0 |
| Com_analyze | 0 |
| Com_backup_table | 0 |
| Com_begin | 0 |
| Com_change_db | 20809 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_commit | 0 |
| Com_create_db | 1 |
| Com_create_function | 0 |
| Com_create_index | 1 |
| Com_create_table | 2 |
| Com_delete | 1765 |
| Com_delete_multi | 0 |
| Com_drop_db | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 0 |
| Com_flush | 3 |
| Com_grant | 8 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_insert | 7487 |
| Com_insert_select | 24 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 603 |
| Com_optimize | 0 |
| Com_purge | 0 |
| Com_rename_table | 0 |
| Com_repair | 0 |
| Com_replace | 2763 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 106225 |
| Com_set_option | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 1 |
| Com_show_create | 0 |
| Com_show_databases | 13 |
| Com_show_fields | 0 |
| Com_show_grants | 2 |
| Com_show_keys | 0 |
| Com_show_logs | 0 |
| Com_show_master_status | 0 |
| Com_show_new_master | 0 |
| Com_show_open_tables | 0 |
| Com_show_processlist | 21 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 13 |
| Com_show_innodb_status | 0 |
| Com_show_tables | 63 |
| Com_show_variables | 3 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 0 |
| Com_unlock_tables | 603 |
| Com_update | 60899 |
| Connections | 26401 |
| Created_tmp_disk_tables | 3218 |
| Created_tmp_tables | 7145 |
| Created_tmp_files | 2 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 11 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 4468 |
| Handler_read_first | 13358 |
| Handler_read_key | 8673709 |
| Handler_read_next | 7554210 |
| Handler_read_prev | 77207 |
| Handler_read_rnd | 5214636 |
| Handler_read_rnd_next | 2289039716 |
| Handler_rollback | 0 |
| Handler_update | 911600 |
| Handler_write | 975633 |
| Key_blocks_used | 23686 |
| Key_read_requests | 18999282 |
| Key_reads | 20487 |
| Key_write_requests | 50916 |
| Key_writes | 15490 |
| Max_used_connections | 70 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 566 |
| Open_files | 715 |
| Open_streams | 0 |
| Opened_tables | 587 |
| Questions | 368523 |
| Qcache_queries_in_cache | 4125 |
| Qcache_inserts | 103996 |
| Qcache_hits | 140843 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 2226 |
| Qcache_free_memory | 20301880 |
| Qcache_free_blocks | 1335 |
| Qcache_total_blocks | 9856 |
| Rpl_status | NULL |
| Select_full_join | 3119 |
| Select_full_range_join | 0 |
| Select_range | 14615 |
| Select_range_check | 0 |
| Select_scan | 36849 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 1327 |
| Sort_merge_passes | 1 |
| Sort_range | 12582 |
| Sort_rows | 16733287 |
| Sort_scan | 24262 |
| Table_locks_immediate | 290869 |
| Table_locks_waited | 6748 |
| Threads_cached | 62 |
| Threads_created | 71 |
| Threads_connected | 3 |
| Threads_running | 1 |
| Uptime | 6369 |
+--------------------------+------------+

8. Other scripts which utilise php and mysql? ReviewPost, PhotoPost, PHPMyadsnew, Cafescripts

9. how many average and max concurrent users? Avg 250, Max 600, Cookie Timeout: 900

10. phpinfo.php link: http://67.19.25.103/phpinfo.php

11. httpd.conf:

KeepAlive = On
MaxKeepAliveRequests = 100
KeepAliveTimeout = 15
MinSpareServers = 5
MaxSpareServers = 10
StartServers = 5
MaxClients = 250

12. what version of vB are you running ? 3.0.3 patched to 3.0.7

13. any files i.e. apache log files are hitting 2GB or 4GB max: None

eva2000
Wed 2nd Mar '05, 11:00am
i'd do the following

1. change /etc/my.cnf to below and restart mysql server


[client]
port = 3306
socket = /var/lib/mysql/mysql.sock

[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-innodb
max_connections = 650
key_buffer = 16M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1024
thread_cache_size = 64
wait_timeout = 10800
connect_timeout = 10
tmp_table_size = 32M
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 2M
query_cache_size = 64M
query_cache_type = 1

[mysqld_safe]
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M


2. If you have load issues, turn off all non-vB scripts ReviewPost, PhotoPost, PHPMyadsnew, Cafescripts and run vB by itself for 7 days, check cpu loads ? are they better or worse ? then try turning on each script concurrently with vB running, take note when cpu loads start spiking again.

DTC
Wed 2nd Mar '05, 11:17am
Gotcha and will do, thanks George!!