Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

looking for advice on my new VPS I have set up with help from a friend. Everything seems to be working well and pages load quickly after the first page load, the first page load takes up to ten seconds even for simple text based websites.

I presume this is a DNS based issue, (or could it be related to Apache?), as the IP is being resolved, could anyone explain if I am correct and how to improve this?

Domains:, &

Many thanks for your advice!

Can anyone confirm whether they are experiencing the slow down I am describing?

Output of w:

17:24:40 up  6:22,  2 users,  load average: 0.64, 0.39, 0.45
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0   16:44   38:00   0.02s  0.02s -bash
root     pts/1   17:24    0.00s  0.01s  0.00s w

Output of free:

             total       used       free     shared    buffers     cached
Mem:          2048        320       1727          0          0          0
-/+ buffers/cache:        320       1727
Swap:            0          0          0

The beginning of top:

top - 17:26:46 up  6:25,  2 users,  load average: 0.21, 0.29, 0.41
Tasks:  81 total,   1 running,  80 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,   328552k used,  1768600k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
    1 root      18   0  2156  668  572 S  0.0  0.0   0:00.23 init                                                                             
 1350 mysql     15   0  125m  15m 4248 S  0.0  0.8   0:05.74 mysqld                                                                           
 1702 root      18   0 10008 2836 2292 S  0.0  0.1   0:00.02 sshd                                                                             
 1710 root      15   0  3844 1540 1248 S  0.0  0.1   0:00.02 bash                                                                             
 3580 root      18   0  3244  436  328 S  0.0  0.0   0:00.05 da-popb4smtp                                                                     
 3589 nobody    19   0  9136 1352  944 S  0.0  0.1   0:00.21 directadmin  

Top while server is under reasonable load:

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
 1350 mysql     15   0  126m  15m 4252 S 25.1  0.8   0:14.37 mysqld                                                                           
31859 apache    15   0 50436  41m 1988 S  0.3  2.0   0:00.85 httpd                                                                            
32146 apache    15   0 50464  41m 1972 S  0.3  2.0   0:00.75 httpd                                                                            
    1 root      18   0  2156  668  572 S  0.0  0.0   0:00.23 init                                                                             
 1702 root      18   0 10008 2836 2292 S  0.0  0.1   0:00.02 sshd     

I get very strange load impact test results, could this be related?

share|improve this question

closed as off-topic by HopelessN00b Apr 3 '15 at 17:15

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

+1 for not anonymising the question, and giving us the actual domains involved. Sadly I have no advice, as yet. – MadHatter Mar 28 '11 at 15:53
Never really understood why people do that, it makes it much harder to assist! – Pez Cuckow Mar 28 '11 at 16:31
You can always test if it's DNS issue by doing ping <some dns> and then going to website to see if it loads up fast. if the problem is still there then that means it's not dns since the domain is already cached. – MadBoy Mar 28 '11 at 17:26
up vote 2 down vote accepted

I don't think it's a DNS issue... DNS Resolving was very fast for me.

ikbenbart$ dig

; <<>> DiG 9.6.0-APPLE-P2 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44600
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;    IN  A

;; ANSWER SECTION: 14390 IN    A

;; Query time: 7 msec
;; WHEN: Mon Mar 28 17:53:06 2011
;; MSG SIZE  rcvd: 60

The one thing that did struck my eye where the ping-latencies:

ikbenbart$  ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=54 time=23.482 ms
64 bytes from icmp_seq=1 ttl=54 time=21.030 ms
64 bytes from icmp_seq=2 ttl=54 time=24.165 ms
64 bytes from icmp_seq=3 ttl=54 time=22.786 ms
64 bytes from icmp_seq=4 ttl=54 time=19.822 ms
64 bytes from icmp_seq=5 ttl=54 time=21.464 ms
64 bytes from icmp_seq=6 ttl=54 time=354.739 ms
64 bytes from icmp_seq=7 ttl=54 time=21.032 ms
64 bytes from icmp_seq=8 ttl=54 time=21.691 ms
64 bytes from icmp_seq=9 ttl=54 time=20.745 ms
64 bytes from icmp_seq=10 ttl=54 time=346.652 ms
64 bytes from icmp_seq=11 ttl=54 time=21.422 ms
64 bytes from icmp_seq=12 ttl=54 time=291.492 ms
64 bytes from icmp_seq=13 ttl=54 time=622.309 ms
64 bytes from icmp_seq=14 ttl=54 time=339.109 ms
64 bytes from icmp_seq=15 ttl=54 time=567.751 ms
64 bytes from icmp_seq=16 ttl=54 time=170.745 ms
64 bytes from icmp_seq=17 ttl=54 time=465.188 ms

There are a lot of spikes there... How is the load on the server? Try running the command w and free -mand see what you get.

share|improve this answer
As far as I am aware the load is normal, have add information above. Many thanks for your help so far! – Pez Cuckow Mar 28 '11 at 16:27

You can add nameserver to the top of /etc/resolv.conf to see if it's a DNS issue.

share|improve this answer
How will using Google's DNS assist? (Out of interest) – Pez Cuckow Mar 28 '11 at 16:28
It is anycast - routed to he next google data center, not one centrally. In general they are assumed to be very fast (not overlaoded) AND close by. Pretty often a lto better than a crappy underpowered DNS at a faky provider. – TomTom Mar 28 '11 at 16:31

A few things I noticed and that you can check:

  • The Firebug extension for FireFox is very useful in diagnosing page speed/loading issues like this (look on the "Net" tab). YSlow is a related extension that can suggest things to increase performance (be aware that not all suggestions may be valid for your site).
  • Of the several test page loads I did I never saw any issue with DNS.
  • Many of your images are very large. Consider trying to optimize them or change formats for some potentially significant gains (ex: PNG to JPG).
  • Consider minifying some of your JavaScript files.
  • Consider disabling mod_deflate at least temporarily for testing. On servers with slow CPUs that are significantly under load I've found you can get a noticeable performance increase by not compressing pages. YMMV but there is no harm in trying.
  • There are some 404 errors on your preschool site.
  • The preschool site had the most significant performance issues which may be due to the number of files required to load (35). Each of these files takes up an Apache client when loading. If your Apache MaxClients is only 50 then a couple of people loading your page at the same time may cause the 50 to be hit very quickly and cause connections past that to be delayed or time out. Note that having a 35 files/page is not bad per se, but you do have to be aware of how that impacts your site's performance and page loads.
  • Make sure you Apache MaxClients is high enough to server the number of concurrent users but not high enough to use up all your RAM (especially since you're also running MySQL).
  • Another way to reduce the Apache load but increase how many files you can serve is to use a higher performance web server like lighttpd/nginx for all the static content (JavaScript, CSS, images) and let Apache just serve heavyweight PHP pages.
  • Usage of mod_expires might help reduce reloads of content over time.
  • Make sure you're using a PHP opcode cache of some sort (APC, eAccelerator).
  • You can use ab (ApacheBench) on your server to benchmark your sites performance. I would use it now to get a baseline and then after each attempt at improving performance to see what the result is. Test a variety of file types (PHP, HTML, CSS, image, etc...). Benchmarking can also point you in a direction of your site's bottleneck (CPU, RAM, IO, etc...).

I would start by looking at the output from Apache's status module and see if the problem is indeed related to maxing out the number of available clients. If there are a lot of clients available but the site is still slow there may be other more subtle issues involved.

share|improve this answer

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