Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My shared host suspended my website stating system overload, so I moved my website to a VPS which has 4GB RAM. But for some reason the website has become very slow.

This is the vmstat output -

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 3050500      0      0    0    0     0     1    0    0  0  0 100  0  0

Here's the Apache Benchmark output for a STATIC html page I ran on the server itself -

Benchmarking (be patient)...apr_poll: The timeout specified has expired (70007)
Total of 20 requests completed


Server Config:

  • List item
  • Centos 5.6
  • 4 cores cpu
  • 4 GB RAM
  • LAMP stack with APC
  • Wordpress
  • Only one website

It takes almost double time to load now, same website was much fast on shared hosting. I know I need to tweak some settings but have no clue where to start from?

I have already tried to optimize apache, mysql etc.

Update 2:

CPU usage is low, see uptime output:

 11:09:02 up 7 days, 21:26,  1 user,  load average: 0.09, 0.11, 0.09

Update 3:

When I load any webpage, browser shows "Waiting" for a long time and then page loads quickly. So I suspect server can accept only limited connections and holds extra connections in a waiting state. How to check this?

Update 4: Following is the output on executing netperf

TCP STREAM TEST from ( port 0 AF_INET to localhost.localdomain ( port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    10.00    9615.40
[root@ip-118-139-177-244 j3ngn5ri6r01t3]#

Here are the Apache MPM settings from httpd.conf, do they look okay?

<IfModule worker.c>
StartServers       5
MaxClients        100
MinSpareThreads    50
MaxSpareThreads    250
ThreadsPerChild     125
MaxRequestsPerChild  10000
ServerLimit     100
share|improve this question
Sounds like your website has problems. It could be anything from a memory leak, to extremely poor programming, nested DB queries, etc. You have to give us something better to go on or we can't help any more than that. – Chris S Jan 6 '12 at 17:36
There's a laundry list of definitions of "slow". Do some debugging... and figure out what is slow. (connection time... processing time... slow io... slow database... what?) – TheCompWiz Jan 6 '12 at 17:37
vmstat output shown above gives me an idea that memory, cpu, io are all in a healthy state. Apache benchmark gave that timeout error. Logs are mostly clean of any errors. Where else should I look for? – Arpit Tambi Jan 6 '12 at 17:43
Do some connection benchmarks, like transferring a large file over SSH. Or even push some tests over iperf/netperf. – Tim Jan 6 '12 at 18:07
Yes it must be connections, I will do some tests and then post output. Thanks :) – Arpit Tambi Jan 6 '12 at 18:24

My guess : your shared host did not limit your CPU and was even faster than your current VPS. Also it might be what happens with a lot of VPS, which is overselling. Your VPS is hosted on a shared machine and you might not get all of your CPU cycles. Also there could be very poor I/O or a slow internet connection.

You do not know what is happening above your VPS on the host machine, try to find it out :).

share|improve this answer
load averages are under 0.25, I've heard it can reach 4 for a server with 4 cores. I'm still unable to figure what's making the website slow... – Arpit Tambi Jan 6 '12 at 18:11

What are your apache MPM settings in httpd.conf? I tried connecting to your server, and it takes 5-10 seconds to even send a header back.

Badly written wordpress plugins and themes can hurt performance, but typically they'll be spewing errors in log files or churning mysql/disk access, which doesn't seem to be happening for you.

Update: You might try running prefork instead of worker, especially with your 4GB of RAM. Wordpress recommends that here:

share|improve this answer
Please see Update 4 above containing MPM settings. The same website was working fine under shared hosting environment. Problem lies somewhere within the system or apache itself. – Arpit Tambi Jan 6 '12 at 18:59
Added an update above. I've had issues while moving wordpress ("the same site") from one server to another where a .htaccess file got left out or permission was off, causing the rewrite rules to go rogue and the server to go to its knees. Are you sure your error log is clean? – Eve Freeman Jan 6 '12 at 19:56
So prefork worked? Congrats, looks much faster. – Eve Freeman Jan 7 '12 at 18:47

run netstat -anp | grep TIME_WAIT | wc -l

This will return number of requests waiting for a response from apache. If this number is unusually high, tweak apache settings so that it can handle more requests per second without compromising overall server performance.

Setup apache preform MPM settings as follows:

<IfModule prefork.c>
StartServers       25
MaxClients        500
MaxRequestsPerChild  10000
ServerLimit     500
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.