Performance Tunning

nango

Verified User
Joined
May 13, 2006
Messages
92
Hi
I have about 300 Domain on 1 HP server, with 4 GB RAM, Dual CPU AMD Opteron 252.
I have performance problem websites loading very slow and I don't know is it for hardware or maybe Apache is not configured correctly?
Please let me know: how many domains (Web Site) you will add usually on a server like this?
And how can I improve performance on this server? need I new server? or maybe can tune configs for solve problem?

This is top command:
PHP:
,  load average: 13.98, 15.40, 14.41
Tasks: 200 total,   4 running, 195 sleeping,   0 stopped,   1 zombie
Cpu0  : 11.8%us,  7.0%sy,  0.3%ni, 39.3%id, 38.0%wa,  0.0%hi,  3.6%si,  0.0%st
Cpu1  :  9.2%us,  6.1%sy,  0.4%ni, 50.6%id, 29.8%wa,  0.0%hi,  3.9%si,  0.0%st
Mem:   4043196k total,  3887520k used,   155676k free,   169380k buffers
Swap:  8289464k total,   309812k used,  7979652k free,  2966636k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
21609 mysql     15   0  320m  68m 6156 S 20.0  1.7  10:49.62 mysqld
 5004 apache    16   0  187m  35m 4320 S  8.7  0.9   0:00.44 httpd
 5019 apache    15   0  125m  29m 3860 S  7.5  0.8   0:00.36 httpd
20722 root      35  19  4044  612  244 S  5.8  0.0   2:13.38 gzip
 4985 apache    15   0  125m  30m 4232 S  3.5  0.8   0:00.36 httpd
 5027 apache    15   0  122m  26m 3340 S  2.7  0.7   0:00.13 httpd
 4995 apache    15   0  123m  28m 3816 S  1.0  0.7   0:00.24 httpd
 1961 apache    15   0  129m  35m 4984 S  0.4  0.9   0:01.58 httpd
 4850 apache    15   0  179m  31m 4784 S  0.4  0.8   0:01.23 httpd
 4996 usern     15   0 12760 1172  828 R  0.4  0.0   0:00.05 top
 5003 apache    15   0  121m  23m 1544 S  0.4  0.6   0:00.02 httpd
 5037 root      19   0  109m 4304 3308 S  0.4  0.1   0:00.02 exim
 5038 root      18   0  109m 4304 3308 D  0.4  0.1   0:00.02 exim
  253 root      15   0     0    0    0 S  0.2  0.0   0:59.36 pdflush
  467 root      10  -5     0    0    0 D  0.2  0.0   1:39.48 md1_raid1
  477 root      10  -5     0    0    0 D  0.2  0.0   2:43.78 kjournald
 
Last edited:
And is it the biggest load you've ever got on your server?! With this output how would anybody say is it for hardware or not? You should do some investigations, or hire somebody to do the job for you. If you want to do it yourself, please, start with searching the forums. As similar issues have been discussed here several times, and you can really find a lot of useful information. And if you read what you find, it might make it easier to help you.
 
Thank you zEitEr
Server load will change but web sites are slow.
I tried to found problem with search but cases are different and I was not sure about maximum domain with this hardware. If anybody can help about this please let me know:usually how many domain you will add on a server like this?
Today top:

PHP:
top - ,  load average: 6.65, 9.12, 9.98
Tasks: 175 total,   1 running, 172 sleeping,   0 stopped,   2 zombie
Cpu0  : 11.5%us,  6.3%sy,  0.4%ni, 37.4%id, 41.6%wa,  0.0%hi,  2.8%si,  0.0%st
Cpu1  :  9.1%us,  5.5%sy,  0.5%ni, 48.8%id, 32.9%wa,  0.0%hi,  3.2%si,  0.0%st
Mem:   4043196k total,  3729040k used,   314156k free,   967892k buffers
Swap:  8289464k total,   309928k used,  7979536k free,  1188684k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
30746 apache    15   0  122m  26m 3572 S  1.4  0.7   0:00.48 httpd
21609 mysql     15   0  320m  69m 6156 S  1.0  1.8  65:07.22 mysqld
30591 apache    15   0     0    0    0 Z  1.0  0.0   0:02.01 httpd <defunct>
30578 apache    15   0  178m  27m 4652 S  0.7  0.7   0:01.47 httpd
30707 apache    15   0  177m  28m 4468 S  0.7  0.7   0:01.39 httpd
  253 root      15   0     0    0    0 S  0.3  0.0   1:41.62 pdflush
 1630 root      10  -5     0    0    0 S  0.3  0.0   0:14.01 kjournald
30499 Usern     15   0 90164 1732  996 S  0.3  0.0   0:00.02 sshd
30791 Usern     15   0 12760 1164  828 R  0.3  0.0   0:00.59 top
    1 root      15   0 10368  692  580 S  0.0  0.0   0:01.08 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.80 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.49 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:02.23 migration/1
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.89 ksoftirqd/1
    7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1
 
usually how many domain you will add on a server like this

That is a very meaningless question, and none answer would be any useful for you. They can host 100 joomla, and 100 worpress sites.... with numerous numbers of doorways and pointers, and at the same time your hardware might be too weak for 1 popular E-shop powered by self-made PHP scripts.

cases are different

Cases might be different, and of course they will differ, but steps of diagnostics in most cases will be the same. So again with that output, nobody will ever say for 100% what your problem: it might be a hardware problem: HDD, Mother Board, RAM, or software problem. Extra investigation should be done (SMART output, read logs, dmesg, analyze MySQL loads, use apache server-status, install munin, etc), if you do not know what to do and don't want to learn with Google and searching the forums, you'd better look at advertise sub-forum and hire somebody from there, if for any reasons it seems to you, I'm not that guy.


p.s. Look at SWAP, it should not be used.
 
p.s. Look at SWAP, it should not be used.
I'd start with figuring this out. Since there's less available memory than there is swap, then there's swap being used by active programs, not just leftover stuff in swap.

That could be the cause of the problem; there could be one simple poorly-written program that grabs memory and doesn't know how to release it.

Jeff
 
Thanks for your care.
I'm trying to find problem.
I changed: etc/httpd/conf/extra/httpd-mpm.conf all MaxRequestsPerChild from 1000 to 20 and got IMAP connection drop then changed to 400 its a little bit better now but still have problem.

So I checked SWAP and not sure what is problem, for SWAP checking I used top > O >p:
PHP:
top -   load average: 9.28, 8.54, 10.11
Tasks: 199 total,   1 running, 194 sleeping,   0 stopped,   4 zombie
Cpu0  : 14.5%us,  7.1%sy,  0.0%ni,  0.0%id, 78.0%wa,  0.0%hi,  0.4%si,  0.0%st
Cpu1  : 12.4%us,  3.1%sy,  0.0%ni, 17.5%id, 67.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4043196k total,  3766376k used,   276820k free,   947528k buffers
Swap:  8289464k total,   263944k used,  8025520k free,  1138820k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
 6702 root      15   0  258m 7808 5732 S  0.0  0.2   0:00.12 250m avgscand
 5469 mysql     15   0  296m  54m 5132 S  9.6  1.4  45:58.89 242m mysqld
 7024 root      34  19  254m  15m 2136 S  0.0  0.4   0:03.01 238m yum-updatesd
 5061 named     22   0  163m 8540 2044 S  0.0  0.2   0:13.82 154m named
31444 apache    16   0  189m  38m 4764 S  0.0  1.0   0:03.90 150m httpd
21150 apache    15   0  195m  45m 4768 S  0.0  1.1   0:04.03 150m httpd
17611 apache    15   0  180m  30m 4996 D  0.0  0.8   0:04.88 150m httpd
21473 apache    15   0  201m  51m 5088 S  0.0  1.3   0:03.76 150m httpd
21448 apache    15   0  179m  29m 5396 D  0.7  0.7   0:01.91 149m httpd
20997 apache    15   0  178m  28m 5096 S  0.0  0.7   0:05.56 149m httpd
20995 apache    15   0  183m  33m 5332 S  0.0  0.8   0:02.14 149m httpd
21100 apache    15   0  215m  66m 5712 D  0.7  1.7   0:05.53 149m httpd
27565 apache    16   0  200m  51m 6120 S  0.0  1.3   0:10.19 149m httpd
32213 apache    15   0  191m  43m 6580 S  0.0  1.1   2:31.91 148m httpd
21258 apache    16   0  187m  39m 4744 S  0.7  1.0   0:02.69 148m httpd
21128 apache    15   0  188m  40m 4848 S  0.0  1.0   0:03.88 148m httpd
21461 apache    15   0  182m  33m 4844 S  0.0  0.9   0:01.00 148m httpd
 2247 root       7  -8  143m 1120  616 S  0.0  0.0   0:08.10 142m audispd
 6422 root      15   0  130m 2632 1724 S  0.0  0.1   0:00.01 127m cupsd
 2899 root      20   0  120m 1520 1112 S  0.0  0.0   0:04.25 118m automount
 6708 root      18   0  119m 4896 3888 S  0.0  0.1   1:33.58 114m avgtcpd
20830 mail      16   0  109m 2144 1140 S  0.0  0.1   0:00.00 107m exim
20826 root      15   0  109m 3408 2440 S  0.0  0.1   0:00.00 106m exim
21636 apache    15   0  121m  22m 1436 S  0.0  0.6   0:00.01  98m httpd
22001 apache    15   0  120m  22m 1280 D  0.0  0.6   0:00.00  98m httpd
22000 apache    16   0  120m  22m 1344 D  0.0  0.6   0:00.00  98m httpd
21855 apache    15   0  120m  22m 1356 S  0.0  0.6   0:00.00  98m httpd
21635 apache    15   0  120m  22m 1368 S  0.0  0.6   0:00.00  98m httpd
21854 apache    15   0  120m  23m 1968 D  0.0  0.6   0:00.00  97m httpd
17959 root      16   0 98.8m 1412 1108 S  0.0  0.0   0:00.00  97m su
 2347 apache    16   0  122m  25m 2768 S  0.0  0.6   0:00.04  96m httpd
21852 apache    16   0  121m  24m 2872 S  0.3  0.6   0:00.01  96m httpd
21634 apache    15   0  124m  28m 4064 S  0.0  0.7   0:00.34  95m httpd
25634 root      15   0  120m  25m 4560 S  0.3  0.6   0:12.61  95m httpd
seems apache use memory, how to change memory usage for apache if this is problem?
 
Totally wrong....maxrequestsperchild should be something like 10,000

You need to tune your mysql daemon and probably give it more ram.

You should also check for slow queries.
 
Last edited:
You have some high iowait times (the %wa numbers) when those are high, that means that the CPU is waiting a long time to get control back from an I/O operation (disk read/write) and can make your system seem very slow as well as make your load spike. High iowait times can be either from swapping too much, disk driver problems or a something hardware related.
 
Thank you guys
I don't know why this file is empty?: /etc/my.cnf
PHP:
[mysqld]
local-infile=0
/etc/my.cnf (END)

I copy: cp -f /usr/share/mysql/my-small.cnf /etc/my.cnf
Is it wrong?

maxrequestsperchild should be something like 10,000
I changed to 10000 again, how to decrease SWAP usage with apache?
 
Last edited:
http://help.directadmin.com/item.php?id=44

You also might want to do this:

http://help.directadmin.com/item.php?id=91

You probably will want to hire an expert to look at your server to help you tune it. There is a reason you have a lot of i/o wait. This means your httpd process is waiting for something to complete before it can process the request. There are many reasons that could cause this. It might be hard to track down if you do not know a lot about how the linux system works.
 
This means your httpd process is waiting for something to complete before it can process the request. There are many reasons that could cause this. It might be hard to track down if you do not know a lot about how the linux system works.
Which is why I suggested looking into the cause of the high swap usage. When you're using swap memory, memory is being moved in out of hard disk storage. That's a killer. You may simply need more memory; you may need an optimized my.cnf file.

Jeff
 
Back
Top