PDA

View Full Version : Please optimize my server (dual 2.4 - 3 Gb Ram)


hichew
Wed 16th Nov '05, 3:43am
1. Dedicated box
2.

cpu speed/type single or dual cpus): dual Xeon 2.8
how much memory installed: 3 Gb - DDR PC2100 CL2.5 ECC
hard drive type/configuration: Fujitsu \ 73GB:SCSI:Ultra320
linux distributor or windows version: RedHat Enterprise 3 i686 - WHM X v3.1.0
apache/IIS version: apache 1.3.33
PHP version: php 4.3.11
MySQL version: mysql 3.23.49

3. dont know
4. dont know
5.

01:42:46 up 11 days, 4:02, 1 user, load average: 3.47, 5.16, 4.07
519 processes: 514 sleeping, 5 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 34.0% 5.5% 4.7% 0.2% 2.5% 7.7% 44.9%
cpu00 26.9% 9.4% 5.5% 0.7% 9.8% 9.8% 37.5%
cpu01 35.3% 7.8% 5.5% 0.0% 0.1% 9.4% 41.6%
cpu02 38.8% 2.5% 3.5% 0.1% 0.0% 5.7% 49.1%
cpu03 35.1% 2.3% 4.5% 0.0% 0.1% 6.1% 51.6%
Mem: 3082360k av, 3060540k used, 21820k free, 0k shrd, 167492k buff
2230068k actv, 424576k in_d, 46932k in_c
Swap: 2096440k av, 400392k used, 1696048k free 873376k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
26901 mysql 21 6 364M 196M 1316 S N 3.3 6.5 0:01 1 mysqld
27365 mysql 22 6 364M 196M 1316 S N 1.3 6.5 0:00 0 mysqld
26396 nobody 16 0 10992 10M 2864 S 1.2 0.3 0:06 1 httpd
26482 nobody 16 0 10052 9.8M 2872 S 1.2 0.3 0:07 1 httpd
26377 nobody 15 0 10268 10M 3068 S 1.1 0.3 0:02 3 httpd
26532 nobody 16 0 11200 10M 3068 S 1.1 0.3 0:04 1 httpd
26930 nobody 15 0 9604 9604 2864 S 1.1 0.3 0:05 0 httpd
26435 nobody 16 0 13140 12M 2908 S 1.0 0.4 0:06 1 httpd
26506 nobody 16 0 10768 10M 2908 S 1.0 0.3 0:05 0 httpd
26516 nobody 15 0 10112 9.9M 3008 S 1.0 0.3 0:05 1 httpd
26527 nobody 15 0 12720 12M 2868 S 1.0 0.4 0:05 2 httpd
26538 nobody 16 0 13124 12M 2920 S 1.0 0.4 0:08 2 httpd
26563 nobody 16 0 10156 9.9M 2864 S 1.0 0.3 0:05 3 httpd
26643 nobody 15 0 9716 9716 2864 S 1.0 0.3 0:07 3 httpd
26696 nobody 16 0 11064 10M 2864 S 1.0 0.3 0:08 1 httpd
26702 nobody 15 0 9596 9596 2912 S 1.0 0.3 0:06 3 httpd
26446 nobody 15 0 10144 9.9M 2916 S 0.9 0.3 0:05 0 httpd
26647 nobody 15 0 10968 10M 2912 S 0.9 0.3 0:05 3 httpd
26682 nobody 15 0 10348 10M 3068 S 0.9 0.3 0:06 2 httpd
26382 nobody 16 0 13476 13M 2920 S 0.8 0.4 0:08 0 httpd
26425 nobody 16 0 9924 9924 2860 S 0.8 0.3 0:08 3 httpd
26591 nobody 16 0 11004 10M 2956 S 0.8 0.3 0:05 2 httpd
26670 nobody 16 0 10940 10M 2908 S 0.8 0.3 0:05 0 httpd
26704 nobody 15 0 10904 10M 2920 S 0.8 0.3 0:04 3 httpd
26388 nobody 15 0 10856 10M 2864 S 0.7 0.3 0:03 0 httpd
26437 nobody 16 0 12900 12M 2920 S 0.7 0.4 0:07 1 httpd
26443 nobody 15 0 9952 9952 2880 S 0.7 0.3 0:05 1 httpd
26559 nobody 15 0 10172 9.9M 2864 S 0.7 0.3 0:06 1 httpd
26572 nobody 15 0 11160 10M 3024 S 0.7 0.3 0:06 2 httpd
26614 nobody 16 0 12904 12M 2864 S 0.7 0.4 0:06 2 httpd



6.

back_log 50
basedir /
binlog_cache_size 32768
bulk_insert_buffer_size 8388608
character_set latin1
character_sets latin1 big5 czech euc_kr gb2312 gbk latin1_de sjis tis620 ujis 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/lib/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 NO
have_crypt YES
have_innodb YES
have_isam YES
have_raid NO
have_symlink YES
have_openssl NO
have_query_cache YES
init_file
innodb_additional_mem_pool_size 1048576
innodb_autoextend_increment 8
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
innodb_max_purge_lag 0
innodb_table_locks ON
interactive_timeout 28800
join_buffer_size 131072
key_buffer_size 268435456
language /usr/share/mysql/english/
large_files_support ON
license GPL
local_infile ON
locked_in_memory OFF
log OFF
log_update OFF
log_bin OFF
log_slave_updates OFF
log_slow_queries OFF
log_warnings 1
long_query_time 10
low_priority_updates OFF
lower_case_file_system OFF
lower_case_table_names 0
max_allowed_packet 1047552
max_binlog_cache_size 4294967295
max_binlog_size 1073741824
max_connections 700
max_connect_errors 10
max_delayed_threads 20
max_insert_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 67108864
net_buffer_length 16384
net_read_timeout 30
net_retry_count 10
net_write_timeout 60
new OFF
open_files_limit 3510
pid_file /var/lib/mysql/prophetic.indoguides.com.pid
log_error
port 3306
protocol_version 10
query_alloc_block_size 8192
query_cache_limit 1048576
query_cache_size 16777216
query_cache_type ON
query_cache_wlock_invalidate OFF
query_prealloc_size 8192
range_alloc_block_size 2048
read_buffer_size 1044480
read_only OFF
read_rnd_buffer_size 262144
rpl_recovery_rank 0
server_id 1
slave_net_timeout 3600
skip_external_locking ON
skip_networking OFF
skip_show_database OFF
slow_launch_time 2
socket /var/lib/mysql/mysql.sock
sort_buffer_size 1048568
sql_mode 0
table_cache 256
table_type MYISAM
thread_cache_size 8
thread_stack 126976
tx_isolation REPEATABLE-READ
timezone CST
tmp_table_size 33554432
tmpdir /tmp/
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
version 4.0.25-standard
version_comment Official MySQL RPM
version_compile_os pc-linux-gnu
wait_timeout 28800
7.

Aborted_clients 19886
Aborted_connects 15
Bytes_received 2911687069
Bytes_sent 2450717280
Com_admin_commands 2
Com_alter_table 6
Com_analyze 0
Com_backup_table 0
Com_begin 0
Com_change_db 6745687
Com_change_master 0
Com_check 0
Com_commit 0
Com_create_db 1
Com_create_function 0
Com_create_index 0
Com_create_table 2
Com_delete 835643
Com_delete_multi 0
Com_drop_db 0
Com_drop_function 0
Com_drop_index 0
Com_drop_table 0
Com_flush 17
Com_grant 16
Com_ha_close 0
Com_ha_open 0
Com_ha_read 0
Com_insert 4329122
Com_insert_select 31388
Com_kill 0
Com_load 0
Com_load_master_data 0
Com_load_master_table 0
Com_lock_tables 53464
Com_optimize 1
Com_purge 0
Com_rename_table 0
Com_repair 0
Com_replace 289237
Com_replace_select 0
Com_reset 0
Com_restore_table 0
Com_revoke 0
Com_rollback 0
Com_savepoint 0
Com_select 33779425
Com_set_option 5619
Com_show_binlog_events 0
Com_show_binlogs 9
Com_show_create 157
Com_show_databases 69
Com_show_fields 157
Com_show_grants 29
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 3215
Com_show_slave_hosts 0
Com_show_slave_status 0
Com_show_status 2
Com_show_innodb_status 0
Com_show_tables 257
Com_show_variables 152
Com_slave_start 0
Com_slave_stop 0
Com_truncate 16
Com_unlock_tables 53464
Com_update 11119559
Com_update_multi 973
Connections 6755617
Created_tmp_disk_tables 17572
Created_tmp_tables 137766
Created_tmp_files 443
Delayed_insert_threads 0
Delayed_writes 0
Delayed_errors 0
Flush_commands 1
Handler_commit 0
Handler_delete 987025
Handler_read_first 8803481
Handler_read_key 1194266213
Handler_read_next 1320857018
Handler_read_prev 131461494
Handler_read_rnd 2228652273
Handler_read_rnd_next 3932634556
Handler_rollback 0
Handler_update 12004243
Handler_write 9555720
Key_blocks_used 249380
Key_read_requests 4066832752
Key_reads 1759469
Key_write_requests 8799541
Key_writes 7444033
Max_used_connections 273
Not_flushed_key_blocks 0
Not_flushed_delayed_rows 0
Open_tables 256
Open_files 286
Open_streams 0
Opened_tables 119799
Questions 94977759
Qcache_queries_in_cache 3667
Qcache_inserts 33277700
Qcache_hits 30984891
Qcache_lowmem_prunes 481492
Qcache_not_cached 500294
Qcache_free_memory 7984512
Qcache_free_blocks 2281
Qcache_total_blocks 9928
Rpl_status NULL
Select_full_join 474
Select_full_range_join 44
Select_range 9979865
Select_range_check 0
Select_scan 3028602
Slave_open_temp_tables 0
Slave_running OFF
Slow_launch_threads 1
Slow_queries 205
Sort_merge_passes 220
Sort_range 9695038
Sort_rows 2255761557
Sort_scan 105250
Table_locks_immediate 97949990
Table_locks_waited 2516570
Threads_cached 2
Threads_created 678055
Threads_connected 136
Threads_running 2
Uptime 960755

8. Yes, the only thing. And the database is in the 2nd hardrive dedicated only for database.
9. probably 500-1000 concurrent users ( with cookie timeout 1500 )
10. 66.19.27.105/php.php
11.

KeepAlive Off
MaxKeepAliveRequests 300
KeepAliveTimeout 5
MinSpareServers 15
MaxSpareServers 25
StartServers 30
MaxClients 250

AND Maxrequestsperchild value = 1000

12. 3.5.1
13.

find: /proc/26456/fd/500: No such file or directory
find: /proc/26630/fd/251: No such file or directory
find: /proc/26953/fd/251: No such file or directory
find: /proc/27301/fd/4: No such file or directory


how many average and max concurrent users on your vB forum ? and what your cookie timeout is ?

eva2000
Wed 16th Nov '05, 7:58am
you're actually using mysql 4.0.25 :)

try the following

1. Upgrade PHP to 4.4.0 ensuring you compile PHP --with-mysql=/path/to/mysql for WHM/Cpanel you can use easyapache in WHM to set to use system MySQL
2. Edit /etc/my.cnf and place the following mysql server settings in /etc/my.cnf and restart mysql server afterwards


[mysqld]
safe-show-database
skip-innodb
max_connections = 650
key_buffer = 64M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1800
thread_cache_size = 384
wait_timeout = 180
connect_timeout = 10
tmp_table_size = 256M
max_allowed_packet = 64M
max_connect_errors = 10
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M
thread_concurrency = 4
query_cache_limit = 2M
query_cache_size = 256M
query_cache_type = 1
query_prealloc_size = 16384
query_alloc_block_size = 16384

[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


3. Install APC Cache lastest version from http://pecl.php.net/package/APC

hichew
Wed 16th Nov '05, 3:26pm
when i tried to restart the mysql i got this error.
what's that ?

root 1736 0.0 0.0 5328 4 ? S Nov04 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/propere.something.com.pid
mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.").

hichew
Thu 17th Nov '05, 12:06am
what's APC ? should I install this ?

eva2000
Fri 18th Nov '05, 2:16am
add under [mysqld] group for my.cnf

socket = /var/lib/mysql/mysql.sock

and restart mysql server

APC is a php caching app like turck mmcache and eaccelerator or zend cache which helps lower server cpu loads due to some forms of caching of php

can drop server loads dramatically on most servers which use alot of PHP :)

hichew
Fri 18th Nov '05, 2:27am
hi eva, i got this error msg when installing APC.

Sorry, I was not able to successfully run APXS. Possible reasons:

1. Perl is not installed;
2. Apache was not compiled with DSO support (--enable-module=so);
3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs
The output of apxs follows
./configure: line 2849: apxs: command not found
configure: error: Aborting


do you know what's wrong with that ?

eva2000
Fri 18th Nov '05, 2:38am
you need to specify the correct and full path to --with-apxs=/path/to/apxs when running configure

hichew
Fri 18th Nov '05, 2:40am
GReat !! it's working now...

i had 3070 users online right now.. and hopefully this APC help the server