Post Reply  Post Thread 
Optimization Help needed
acctman
Junior Member
**

Posts: 3
Group: Registered
Joined: Dec 2006
Status: Offline
Reputation: 0
Post: #1
Optimization Help needed

Dual 2.8 xeon 3gb RAM, 2x120 HD, 20mbps unmeter uplink
Running a high traffic image rating site.

[ Apacha httpd ]
RLimitMEM 382296746
RLimitCPU 240
Timeout 30
KeepAlive On
MaxKeepAliveRequests 150
KeepAliveTimeout 4
MinSpareServers 25
MaxSpareServers 50
StartServers 15
MaxClients 1024
MaxRequestsPerChild 500

[MYSQL my.cnf]
# The MySQL server
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 1536M
max_allowed_packet = 4M
table_cache = 1000
sort_buffer_size = 4M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_type = 1
query_cache_limit = 1M
query_cache_size = 32M
max_connections = 900
back_log = 50
skip-innodb

log-slow-queries = /home/mysql-query.log
long_query_time = 2
log-long-format

# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8



23:37:24 up 1:18, 2 users, load average: 17.86, 15.73, 13.85
413 processes: 402 sleeping, 10 running, 0 zombie, 1 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 69.5% 0.0% 16.5% 0.3% 2.4% 10.9% 0.0%
cpu00 68.8% 0.1% 14.9% 0.7% 4.5% 10.6% 0.0%
cpu01 70.2% 0.0% 18.1% 0.0% 0.3% 11.2% 0.0%
Mem: 3081952k av, 1828944k used, 1253008k free, 0k shrd, 70380k buff
1219320k actv, 377096k in_d, 39964k in_c
Swap: 2097136k av, 296k used, 2096840k free 390080k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
12186 mysql 15 0 227M 227M 2840 S 9.5 7.5 0:00 1 mysqld
5441 nobody 16 0 11744 11M 4896 S 6.8 0.3 0:27 1 httpd
12284 mysql 15 0 227M 227M 2840 S 6.3 7.5 0:00 1 mysqld
12189 mysql 15 0 227M 227M 2840 S 5.2 7.5 0:02 0 mysqld
4645 nobody 15 0 12068 11M 4860 S 2.1 0.3 0:28 0 httpd
7304 nobody 15 0 11948 11M 4856 S 2.0 0.3 0:06 0 httpd
4551 nobody 16 0 12216 11M 4892 S 1.8 0.3 0:28 0 httpd
24903 nobody 15 0 12044 11M 4872 S 1.5 0.3 0:14 0 httpd
4660 nobody 15 0 11956 11M 4844 S 1.4 0.3 0:29 1 httpd
23096 nobody 15 0 12740 12M 4872 S 1.4 0.4 0:17 0 httpd
4677 nobody 15 0 12296 12M 4772 S 1.2 0.3 0:27 1 httpd
4662 nobody 15 0 12388 12M 4852 S 0.9 0.4 0:29 1 httpd
12277 mysql 19 0 227M 227M 2840 R 0.9 7.5 0:00 1 mysqld
4636 nobody 15 0 12864 12M 4896 S 0.7 0.4 0:30 0 httpd
4659 nobody 15 0 11992 11M 4892 S 0.7 0.3 0:29 0 httpd
16544 nobody 15 0 11748 11M 4872 S 0.7 0.3 0:22 1 httpd
4654 nobody 15 0 13448 13M 4856 S 0.6 0.4 0:27 1 httpd
5455 nobody 16 0 12112 11M 4872 S 0.6 0.3 0:25 0 httpd
28668 nobody 15 0 11640 11M 4872 S 0.6 0.3 0:12 1 httpd
4563 nobody 16 0 37572 36M 4776 S 0.5 1.2 0:29 0 httpd
4620 nobody 15 0 11796 11M 4840 S 0.5 0.3 0:28 1 httpd
4630 nobody 15 0 12376 12M 4876 S 0.5 0.4 0:29 0 httpd
4638 nobody 15 0 12052 11M 4908 S 0.5 0.3 0:30 1 httpd
4663 nobody 15 0 11772 11M 4896 S 0.5 0.3 0:28 0 httpd
13872 nobody 15 0 11836 11M 4876 S 0.5 0.3 0:23 1 httpd
14639 nobody 16 0 12276 11M 4864 S 0.5 0.3 0:24 1 httpd
20464 root 16 0 2888 2888 888 R 0.5 0.0 0:46 1 top
4048 nobody 15 0 37100 36M 3228 S 0.4 1.2 0:21 0 fcserver
4635 nobody 15 0 11820 11M 4780 S 0.4 0.3 0:28 0 httpd
4641 nobody 15 0 12764 12M 4880 S 0.4 0.4 0:38 1 httpd
4675 nobody 15 0 13820 13M 4860 S 0.4 0.4 0:27 1 httpd
7129 nobody 15 0 11028 10M 4856 S 0.4 0.3 0:03 1 httpd
10163 nobody 15 0 11312 11M 4764 S 0.4 0.3 0:00 1 httpd

12-24-2006 03:51 AM

This post was last modified: 12-24-2006 04:44 AM by acctman.

Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 214
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 0
Post: #2
RE: Optimization Help needed

Please post the output of "free -m" command.

12-24-2006 08:08 AM
Find all posts by this user Quote this message in a reply
acctman
Junior Member
**

Posts: 3
Group: Registered
Joined: Dec 2006
Status: Offline
Reputation: 0
Post: #3
RE: Optimization Help needed

Pacifier Wrote:
Please post the output of "free -m" command.


total used free shared buffers cached
Mem: 3009 2917 92 0 163 1218
-/+ buffers/cache: 1535 1474
Swap: 0 0 0
devsys@nmx [~]#

12-26-2006 07:11 AM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 214
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 0
Post: #4
RE: Optimization Help needed

It seems like because of the disk (I/O) utilization, you're having much IO_WAIT. If you can lower your IO_WAIT a bit, you won't have 0% idle processor.

Have you already put in place hotlinking protection? You may want to upgrade to 2xSATA disks if you're currently using normal IDE (PATA) disks, or to 2xSCSI disks if you're using SATA disks already.

You need to move MySQL to a second disk if you haven't already done so.

What type of disks are you using and is MySQL on a second dedicated disk? Have you optimized your scripts and queries?

Anyways, try this my.cnf file:

Code:
# The MySQL server
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 300M
max_allowed_packet = 4M
table_cache = 2000
join_buffer_size = 2M
sort_buffer_size = 3M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache = 64
query_cache_type = 1
query_cache_limit = 1M
query_cache_size = 32M
max_connections = 900
#back_log = 50
skip-innodb

log-slow-queries = /home/mysql-query.log
long_query_time = 10
#log-long-format

# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

12-26-2006 07:52 AM
Find all posts by this user Quote this message in a reply
acctman
Junior Member
**

Posts: 3
Group: Registered
Joined: Dec 2006
Status: Offline
Reputation: 0
Post: #5
RE: Optimization Help needed

I'm using normal IDE disk and mysql is not on a disk by itself... What would be the easiest way to move mysql to its own disk, I have a second drive that I use for flash video storage, and a flash chat. as for optimization of the script, no haven't had that done yet. Thats something i really need done. I've tried twice to hire a programmer to do the job but they both flaked out and disappeared on me or ended up just know basic php/mysql which is of no use to me when optimization is needed.

12-27-2006 07:07 AM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 214
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 0
Post: #6
RE: Optimization Help needed

Sorry for the delay in reply. For moving MySQL to a second disk, make sure the second disk isn't busy. Then, you can use my How to in "Articles" section which tells you step by step how you can move MySQL to a second drive.

If you are having normal IDE drive, I would recommend spending some money on upgrading to faster disks, at minimum to SATA-I drives. Your service provider may be able to swap your current HDDs for SATA disks at some cost of $30 one time. Contact them to see how they can help you with it.

If you need optimizations, you don't have to hire some normal PHP/MySQL newbies. Hire someone who has done optimizations ago and by no means it's supposed to be cheap service. Have a look at http://exoscripts.com if you need some good service with php scripts optimizations or ask at some webmaster forum for recommendations of good experienced PHP/MySQL programmers.

12-29-2006 09:26 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: