# slowdown when i start webserver



## wonslung (Jun 8, 2009)

I've got some massive slowdown that happens when i start my webserver....it's not a very busy site and the server is pretty powerful, quad core xeon 8 gb ram.  It's really weird, things start off fast but slowly get lagged...and the lag is strange too...it's almost like the connections are "backed up" because when you try to connect to a page it lags for 10-20 seconds then loads ALL at once....i'm really confused, i've tried apache prefork and worker, and even lighttpd.


----------



## rhyous (Jun 8, 2009)

Sounds like we are in narrow down mode.

What does top say is taking CPU / Memory?
Any logs in /var/log that indicate and issue?

You need to start hunting for any hint of a trail that will lead to the smoking gun.


----------



## wonslung (Jun 8, 2009)

```
last pid: 41097;  load averages:  0.25,  0.20,  0.17    up 0+01:22:52  06:55:41
193 processes: 2 running, 191 sleeping
CPU:  1.6% user,  0.0% nice,  3.8% system,  0.4% interrupt, 94.3% idle
Mem: 582M Active, 1438M Inact, 2335M Wired, 532K Cache, 224K Buf, 3549M Free
Swap: 8192M Total, 8192M Free
```

yah, i know,  none of the logs show anything that points in the obvious direction to ME.

Which log do you want me to post?


----------



## rocky (Jun 8, 2009)

It seems that you got a DNS problem. When starting up the server looks for an IP resolver of domain name and if you have wrong setting in DNS server you will get slow stuff. For DNS please check /etc/nsswitch.conf, /etc/rc.conf and /etc/resolv.conf.

Run `httpd` in debug mode to see what went wrong.


----------



## wonslung (Jun 8, 2009)

and this would cause the pages to start off loading fast and start lagging after 2-3 minutes, and also lag out ssh and everything else?

i'm using freedns at afraid.org.
i will check the files you list.


----------



## rhyous (Jun 8, 2009)

Seeing that you have plenty of memory and CPU, it does also lean towards the problem existing with the network not the box.

A packet capture might show you what is going on.  If you are getting bad packets, long delays between responses...etc...

I have seen DNS cause pages to load extremely slow before...maybe not your exact symptoms.

I have also seen it be something like a bad NIC (even with brand new hardware).


----------



## wonslung (Jun 8, 2009)

Yah, i would think it's the network as well if the machine didn't work perfectly on the same network with linux installed on it.


Also, the symptoms are strange.  I have FTP and SSH running perfectly and super fast, then when i start the webserver, it too works well for 5-10 minutes giving 1/2 second - 1 second page loads.  Then it gets laggy.  It's weird because when you try to load a page durring the lag, it doesn't start loading then get slow, it seems to not load at all or even connect for the first 8-10 seconds then all at once, the page loads.

When this lag is occuring ssh gets slow but ftp stays about the same.   If i stop the webserver everything returns to normal after 5-10 minutes.

Is it possible that it's mysql causing this? all my pages use mysql....i dont' know where to begin diagnosing the issue though, the load stays nice and low according to top.

One thing i'm goin to try is to take a snapshot of the system and rebuilt world/kernel.


any suggestions on how to figure it out would be great and i apprciate the effort


----------



## wonslung (Jun 9, 2009)

This problem hasn't gone away...i've tried rebuilding world, i've tried different web servers....what's odd is that the lag starts after about 2-3 minutes of the webserver running but if i RESTART the webserver, it goes away, so if i restart it every 3-5 minutes it's not there....what on earth would cause this....

setting up cron to continually restart lighttpd or apache is no real solution.


----------

