PDA

View Full Version : Server Optimization Request


420
Tue 22nd Nov '05, 6:30pm
as per steve machol's request, here is my server info


[Server Optimisation]: Read This Before Posting for Server Help (required by eva2000)

In order to help you with server problems and optimization, please provide the
following info in your thread (courtesy of eva2000):

1. Is this on dedicated or shared virual server. If shared, how many sites share
this server (ask web host if needed)

This is a dedicated server with 56 domains for 10 total sites.
There are 19 total Mysql DBs.

2. your server specs. For example:

cpu speed/type single or dual cpus): P4 2.8GHz Single
how much memory installed: 1GB ram
hard drive type/configuration: 80GB EIDE non raid

linux distributor: FreeBSD 4.11-RELEASE (AH)
apache/IIS version: apache 1.3.34
PHP version: php 4.4.1
MySQL version: mysql Ver 14.7 Distrib 4.1.10a, for unknown-freebsd4.11 (i386)


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 aware of any.

4. if possible how mysql was compiled/installed
Through CPPLUS Control Panel.

5. your top stats
last pid: 34122; load averages: 1.18, 0.81, 0.70 up 4+03:03:48 14:04:52
113 processes: 1 running, 112 sleeping
CPU states: 77.9% user, 0.0% nice, 5.6% system, 0.7% interrupt, 15.7% idle
Mem: 686M Active, 127M Inact, 133M Wired, 19M Cache, 111M Buf, 33M Free
Swap: 1000M Total, 160M Used, 839M Free, 16% Inuse

PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
3887 mysql 2 0 331M 42216K poll 190:17 4.35% 4.35% mysqld
228 www 2 0 16780K 10176K accept 19:38 2.20% 2.20% httpd
218 www 2 0 17368K 10972K accept 19:49 2.00% 2.00% httpd
34003 www 2 0 14740K 9396K accept 0:07 1.86% 1.86% httpd
253 www 2 0 17092K 10180K accept 20:15 1.76% 1.76% httpd
34024 www 2 0 14704K 9392K accept 0:08 1.76% 1.76% httpd
216 www 2 0 17388K 10276K accept 20:03 1.66% 1.66% httpd
256 www 2 0 17392K 10480K accept 19:42 1.56% 1.56% httpd
246 www 2 0 17692K 10444K accept 19:08 1.56% 1.56% httpd
209 www 2 0 16712K 10336K accept 19:41 1.51% 1.51% httpd
252 www 2 0 17424K 11132K sbwait 20:33 1.42% 1.42% httpd
376 www 2 0 16976K 10928K accept 18:41 1.37% 1.37% httpd
235 www 2 0 17492K 10252K accept 19:50 1.32% 1.32% httpd
247 www 2 0 17032K 10428K accept 19:54 1.27% 1.27% httpd
33498 www 2 0 16972K 10732K accept 0:31 1.17% 1.17% httpd
224 www 2 0 17204K 9844K accept 20:30 1.12% 1.12% httpd
374 www 2 0 17484K 10680K accept 20:36 1.07% 1.07% httpd
383 www 2 0 17468K 11020K accept 20:52 0.98% 0.98% httpd
210 www 2 0 17508K 10668K accept 20:05 0.93% 0.93% httpd
219 www 2 0 17072K 10348K sbwait 19:29 0.93% 0.93% httpd
398 www 2 0 17212K 10300K accept 19:24 0.88% 0.88% httpd
237 www 2 0 20164K 10824K accept 18:51 0.83% 0.83% httpd
33269 www 2 0 14848K 9480K accept 0:45 0.83% 0.83% httpd
32919 www 2 0 15608K 10216K accept 0:59 0.78% 0.78% httpd
245 www 2 0 16900K 10408K accept 19:44 0.63% 0.63% httpd
384 www 2 0 17324K 10256K accept 19:16 0.59% 0.59% httpd
393 www 2 0 17124K 10440K accept 19:25 0.54% 0.54% httpd
371 www 2 0 17368K 10344K sbwait 20:30 0.44% 0.44% httpd
33935 www 2 0 14648K 9284K accept 0:15 0.44% 0.44% httpd
257 www 2 0 17268K 10308K accept 20:19 0.39% 0.39% httpd
372 www 2 0 16808K 10268K accept 19:35 0.39% 0.39% httpd
380 www 2 0 17484K 10360K sbwait 19:31 0.34% 0.34% httpd
34122 root 28 0 2064K 1052K RUN 0:00 3.08% 0.29% top
249 www 2 0 16968K 10428K accept 19:55 0.20% 0.20% httpd
379 www 2 0 17220K 10196K accept 18:46 0.15% 0.15% httpd
239 www 2 0 17260K 10184K accept 18:35 0.15% 0.15% httpd
234 www 2 0 17324K 10420K accept 18:29 0.10% 0.10% httpd
33504 www 2 0 14872K 9564K sbwait 0:31 0.05% 0.05% httpd

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

[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
max_connections = 1000
thread_concurrency = 4

log-bin

server-id = 1

[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 = 16M
write_buffer = 16M

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 16M
write_buffer = 16M

[mysqlhotcopy]
interactive-timeout


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) either:

Quote:
mysqladmin -u root -p extended-status

+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 0 |
| Aborted_connects | 6 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Bytes_received | 2244652828 |
| Bytes_sent | 1303242616 |
| Com_admin_commands | 0 |
| Com_alter_db | 0 |
| Com_alter_table | 0 |
| Com_analyze | 0 |
| Com_backup_table | 0 |
| Com_begin | 0 |
| Com_change_db | 762604 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_create_db | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_table | 101 |
| Com_dealloc_sql | 0 |
| Com_delete | 15887 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 102 |
| Com_drop_user | 0 |
| Com_execute_sql | 0 |
| Com_flush | 0 |
| Com_grant | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 0 |
| Com_insert | 134533 |
| Com_insert_select | 425 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 0 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_rename_table | 0 |
| Com_repair | 0 |
| Com_replace | 31200 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_revoke_all | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 1500832 |
| Com_set_option | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_column_types | 0 |
| Com_show_create_db | 0 |
| Com_show_create_table | 0 |
| Com_show_databases | 3 |
| Com_show_errors | 0 |
| Com_show_fields | 0 |
| Com_show_grants | 0 |
| Com_show_innodb_status | 0 |
| 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_privileges | 0 |
| Com_show_processlist | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 10 |
| Com_show_storage_engines | 0 |
| Com_show_tables | 9 |
| Com_show_variables | 35 |
| Com_show_warnings | 0 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 0 |
| Com_unlock_tables | 0 |
| Com_update | 595015 |
| Com_update_multi | 0 |
| Connections | 762768 |
| Created_tmp_disk_tables | 177745 |
| Created_tmp_files | 337 |
| Created_tmp_tables | 312032 |
| Delayed_errors | 3 |
| Delayed_insert_threads | 1 |
| Delayed_writes | 4198 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 87480 |
| Handler_discover | 0 |
| Handler_read_first | 190597 |
| Handler_read_key | 50510258 |
| Handler_read_next | 72330469 |
| Handler_read_prev | 1023064 |
| Handler_read_rnd | 30853598 |
| Handler_read_rnd_next | 1299475732 |
| Handler_rollback | 0 |
| Handler_update | 3682612 |
| Handler_write | 46469106 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 217765 |
| Key_blocks_used | 23104 |
| Key_read_requests | 137569021 |
| Key_reads | 86286 |
| Key_write_requests | 737897 |
| Key_writes | 167169 |
| Max_used_connections | 58 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 475 |
| Open_streams | 0 |
| Open_tables | 256 |
| Opened_tables | 19079 |
| Qcache_free_blocks | 473 |
| Qcache_free_memory | 1043816 |
| Qcache_hits | 4427044 |
| Qcache_inserts | 1332728 |
| Qcache_lowmem_prunes | 118963 |
| Qcache_not_cached | 168104 |
| Qcache_queries_in_cache | 1380 |
| Qcache_total_blocks | 4609 |
| Questions | 8230409 |
| Rpl_status | NULL |
| Select_full_join | 15077 |
| Select_full_range_join | 0 |
| Select_range | 190984 |
| Select_range_check | 0 |
| Select_scan | 563367 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 38 |
| Slow_queries | 93 |
| Sort_merge_passes | 167 |
| Sort_range | 209042 |
| Sort_rows | 56673033 |
| Sort_scan | 332909 |
| Table_locks_immediate | 3801303 |
| Table_locks_waited | 14107 |
| Threads_cached | 7 |
| Threads_connected | 4 |
| Threads_created | 3558 |
| Threads_running | 1 |
| Uptime | 354645 |
+--------------------------+------------+


8. is your vB the only thing on the server? or other scripts & sites which
utilise php and mysql?

There are other php scripts besides x vB3.5.1 forums.
phpasnews
vba links
vba Gallery
photopost
oscommerce


9. how many average and max concurrent users on your vB forum ? and what
your cookie timeout is ?
average - max - timeout
vb forum 1: Low usage - new - 900
vb forum 2: 200 - 600 - 900
vb forum 3: 75 - 600 - 900
vb forum 4: Low - new - 900


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.420times.com/phpinfo.php (http://www.420times.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 = 40
MaxSpareServers = 75
StartServers = 50
MaxClients = 500

AND Maxrequestsperchild value = 10000

12. what version of vB are you running ?

vB 3.5.1

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

You can use this command to find such files
Quote:
find / -size +2000000k

find / -size +2000000
/usr/www/logs/420girls-error
/usr/www/logs/420girls-access
/usr/www/logs/420times-access

eva2000
Wed 23rd Nov '05, 4:05am
bit overloaded there for single cpu server probably web/apache load more than mysql load

try

1. Edit /etc/my.cnf and place the following mysql server settings in /etc/my.cnf and restart mysql server afterwards


[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
safe-show-database
skip-innodb
max_connections = 500
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 = 64M
max_allowed_packet = 64M
max_connect_errors = 10
thread_concurrency = 2
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


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

3. change httpd.conf

from

KeepAlive = on
MaxKeepAliveRequests = 100
KeepAliveTimeout = 15
MinSpareServers = 40
MaxSpareServers = 75
StartServers = 50
MaxClients = 500

AND Maxrequestsperchild value = 10000

to

KeepAlive = on
MaxKeepAliveRequests = 120
KeepAliveTimeout = 8
MinSpareServers = 10
MaxSpareServers = 15
StartServers = 10
MaxClients = 180

AND Maxrequestsperchild value = 250

restart apache server

noppid
Wed 23rd Nov '05, 3:11pm
Thanks, we installed the above suggestions and all went fine. Rob just started getting these since we restarted apache and mysqld.

We appreciate your help.


Database error in vBulletin :

mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
/xxxx/xxxx/xxxx/420times/forums/includes/class_core.php on line 273

MySQL Error :
Error Number :
Date : Wednesday, November 23rd 2005 @ 12:51:05 PM
Script : http://www.420times.com/forums/image.php?u=5381&dateline=1125437251
Referrer : http://www.420times.com/forums/showthread.php?t=37146
IP Address :
Username :
Classname : vb_database


Database error in vBulletin :

mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
/xxxx/420girls/420/forums/includes/class_core.php on line 273

MySQL Error :
Error Number :
Date : Wednesday, November 23rd 2005 @ 12:51:04 PM
Script : http://www.420girls.com/gallery/showimage.php?i=5699&c=622
Referrer : http://www.420girls.com/gallery/browseimages.php?do=browseimages&c=622&page=4
IP Address :
Username :
Classname : vb_database

noppid
Wed 23rd Nov '05, 4:26pm
P.S. Rob is having another GB of RAM installed today.

420
Wed 23rd Nov '05, 7:27pm
THANKS FOR YOUR HELP GUYS..
IT'S BEEN FOREVER I HAVE BEEN TRYING TO GET THESE FORUMS WORKING RIGHT..

oops..sorry for caps...;)

a mod from 420times.com just told me he cannot log out...
when he clears cookies, he can..
but when he logs in again, he cannot logout..
he says it is like the cookie is not being deleted or something..
may have something to do with that cache acp thing you guys installed today?

we are discussing it here
http://www.420times.com/forums/showthread.php?t=44674

420
Wed 23rd Nov '05, 7:32pm
okay..
he now says he had a password manager set and figured out why and that it is not an issue with the forum....sorry for the false alarm.

420
Wed 23rd Nov '05, 8:00pm
my host is installing the extra gig of ram tomorrow afternoon..
will have total 2 gigs...still only one processor, for now, unless we need to beef up hardware again...
i will let you know when this is done so we can compare stats to see if it made any difference.

thank you so very much gentlemen and i hope you have a great thanksgiving!

eva2000
Thu 24th Nov '05, 7:25am
so errors in post #3 are gone as those just mean mysql server was restarted or shutdown (not running) when the vB script was trying to connect to mysql server

420
Thu 24th Nov '05, 2:29pm
that is correct

eva2000
Fri 25th Nov '05, 5:36am
good to hear :)

420
Sat 26th Nov '05, 2:19pm
my host has yet to install the ram, as usual...they are so unorganized...i may be looking for a new host soon...they just have no experience with these forums nor do they give a crap about my business...so...
if you have any ides, let me know.

should i assume this tweaking session is complete now or is there more to do?

i have yet to get a big surge of traffic again and am too scared to promote to try and have the server crash again...please give me some feedback, in non tech talk, that explains our progress in this issue.

thanks!

eva2000
Sun 27th Nov '05, 3:50am
tweaks are done just now to wait for the traffic :)