PDA

View Full Version : Help me optimize


svtsnake01
Wed 16th Nov '05, 9:21pm
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. For example:

cpu speed/type single or dual cpus): dual AMD Athlon MP
how much memory installed: 2gb ram
hard drive type/configuration: 2 (80 gb) EIDE non raid

linux distributor or windows version: redhat enterprise ES / Cpanel WHM 10.6.0 cPanel 10.6.0-R55 (https://modularfords.com:2087/scripts2/upcpform)
RedHat Enterprise 3 i686 - WHM X v3.1.0
apache/IIS version: apache 1.3.33
PHP version: php 4.3.11-dev
MySQL version: mysql Ver 12.22 Distrib 4.0.25, for pc-linux-gnu (i686)

3. if you use mysql 4.x instead of mysql 3.23.x, do you have any innodb type databases/tables on your server ? not sure

4. if possible how mysql was compiled/installed? not sure

5. your top stats

18:33:33 up 21 days, 6:52, 1 user, load average: 0.69, 0.55, 0.51
133 processes: 115 sleeping, 3 running, 15 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 20.6% 0.0% 5.7% 0.3% 0.1% 0.1% 73.2%
cpu00 24.0% 0.0% 5.4% 0.6% 0.2% 0.0% 69.8%
cpu01 17.2% 0.0% 6.0% 0.0% 0.0% 0.2% 76.6%
Mem: 2057224k av, 1992792k used, 64432k free, 0k shrd, 132716k buff
1525672k actv, 307296k in_d, 29520k in_c
Swap: 1052248k av, 131068k used, 921180k free 1626760k cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
20276 nobody 24 0 11300 10M 2308 R 2.1 0.5 0:00 1 httpd
20262 nobody 24 0 12024 11M 2312 S 1.9 0.5 0:00 1 httpd
2902 mysql 16 0 62224 59M 1408 S 1.3 2.9 16:59 0 mysqld
20251 nobody 24 0 0 0 0 Z 1.0 0.0 0:00 0 httpd <defunct>
20275 nobody 24 0 9724 9564 2276 R 1.0 0.4 0:00 0 httpd
20258 nobody 24 0 0 0 0 Z 0.9 0.0 0:00 1 httpd <defunct>
20274 nobody 24 0 9264 9104 2280 S 0.9 0.4 0:00 0 httpd
20279 nobody 24 0 9268 9108 2280 S 0.8 0.4 0:00 0 httpd
1068 mysql 16 0 62224 59M 1408 S 0.2 2.9 24:52 0 mysqld
869 root 23 0 4220 4012 2040 S 0.1 0.1 31:54 0 httpd
1438 mysql 15 0 62224 59M 1408 S 0.1 2.9 23:51 1 mysqld
1 root 15 0 488 460 428 S 0.0 0.0 0:28 1 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 15 0 0 0 0 SW 0.0 0.0 0:01 1 keventd
5 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
6 root 34 19 0 0 0 SWN 0.0 0.0 0:00 1 ksoftirqd/1
9 root 15 0 0 0 0 SW 0.0 0.0 0:00 1 bdflush
7 root 15 0 0 0 0 SW 0.0 0.0 2:32 1 kswapd
8 root 15 0 0 0 0 SW 0.0 0.0 1:09 1 kscand
10 root 15 0 0 0 0 SW 0.0 0.0 1:08 1 kupdated
11 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 mdrecoveryd
15 root 15 0 0 0 0 SW 0.0 0.0 10:13 1 kjournald
335 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
636 root 15 0 572 564 488 S 0.0 0.0 0:21 0 syslogd
640 root 15 0 440 380 376 S 0.0 0.0 0:00 1 klogd
650 root 15 0 456 448 392 S 0.0 0.0 1:17 1 irqbalance
660 root 15 0 396 380 340 S 0.0 0.0 0:04 0 mdadm
684 nobody 15 0 1180 744 624 S 0.0 0.0 0:13 0 proftpd

6. your mysql configuration variables located at /etc/my.cnf or c:\my.cnf so post the contents inside of my.cnf (minus any passwords of course). If on Windows server if you don't have that file you need to log into telnet and as root user type .

+---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 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 | 10 |
| 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 | DISABLED |
| 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 | |
| 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 | 1044480 |
| key_buffer_size | 16777216 |
| 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 | 16776192 |
| max_binlog_cache_size | 4294967295 |
| max_binlog_size | 1073741824 |
| max_connections | 500 |
| 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 | 2558 |
| pid_file | /var/lib/mysql/server1.modularfords.com.pid |
| log_error | |
| port | 3306 |
| protocol_version | 10 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_size | 33554432 |
| 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 | 0 |
| 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 | 2097144 |
| sql_mode | 0 |
| table_cache | 1024 |
| table_type | MYISAM |
| thread_cache_size | 64 |
| thread_stack | 126976 |
| tx_isolation | REPEATABLE-READ |
| timezone | CDT |
| 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 | 1800 |
+---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

7. your mysql extended-status output which shows entire server's mysql activity status (preferably with a day or 2 worth of mysql uptime for better indication of real activity)

+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 136 |
| Aborted_connects | 236 |
| Bytes_received | 1074087382 |
| Bytes_sent | 1166321131 |
| Com_admin_commands | 0 |
| Com_alter_table | 190 |
| Com_analyze | 0 |
| Com_backup_table | 0 |
| Com_begin | 0 |
| Com_change_db | 6352900 |
| Com_change_master | 0 |
| Com_check | 283 |
| Com_commit | 0 |
| Com_create_db | 6 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_table | 96 |
| Com_delete | 227607 |
| Com_delete_multi | 0 |
| Com_drop_db | 4 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 96 |
| Com_flush | 188 |
| Com_grant | 68 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_insert | 1183950 |
| Com_insert_select | 3714 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 62768 |
| Com_optimize | 283 |
| Com_purge | 0 |
| Com_rename_table | 0 |
| Com_repair | 0 |
| Com_replace | 301364 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 10868923 |
| Com_set_option | 7554 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 11 |
| Com_show_create | 0 |
| Com_show_databases | 153 |
| Com_show_fields | 0 |
| Com_show_grants | 43 |
| 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 | 6136 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 2 |
| Com_show_innodb_status | 0 |
| Com_show_tables | 220 |
| Com_show_variables | 78 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 1 |
| Com_unlock_tables | 62768 |
| Com_update | 4012397 |
| Com_update_multi | 958 |
| Connections | 5604328 |
| Created_tmp_disk_tables | 15476 |
| Created_tmp_tables | 310132 |
| Created_tmp_files | 1 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 620272 |
| Handler_read_first | 1702143 |
| Handler_read_key | 280204709 |
| Handler_read_next | 2625629574 |
| Handler_read_prev | 10502949 |
| Handler_read_rnd | 149427012 |
| Handler_read_rnd_next | 2990444755 |
| Handler_rollback | 0 |
| Handler_update | 5490233 |
| Handler_write | 109814950 |
| Key_blocks_used | 15586 |
| Key_read_requests | 1039661406 |
| Key_reads | 1982910 |
| Key_write_requests | 4240885 |
| Key_writes | 2427906 |
| Max_used_connections | 39 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 556 |
| Open_files | 943 |
| Open_streams | 0 |
| Opened_tables | 2215 |
| Questions | 42539983 |
| Qcache_queries_in_cache | 5002 |
| Qcache_inserts | 10712783 |
| Qcache_hits | 13841008 |
| Qcache_lowmem_prunes | 138529 |
| Qcache_not_cached | 156113 |
| Qcache_free_memory | 12102688 |
| Qcache_free_blocks | 1918 |
| Qcache_total_blocks | 12688 |
| Rpl_status | NULL |
| Select_full_join | 765 |
| Select_full_range_join | 0 |
| Select_range | 3218368 |
| Select_range_check | 0 |
| Select_scan | 1981273 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 35 |
| Sort_merge_passes | 0 |
| Sort_range | 1934991 |
| Sort_rows | 1858695758 |
| Sort_scan | 591391 |
| Table_locks_immediate | 28833989 |
| Table_locks_waited | 31983 |
| Threads_cached | 38 |
| Threads_created | 40 |
| Threads_connected | 2 |
| Threads_running | 1 |
| Uptime | 1841022 |
+--------------------------+------------+


8. is your vB the only thing on the server? or other scripts & sites which utilise php and mysql? No, there phpAdsNew is installed along with Photopost. There are a few other small vbulletins on the server also.

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

250-500 average , timeout is set to 3600

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://modularfords.com/phpinfo.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 = 10
StartServers = 5
MaxClients = 150

AND Maxrequestsperchild value = 0

12. what version of vB are you running ?

3.5.0, installing 3.5.1 this week.

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

No



==========================================

Thanks

eva2000
Fri 18th Nov '05, 2:44am
I'd do the following

1. Upgrade PHP to 4.4.1 if you use phpadsnew make sure to update to phpadsnew 2.0.7 to work with PHP 4.4.1
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 = 500
key_buffer = 16M
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 = 64M
max_allowed_packet = 64M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 64M
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


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

5. In httpd.conf change

Maxrequestsperchild to 1000

and restart apache

svtsnake01
Sat 19th Nov '05, 5:24pm
Thanks for the help.

I have started this optimization today however, after upgrading phpadsnew, I downloaded PHP 4.4.1. I configured it with the following command, which was exactly what I used for the last recompilation...

./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --with-mysql --enable-discard-path --with-pear --enable-sockets --enable-track-vars --enable-versioning --with-zlib --with-ssl --with-curl --with-gd

After that I run make, no problems there, but when I run make install, this is the error I get..

Installing PHP SAPI module: apache
[activating module `php4' in /usr/local/apache/conf/httpd.conf]
cp libs/libphp4.so /usr/local/apache/libexec/libphp4.so
cp: cannot stat `libs/libphp4.so': No such file or directory
apxs:Break: Command failed with rc=1
make: *** [install-sapi] Error 1


I searched google groups for this error, read about an older PHP release that caused this and its mentioned to edit libtools after running ./configure, however this did not fix my issue. libphp4.so is not being created it seems.

Any help would be greatly appreciated as my site is down at the moment.

Zachery
Sat 19th Nov '05, 5:28pm
If you have cpanel, use Update Apache instead of combpiling by hand.

svtsnake01
Sat 19th Nov '05, 5:29pm
At the moment, Apache will not start so I cannot get into cPanel.

svtsnake01
Sat 19th Nov '05, 5:54pm
At the moment, Apache will not start so I cannot get into cPanel.

Nevermind I fixed the problem I was having. Its running now.

eva2000
Tue 22nd Nov '05, 4:00am
Good to hear :)