PDA

View Full Version : Server Optimisation: Request


13th_Disciple
Tue 13th Jun '06, 1:46pm
1. Is this on dedicated or shared virual server. If shared, how many sites share this server (ask web host if needed)
dedicated
2. your server specs.

cpu speed/type single or dual cpus): single Celeron 2.4ghz
how much memory installed: 512mb ram
hard drive type/configuration: 80GB EIDE non raid
linux distributor or windows version: FreeBSD 4.8
apache/IIS version: apache 1.3.31
PHP version: php 4.3.3
MySQL version: mysql 4.0.18

3. if you use mysql 4.x instead of mysql 3.23.x, do you have any innodb type databases/tables on your server ?
Unknown, but don't think so.
4. if possible how mysql was compiled/installed
cpanel install
5. your top stats
last pid: 19665; load averages: 0.19, 0.11, 0.09 up 20+15:00:37 11:09:11
41 processes: 2 running, 39 sleeping
CPU states: 7.7% user, 0.0% nice, 1.2% system, 0.6% interrupt, 90.5% idle
Mem: 110M Active, 119M Inact, 238M Wired, 16M Cache, 60M Buf, 7876K Free
Swap: 992M Total, 70M Used, 923M Free, 7% Inuse
6. your mysql configuration variables located at /etc/my.cnf or c:\my.cnf or my.ini so post the contents inside of my.cnf (minus any passwords of course).
guam# cat /etc/my.cnf
[mysqld]
set-variable = max_connections=500
safe-show-database

7. MySQL stats from ssh telnet as root user type:
+---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| back_log | 50 |
| basedir | /usr/local/ |
| bdb_cache_size | 8388600 |
| bdb_log_buffer_size | 32768 |
| bdb_home | /var/db/mysql/ |
| bdb_max_lock | 10000 |
| bdb_logdir | |
| bdb_shared_data | OFF |
| bdb_tmpdir | /var/tmp/ |
| bdb_version | Sleepycat Software: Berkeley DB 3.2.9a: (February 10, 2004) |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set | latin1 |
| character_sets | latin1 dec8 dos german1 hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew win1251 estonia hungarian koi8_ukr win1251ukr greek win1250 croat cp1257 latin5 |
| concurrent_insert | ON |
| connect_timeout | 5 |
| convert_character_set | |
| datadir | /var/db/mysql/ |
| default_week_format | 0 |
| delay_key_write | ON |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| flush | OFF |
| flush_time | 0 |
| ft_boolean_syntax | + -><()~*:""&| |
| ft_min_word_len | 4 |
| ft_max_word_len | 254 |
| ft_max_word_len_for_sort | 20 |
| ft_stopword_file | (built-in) |
| have_bdb | YES |
| have_crypt | YES |
| have_innodb | YES |
| have_isam | YES |
| have_raid | NO |
| have_symlink | NO |
| have_openssl | NO |
| have_query_cache | YES |
| init_file | |
| innodb_additional_mem_pool_size | 1048576 |
| innodb_buffer_pool_size | 8388608 |
| innodb_data_file_path | ibdata1:10M:autoextend |
| innodb_data_home_dir | |
| innodb_file_io_threads | 4 |
| innodb_force_recovery | 0 |
| innodb_thread_concurrency | 8 |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_fast_shutdown | ON |
| innodb_flush_method | |
| innodb_lock_wait_timeout | 50 |
| innodb_log_arch_dir | ./ |
| innodb_log_archive | OFF |
| innodb_log_buffer_size | 1048576 |
| innodb_log_file_size | 5242880 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | ./ |
| innodb_mirrored_log_groups | 1 |
| innodb_max_dirty_pages_pct | 90 |
| interactive_timeout | 28800 |
| join_buffer_size | 131072 |
| key_buffer_size | 8388600 |
| language | /usr/local/share/mysql/english/ |
| large_files_support | ON |
| local_infile | ON |
| log | OFF |
| log_update | OFF |
| log_bin | OFF |
| log_slave_updates | OFF |
| log_slow_queries | OFF |
| log_warnings | OFF |
| long_query_time | 10 |
| low_priority_updates | OFF |
| lower_case_table_names | 0 |
| max_allowed_packet | 1048576 |
| max_binlog_cache_size | 4294967295 |
| max_binlog_size | 1073741824 |
| max_connections | 500 |
| max_connect_errors | 10 |
| max_delayed_threads | 20 |
| max_heap_table_size | 16777216 |
| max_join_size | 4294967295 |
| max_relay_log_size | 0 |
| max_seeks_for_key | 4294967295 |
| max_sort_length | 1024 |
| max_user_connections | 0 |
| max_tmp_tables | 32 |
| max_write_lock_count | 4294967295 |
| myisam_max_extra_sort_file_size | 268435456 |
| myisam_max_sort_file_size | 2147483647 |
| myisam_repair_threads | 1 |
| myisam_recover_options | OFF |
| myisam_sort_buffer_size | 8388608 |
| net_buffer_length | 16384 |
| net_read_timeout | 30 |
| net_retry_count | 1000000 |
| net_write_timeout | 60 |
| new | OFF |
| open_files_limit | 7207 |
| pid_file | /var/db/mysql/guam.pid |
| log_error | |
| port | 3306 |
| protocol_version | 10 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_size | 0 |
| query_cache_type | ON |
| query_prealloc_size | 8192 |
| range_alloc_block_size | 2048 |
| read_buffer_size | 131072 |
| read_only | OFF |
| read_rnd_buffer_size | 262144 |
| rpl_recovery_rank | 0 |
| server_id | 0 |
| slave_net_timeout | 3600 |
| skip_external_locking | ON |
| skip_networking | OFF |
| skip_show_database | OFF |
| slow_launch_time | 2 |
| socket | /tmp/mysql.sock |
| sort_buffer_size | 2097144 |
| sql_mode | 0 |
| table_cache | 64 |
| table_type | MYISAM |
| thread_cache_size | 0 |
| thread_stack | 196608 |
| tx_isolation | REPEATABLE-READ |
| timezone | CDT |
| tmp_table_size | 33554432 |
| tmpdir | /var/tmp/ |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| version | 4.0.18 |
| version_comment | FreeBSD port: mysql-server-4.0.18_1 |
| wait_timeout | 28800 |
+---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 2 |
| Aborted_connects | 200 |
| Bytes_received | 1493392323 |
| Bytes_sent | 1980368244 |
| Com_admin_commands | 0 |
| Com_alter_table | 9 |
| Com_analyze | 0 |
| Com_backup_table | 0 |
| Com_begin | 0 |
| Com_change_db | 1812660 |
| Com_change_master | 0 |
| Com_check | 3335 |
| Com_commit | 0 |
| Com_create_db | 1 |
| Com_create_function | 0 |
| Com_create_index | 7 |
| Com_create_table | 13 |
| Com_delete | 263009 |
| Com_delete_multi | 0 |
| Com_drop_db | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 1 |
| Com_flush | 3 |
| Com_grant | 8 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_insert | 115736 |
| Com_insert_select | 3197 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 8284 |
| Com_optimize | 1579 |
| Com_purge | 0 |
| Com_rename_table | 0 |
| Com_repair | 91 |
| Com_replace | 18362 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 3934809 |
| Com_set_option | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_create | 0 |
| Com_show_databases | 6 |
| Com_show_fields | 0 |
| Com_show_grants | 1 |
| 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 | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 4 |
| Com_show_innodb_status | 0 |
| Com_show_tables | 72 |
| Com_show_variables | 2 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 0 |
| Com_unlock_tables | 6557 |
| Com_update | 1037474 |
| Connections | 818498 |
| Created_tmp_disk_tables | 2829 |
| Created_tmp_tables | 220435 |
| Created_tmp_files | 4 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 123171 |
| Handler_read_first | 711295 |
| Handler_read_key | 366643591 |
| Handler_read_next | 77400660 |
| Handler_read_prev | 2508777 |
| Handler_read_rnd | 19832426 |
| Handler_read_rnd_next | 511254701 |
| Handler_rollback | 0 |
| Handler_update | 4083666 |
| Handler_write | 5840841 |
| Key_blocks_used | 7793 |
| Key_read_requests | 760300083 |
| Key_reads | 364124 |
| Key_write_requests | 4121364 |
| Key_writes | 1236711 |
| Max_used_connections | 14 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 64 |
| Open_files | 113 |
| Open_streams | 0 |
| Opened_tables | 20937 |
| Questions | 8023512 |
| Qcache_queries_in_cache | 0 |
| Qcache_inserts | 0 |
| Qcache_hits | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_free_memory | 0 |
| Qcache_free_blocks | 0 |
| Qcache_total_blocks | 0 |
| Rpl_status | NULL |
| Select_full_join | 2610 |
| Select_full_range_join | 18829 |
| Select_range | 1421111 |
| Select_range_check | 0 |
| Select_scan | 913299 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 6 |
| Sort_merge_passes | 0 |
| Sort_range | 332220 |
| Sort_rows | 24186570 |
| Sort_scan | 445924 |
| Table_locks_immediate | 7897402 |
| Table_locks_waited | 2675 |
| Threads_cached | 0 |
| Threads_created | 818497 |
| Threads_connected | 2 |
| Threads_running | 1 |
| Uptime | 1781499 |
+--------------------------+------------+
Uptime: 1781500 Threads: 2 Questions: 8023513 Slow queries: 6 Opens: 20937 Flush tables: 1 Open tables: 64 Queries per second avg: 4.504
mysqladmin Ver 8.40 Distrib 4.0.18, for portbld-freebsd4.8 on i386
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 4.0.18
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 20 days 14 hours 51 min 40 sec

Threads: 2 Questions: 8023513 Slow queries: 6 Opens: 20937 Flush tables: 1 Open tables: 64 Queries per second avg: 4.504

8. is your vB the only thing on the server? or other scripts & sites which utilise php and mysql?
vB, PhotoPost, FlashChat
9. how many average and max concurrent users on your vB forum ? and what your cookie timeout is ?
average ~15
max ~35
cookie timeout is default 900 seconds
10. create a file named phpinfo.php and place this code in it and post the url/link to it from your web site

http://www.dbcenter.org/php.php
11. if you run Apache and you have your own dedicated server or access to your httpd.conf (apache configuration file) can you post the values you have set for the following :

KeepAlive - On
MaxKeepAliveRequests - 100
KeepAliveTimeout - 15
MinSpareServers - 5
MaxSpareServers - 15
StartServers - 5
MaxClients - 250
Maxrequestsperchild - 0
12. what version of vB are you running ?
3.0.0
13. check to see if any files i.e. apache log files are hitting 2GB or 4GB max file size limits i.e. see if you have max file size exceeded messages in apache error log
None
14. Post output from these 3 commands

uname -a
FreeBSD guam.seekersofpunani.com 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Sat Mar 6 10:11:41 CST 2004 root@guam.seekersofpunani.com:/usr/src/sys/compile/GUAM i386
ulimit -aH
cpu time (seconds, -t) unlimited
file size (512-blocks, -f) unlimited
data seg size (kbytes, -d) 524288
stack size (kbytes, -s) 65536
core file size (512-blocks, -c) unlimited
max memory size (kbytes, -m) unlimited
locked memory (kbytes, -l) unlimited
max user processes (-u) 3603
open files (-n) 7207
virtual mem size (kbytes, -v) unlimited
sbsize (bytes, -b) unlimited
cat /proc/cpuinfo
no such file

eva2000
Wed 14th Jun '06, 12:44pm
1. Upgrade MySQL server to 4.0.27 first via WHM control panel
2. Upgrade PHP to 4.4.2 and upgrade apache to 1.3.36 via WHM control panel
3. Edit /etc/my.cnf and place the following mysql server settings in /etc/my.cnf and restart mysql server afterwards


[mysqld]
safe-show-database
back_log = 50
skip-innodb
max_connections = 400
key_buffer = 16M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1500
thread_cache_size = 192
wait_timeout = 30
connect_timeout = 10
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 32M
max_connect_errors = 10
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M
query_cache_limit = 2M
query_cache_size = 32M
query_cache_type = 1
query_prealloc_size = 163840
query_alloc_block_size = 32768

[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

[mysqlhotcopy]
interactive-timeout


4. Install APC Cache lastest version from http://pecl.php.net/package/APC. Read install guide at http://www.vbulletin.com/forum/showthread.php?t=165367 - please remove Zend Optimizer from php.ini before installing APC Cache

5. Upgrade to vB 3.0.14 http://www.vbulletin.com/forum/showthread.php?t=183331

6. Edit httpd.conf values from

KeepAlive - On
MaxKeepAliveRequests - 100
KeepAliveTimeout - 15
MinSpareServers - 5
MaxSpareServers - 15
StartServers - 5
MaxClients - 250
Maxrequestsperchild - 0

to

KeepAlive - On
MaxKeepAliveRequests - 100
KeepAliveTimeout - 6
MinSpareServers - 5
MaxSpareServers - 15
StartServers - 5
MaxClients - 150
Maxrequestsperchild - 1000

restart apache

13th_Disciple
Thu 15th Jun '06, 12:51am
I also have the issue of mysql being on my /var slice which is damn near full. I have 60 gb free on the /usr slice. Can I move the database to /usr in a relatively simple manner?

eva2000
Thu 15th Jun '06, 11:24am
If existing data is at /var/lib/mysql and you want to move to /usr/mysqldata then in my.cnf above under [mysqld] group add the following

[mysqld]
datadir = /usr/mysqldata
safe-show-database
back_log = 50
skip-innodb
max_connections = 400
key_buffer = 16M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1500
thread_cache_size = 192
wait_timeout = 30
connect_timeout = 10
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 32M
max_connect_errors = 10
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M
query_cache_limit = 2M
query_cache_size = 32M
query_cache_type = 1
query_prealloc_size = 163840
query_alloc_block_size = 32768

[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

[mysqlhotcopy]
interactive-timeout

shut down mysql server, then copy and paste the output for

ls -alh /var/lib/mysql
ls -alh /var/lib/mysql/databasename

it should like the output in section 2, C at http://www.vbulletin.com/forum/showthread.php?t=69803

This is to remember the user/group ownership and file permissions of your database directory and files.

Now with mysql server still shut down, copy all the /var/lib/mysql directories and files to /usr/mysqldata

cp -R /var/lib/mysql/* /usr/mysqldata

Then you need to set the permiisons for files and user/group ownership for all files in /usr/mysqldata. You can follow section 2, D example at http://www.vbulletin.com/forum/showthread.php?t=69803 to do this

Once all set, you can restart mysql server and it should pick up the datadir being /usr/mysqldata.

Before deleting /var/lib/mysql data confirm it's working by, stopping mysql server again, and rename the /var/lib/mysql directory to say /var/lib/mysqlOLD

Then restart mysql server to see if it picks up /usr/mysqldata

HTH

13th_Disciple
Thu 15th Jun '06, 1:13pm
Thank you very much for all of your help!

eva2000
Sat 17th Jun '06, 2:04am
You're welcome :)