PDA

View Full Version : Some optimization help


DiscussAnything
Wed 3rd Sep '03, 8:41pm
I just upgraded from a 'shared server' plan to this virtual private server. So far, things are running pretty well, but I want to take care of all of the software optimizations I can, before looking at new ram, etc as things happen. I have my cookie time out set to 15 minutes.

It seems as though my pages are 50/50 split between load time with php and sql and pages are usually generated in .2-.3 seconds, but occasionally I will blips (I assume due to load/searches/etc) that cause a 1-2 second page load.

Thanks!

1. It is a virtual private server. It has 10% guaranteed resources and guaranteed system memory. The environment is a virtual dedicated environment, in which I can make server level changes, they just are not supported.
2.
Processor: Intel Xeon 2.4GHz (10% guaranteed resources)
Memory: 256 MB
HD Space 2.5GB free (don't know what the system is, but I believe it is RAID for redundancy not performance)
Linux: RedHat 7.2
PHP 4.2.2
Apache 1.3.27
MySQL 3.23.56

3. Using 3.23.x

4. I am not sure how it was compiled/installed, done by the staff at OLM

5. Top

6:45pm up 19 days, 34 min, 1 user, load average: 0.16, 0.16, 0.23
56 processes: 55 sleeping, 1 running, 0 zombie, 0 stopped
CPU states: 1.7% user, 3.9% system, 0.0% nice, 94.2% idle
Mem: 262144K av, 211348K used, 50796K free, 15820K shrd, 0K buff
Swap: 51200K av, 12348K used, 38852K free 139964K cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
19829 root 10 0 932 932 720 R 1.5 0.3 0:00 top
1 root 0 0 104 60 48 S 0.0 0.0 0:12 init
10169 root 0 0 256 220 180 S 0.0 0.0 0:13 syslogd
10181 root 0 0 60 0 0 SW 0.0 0.0 0:00 klogd
10218 root 0 0 1052 0 0 SW 0.0 0.0 0:00 snmpd
10228 root 0 0 432 332 260 S 0.0 0.1 1:14 sshd
10243 root 0 0 188 0 0 SW 0.0 0.0 0:00 sshd
10261 root 0 0 456 336 288 S 0.0 0.1 0:03 xinetd
10432 postgres 0 0 448 180 140 S 0.0 0.0 0:01 postmaster
10434 postgres 0 0 376 52 40 S 0.0 0.0 0:00 postmaster
10435 postgres 0 0 484 204 160 S 0.0 0.0 0:00 postmaster
10494 root -10 -10 720 68 48 S < 0.0 0.0 0:42 ocwhttpd
10586 root -10 -10 13472 7976 348 S < 0.0 3.0 0:33 ensim-python
10597 root 0 0 400 252 196 S 0.0 0.0 0:10 bandwidth_manag
10601 postgres 0 0 2428 2160 1720 S 0.0 0.8 0:37 postmaster
10607 root 0 0 188 120 84 S 0.0 0.0 0:04 crond
10619 root 0 0 2144 1508 864 S 0.0 0.5 2:44 poprelayd
10630 daemon 0 0 124 52 44 S 0.0 0.0 0:00 atd
3878 root -10 -10 13472 7976 348 S < 0.0 3.0 0:14 ensim-python

6. my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


7. http://www.discussanything.com/forums/admin/mysqlinfo.php


8. Of my virtual server my forums are the only thing on the site. I AM installing a php based gallery for images but that is not active yet.

9. The average users is probably 40, the max is 100.

10. http://www.discussanything.com/forums/phpinfo.php

11. httpd settings

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

DiscussAnything
Tue 9th Sep '03, 5:15pm
Shamless bump...


Anyone have any suggestions? Eva?

eva2000
Tue 9th Sep '03, 9:15pm
sorry about the delay :o

try this my.cnf and restart your server


[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable = max_connections=400
set-variable = key_buffer=16M
set-variable = myisam_sort_buffer_size=64M
set-variable = join_buffer=1M
set-variable = record_buffer=2M
set-variable = sort_buffer=2M
set-variable = table_cache=1024
set-variable = thread_cache_size=128
set-variable = wait_timeout=14400
set-variable = connect_timeout=10
set-variable = max_allowed_packet=16M
set-variable = max_connect_errors=10

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192

[mysqldump]
quick
set-variable = max_allowed_packet=16M

[myisamchk]
set-variable = key_buffer=64M
set-variable = sort_buffer=64M
set-variable = read_buffer=16M
set-variable = write_buffer=16M



btw, is that 256MB allocated to you or shared as in 10% of 256MB ?

DiscussAnything
Tue 9th Sep '03, 9:32pm
Thanks Eva, I will try that tonight.

The 256 ram is dedicated to me, not 10% of it.

DiscussAnything
Wed 10th Sep '03, 6:34am
I made these changes and will observe them over the next few days and let ya know how it looks.


Will these mostly pretain to high load situations or do you think I will see a general performance boon?

Also, is there a way to verify I did the changes properly. I did copy the my.cnf file over and restart the service, but I just want to make sure the changes 'took.'

Does it look like i need any php or httpd related changes?

Thanks Eva!