Slow Server

jsefton

Verified User
Joined
Mar 30, 2004
Messages
36
Hi All,

There is the possibility that this is nothing to do with DA but other than a pretty bare OS, DA is the only thing i have installed.

I only have 1 DA server setup atm and it seemed to run fine at first. (Its been there since before christmas i think now.)

I have moved about 20 or so websites onto it.
Over the past couple of weeks it seems to have been getting slower and slower at serving up pages.

As an example, i have been working on a webpage today that makes about 20 pretty basic SELECT calls to what is currently 2 completely empty tables and one table that has 1 record. I would normally expect this to be almost instant.
The page reliably takes 11-12 seconds to generate. (i am timing it with the common method of getting the time at the top of the script and then again and the bottom and dumping the difference figure at the bottom of the page.)

The server is very lightly loaded.

here is a bit of info copied and pasted from 'top' directly after 3 or 4 consecutive 11.5 sec requests.

5:17pm up 3 days, 3:17, 1 user, load average: 0.05, 0.02, 0.00
96 processes: 94 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 0.1% user, 0.3% system, 0.0% nice, 99.4% idle


Looking at the list of processes, running top over my SSH session seems to give it more load than the page hitting.

The server is a P4 >2G (2.something)
>600M ram
Its a Compaq (HP) server if that means anything.

The internet connection to the server is only 256k at this time but i assume that should be plenty. (the page output is only a few k)

PING responses (from my ADSL connection here) vary from around 40-60ms, which seems about normal to me.

I really dont know where to start looking for problems.
Anyone got any idea's about where i start looking. (Please!!!)

Many Thanks,

- James
 
jsefton said:
The internet connection to the server is only 256k at this time but i assume that should be plenty. (the page output is only a few k)

Thats likely to be youre problem, Typical broadband users could max that out on their own.

If you wanted to check, block all IPs access to the system besides your own IP address then try again.... providing your on a <512k connection should appear normal...

Chris
 
the server is not on broadband, its in a datacentre in London on a dedicated 256k line. The workstation i have here is on broadband. Also, i have had customers complaining from different points all over the UK about the intermittent slowness of their websites. (to which i blamed their connections initially.)

the line at either end does not appear to be busy to me since i can transfer a file (up and down) via ftp at a speed that i would expect from a 256k line. (around 30k/sec)

I'm pretty sure that the line at this end is quite clear.
I am currently the only one in our office, i dont have any filesharing clients or anything silly like that running and our firewall gives realtime usage statistics. They indicate that nothing other than me browsing the web and outlook checking mail every so often is going up or down the line.

besides, the problem that i have does not appear related to download time since im timing it at the server side. (ie. timing how long it takes the server to generate the script.)

There have been times when the connection here was very busy (ie, when i was downloading redhat earlier today) and although that slowed down me seeing the page a great deal, it had no effect on the figure at the bottom of the page telling me how long it took to generate.

Any other idea's would be very much appreciated.
 
I didnt say it was on broadband, what I said was a typical user with a broadband connection could max that out...

You say the page generation time was the same? - that again would mean the problem is download / uploading from the system... if you have 5 broadband users opening your page at the same time it would probably make them feel like they were still using dial up connections ;)

If you want to test it, as i said block all IPs from the box besides your own and check the page download speed then, of course make sure in both cases you download fresh and nothings cached :)

Chris
 
I didnt say it was on broadband, what I said was a typical user with a broadband connection could max that out...

Apologies, I misread that.

You say the page generation time was the same? - that again would mean the problem is download / uploading from the system... if you have 5 broadband users opening your page at the same time it would probably make them feel like they were still using dial up connections ;)

Yes, the page generation time being >10seconds, regardless of the fact that when the line is busy it was taking 20seconds to actually view the page. From that i understood that the additional 10 secs was due to the busy line.

If you want to test it, as i said block all IPs from the box besides your own and check the page download speed then, of course make sure in both cases you download fresh and nothings cached :)

Ok, although im pretty sure the line is clear, i will try what you ask to be sure. (and get egg on my face when i prove myself wrong no doubt..lol)
Could you tell me how i block the IP's (and how to restore them!) please so that i can give it a go.

The server is RedHat 8. (i think.. if im wrong then its 7.x)

Many Thanks,

- James
 
Page generation seems abnormal at >10seconds, although 10 to download also seems abnormal but would of course vary depending on your connection speeds.

To do the connection test run:

Code:
Replace bold/1.2.3.4 with your own IP

iptables -A INPUT  -s [B]1.2.3.4[/B] -j ACCEPT
iptables -A INPUT  -s 0.0.0.0/0 -j DROP

To remove all firewall rules:

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F

For the generation time possibly recompile apache and php -

Code:
cd /usr/local/directadmin/customapache/
./build all

Chris
 
Hi Chris,

The problem is very intermittent (i think i neglected to mention that.) and has gone away for the minute. Page generation times are currently showing between 0.00s and 0.25s depending on the page i am viewing. When the problem has gone away before its usually back within an hour or so.

I will hopefully be back to you with results tomorrow. (if not tonight)

Thanks for your help so far.

- James
 
Are static pages/files affected by this issue, or is it only mysql? ie: try downloading a static file of equivalent size.

Also, you can set "KeepAlive On" in your /etc/httpd/conf/httpd.conf file.. It won't have any affect on the mysql times, but for general browsing of pages, it will help quite a bit.

John
 
Hi John,

It appears to be pages with MySQL requests on them. Also, the more MySQL requests there are, the slower it gets.
However, at the moment it seems to be working ok.

Plain HTML with no PHP always seemed to load pretty much instantly which made me think it was a PHP/MySQL related problem. I was thinking that there may be some unusual delay in making the connection to MySQL but until it comes back, i can't test much.

I have only just come back into the office this morning so im going to start watching the server for it to start playing up again so that i can test the IP blocking that Chris suggested.

I changed that config value that you mentioned and it does seem to make a difference to how quick any of the pages get to my screen. Thanks for that. I assume that the default timeout value of 15 seconds is suitable or should i increase it?

- James
 
jsefton said:
Plain HTML with no PHP always seemed to load pretty much instantly which made me think it was a PHP/MySQL related problem. I was thinking that there may be some unusual delay in making the connection to MySQL

You are using 'localhost' as your mysql server (for the script connection)?

Chris
 
yes,

I suppose using 127.0.0.1 or the local ip might be something worth trying incase its some sort of lookup problem.
 
James,

If you're having problems with MySQL fetching speed, and your system isn't showing you procedures taking up all your processor time when you run "top", then you should look into whether or not your server has been hacked.

Linux kernel hacks are extremely hard to find and they're quite invisible as well.

Have you run chkrootkit ?

How about Rootkit Hunter ?

Though it's possible that neither of them would find anything specific, one or both should at least show suspicious activity.

Jeff
 
Thanks for those tips jlasman.

The problem has still not resurfaced so i have not had chance to try and pin down where the problem is. (i have not watched it all day though.. been pretty busy.)

I ran the latter of those tools (Rootkit hunter) and it came up mostly ok. The only complaints were to do with SSH. It didnt like that i had root login permitted and that SSH v1 was enabled.

I have disabled root login and set it to accept SSH 2 only and it doesn't complain about a thing now.

Is there a need to run both of those tools or is one pretty sufficient?

- James
 
I always run both.

I have chkrootkit set in cron.daily to run everynight and send me the results.

Jeff
 
Back
Top