PHPee.com PHP development forum
Slow response times

 
Post new topic   Reply to topic    phpee.com Forum Index -> PPhlogger Support
View previous topic :: View next topic  
Author Message
gavinm



Joined: 17 Mar 2004
Posts: 11
Location: Nottingham UK

PostPosted: Mon Jul 12, 2004 4:54 pm    Post subject: Slow response times Reply with quote
I've had phplogger running on an apache server now for about 8 months. There are 14 user accounts and database size is about 23MB. The web sites being logged are all on different web servers at various different ISPs.
Over the last couple of months I've noticed that pages with a link to the logger are sometimes very, very slow to load. Also somtimes simply logging into a user account is very very slow.

Traffic to the sites being logged is not very high, maybe upto 1000 unique visitors per day - but usually much less.

Can anybody suggest what might be wrong?
_________________
Gavin Murray
Back to top
View user's profile Send private message
sdjl
Moderator


Joined: 17 Nov 2003
Posts: 820
Location: London, UK

PostPosted: Mon Jul 12, 2004 8:22 pm    Post subject: Reply with quote
Have you been running the optimize commands on your database tables?
There is an option to do this under the admin side of pphlogger.

It is important to look after your database, much like you would look after a car by making sure it has oil and fuel.
If you don't keep your database optimized, things start to slow down and break. In a worst case scenario, you may even loose your data.

David
_________________
-----
Free Logger Accounts | PPHlogger Manual | PM Me
Back to top
View user's profile Send private message Visit poster's website
gavinm



Joined: 17 Mar 2004
Posts: 11
Location: Nottingham UK

PostPosted: Tue Jul 13, 2004 12:49 pm    Post subject: Reply with quote
Thanks David - I assume you mean the
OPTIMISE user
and
OPTIMISE administration

in the PowerPhlogger maintenance central window of the Admin section?

I've tried running these - and then recalculated table sizes. Doesn't seem to have made any difference? I'll see if performance is any different. (First indications are that its working ok at the present - ie not slowly).

The problem that I am seeing is that sometimes when you browse to a page that is being logged by pphlogger, it can take 30 seconds to a minute or even more for the page to display. Often if you click Refresh while you are waiting, it will display immediately.

Also sometimes get the same thing when browsing to pphlogger and logging into a user account. You enter the username and password then get a long delay (30 to 60 secs or more) before any log results are displayed.

Do you really think that this can be caused by not optimising the database?? What is the optimisation process doing? And whats the difference between optimise user and administration?

Thanks for your help - sorry there's so many questions - but I can't find any information about this by searching the forum.
_________________
Gavin Murray
Back to top
View user's profile Send private message
sdjl
Moderator


Joined: 17 Nov 2003
Posts: 820
Location: London, UK

PostPosted: Tue Jul 13, 2004 4:34 pm    Post subject: Reply with quote
It sounds like your server in general runs slowly. It could be how many sites are hosted on it that is slowing it down.

The reason the pages load slowly is because of the JS being read by the browser. This normally doesn't reflect the database, but if you have a lot of hits per day then this will obviously increase load time because of how much data needs to be written into the DB.

The optimize process makes the data storage logical. Much like a hard drive really. Windows (or whatever operating system you use) will place things in logical locations for easy referencing. As time passes, these locations will get moved about a bit and you need to "de-frag" your HDD. Essentially, optimizing the database is the same. It makes it easier for MySQL to find everything it needs.

When you optimize the user tables, it irons out the log tables. The admin one does the cache and other various admin related things.

David
_________________
-----
Free Logger Accounts | PPHlogger Manual | PM Me
Back to top
View user's profile Send private message Visit poster's website
gavinm



Joined: 17 Mar 2004
Posts: 11
Location: Nottingham UK

PostPosted: Tue Jul 13, 2004 6:00 pm    Post subject: Reply with quote
Thanks David - excellent explaination.

It just doesn't sound like that would reasonably explaination why most times the pphlogger response is "instant" but sometimes its 30 to 60 seconds? The slow down or time delay is so long that the impression is that something has "locked up", not just slowed down.

Just to be clear I have pphlogger running on a Linux / Apache web server here at our office. The web sites that it is logging are on other web servers at external hosting and ISP sites. However I do have a couple of test web sites running on the local one that's running pphlogger and they run fine. I don't think its generally a slow web server problem - its a 1.8GHz AMD Athlon with 512MB RAM machine so should be ok there.

I've got to admit that since optimising performance seems to be a step change better.

Is there any guidance on how often you should optimise? If it causes this much of a problem then everyone using pphlogger must see this problem eventually?

I set up my logger in October 2003 and everything was fine until about March 2004 when I added a new user account that logs a site that gets about 10 times more traffic than all the previous sites together. It was about a month after that when the slowwing down was first noticable. But it wasn't very progressive, one day ok, the next long delays is how it seemed to start.

Thanks again for your help.
_________________
Gavin Murray
Back to top
View user's profile Send private message
sdjl
Moderator


Joined: 17 Nov 2003
Posts: 820
Location: London, UK

PostPosted: Tue Jul 13, 2004 7:36 pm    Post subject: Reply with quote
Ah, you're logging from your office..
What speed connection to the internet does your office utilise?
It could be that the connections are slower between servers, hence the slight slow down occasionally.

There isn't any guidance really, no. I generally try to do it at least twice a week though Smile
You could feasibly setup a cronjob to run the script automatically at pre-defined points, that would save you having to do it manually.

The high hit counts will have an adverse affect on the database. It all stems back to the high input reading the database will incur.

David
_________________
-----
Free Logger Accounts | PPHlogger Manual | PM Me
Back to top
View user's profile Send private message Visit poster's website
gavinm



Joined: 17 Mar 2004
Posts: 11
Location: Nottingham UK

PostPosted: Thu Jul 15, 2004 9:57 am    Post subject: Reply with quote
Our connection is standard ADSL 512k / 256k. I appreciate that this might contribute to some slower than might otherwise be possible performance, but not the huge step change in performance that we have seen!

Anyway your Optimise suggestion seems to have had the desired effect so far. Since Optimising we've not noticed the problem. I'll monitor the situation and see how long it takes to re-occur and then see if Optimise fixes it again.

How big is your database and how many hits per day / week do you get to have to optimise twice weekly? (Just as a rough comparison).

The sites that I'm logging vary hugely because they are sports event related. Typically across all the sites logged the are about 500 visitors per day, but around the weekend of a big event the hits (on one specific site) can rise to 4000 visitors per day - but only for about 3/4 days.

You've been a great help - thanks.
_________________
Gavin Murray
Back to top
View user's profile Send private message
sdjl
Moderator


Joined: 17 Nov 2003
Posts: 820
Location: London, UK

PostPosted: Thu Jul 15, 2004 10:52 am    Post subject: Reply with quote
My total database size is around 25megs.
I have my log limit set to start deleting after about 2000 logs. This keeps the DB to a minimal size.
The sites that i log are not as busy as your ones by the sounds of it.
I log a couple of hotel websites and these can bring in from 200 - 1000 hits a day, but it does vary a lot!

By the sounds of it, optimizing has improved your running speed.
Keep an eye on that and see if it helps next time it starts to slow down, that's if it slows down again Smile

David
_________________
-----
Free Logger Accounts | PPHlogger Manual | PM Me
Back to top
View user's profile Send private message Visit poster's website
gavinm



Joined: 17 Mar 2004
Posts: 11
Location: Nottingham UK

PostPosted: Thu Jul 15, 2004 12:15 pm    Post subject: Reply with quote
Thanks - fantastic help.
_________________
Gavin Murray
Back to top
View user's profile Send private message
V@no



Joined: 15 Nov 2003
Posts: 156

PostPosted: Wed Jul 28, 2004 11:19 pm    Post subject: Reply with quote
sdjl wrote:
My total database size is around 25megs.
I have my log limit set to start deleting after about 2000 logs. This keeps the DB to a minimal size.
when it deletes the logs, what does it affect the number of visitors/page impressions in the calendar screen? for the statistic purpose I'd like to keep that info...Smile
_________________
Back to top
View user's profile Send private message Visit poster's website
lynxx



Joined: 14 Sep 2004
Posts: 2

PostPosted: Tue Sep 14, 2004 1:44 am    Post subject: Reply with quote
Hello ;-)

I experience the same issues as gavinm, also after march 2004 pageloads started to increase to 2-3 seconds.
When I disable the .js include it's as fast as it was. I perfectly understand the concept that a .js include requires client time, but it's not the issue.
When I strip out the document.writes from the .js the pageloading is brilliant again.

After reading this thread I ran both optimize options plus exectued an optimize on the whole database - still performance is the same.
Overall size is 16MB, it was 12MB back in december (compared to an update).

It occurs to me the problem isn't just the server or the big database, but by the time I enountered the slowdowns I also upgraded to pphlogger 2.2.5, php 4.3.6 (now it's 4.2.8) and mysql 4.0.20.

I hope we can give new activity to this thread ;-)


best,
Lynxx

edit: disabled smilies - can't stand them heh
_________________
Lynxx
Console++ http://72dpi.console.cc/
Back to top
View user's profile Send private message
lynxx



Joined: 14 Sep 2004
Posts: 2

PostPosted: Wed Sep 15, 2004 7:48 pm    Post subject: Reply with quote
Hiyaz,

I spent some time today and analysed why the pageloading took so long.
Finally I found the very 2 lines which causes the slowdown on my system:

Code:
/pphlogger.php [v2.5.5] line 58-59

$hostname = ($ip) ? ($ip) : '';
$proxy_hostname = ($proxy_ip) ? ($proxy_ip) : '';


Solution 1:
For those who don't need reverse lookups this is a major speed boost:

Code:
/pphlogger.php [v2.5.5] line 58-61

$hostname = '';
$proxy_hostname = '';
// $hostname = ($ip) ? ($ip) : '';
// $proxy_hostname = ($proxy_ip) ? ($proxy_ip) : '';


Solution 2:
For those who want to keep lookups but experience a laggy behaviour might want to replace the getHostByAddr().

Note: This comes from some comment at the PHP Manual on getHostByAddr (-> http://at.php.net/gethostbyaddr). I never tested it on a Win32 machine nor other linux systems than mine - but - it works like a charm here.

Quote:
gethostbyaddr() tends to lag on various systems for whatever reason. Here are two functions that should prove their worth speedwise.

// For Linux...

function gethost ($ip) {
$host = `host $ip`;
return (($host ? end ( explode (' ', $host)) : $ip));
}

// For Win32...

function nslookup ($ip) {
$host = split('Name:',`nslookup $ip`);
return ( trim (isset($host[1]) ? str_replace ("\n".'Address: '.$ip, '', $host[1]) : $ip));
}
?>

Pretty basic, but it should get the job done.



Code:
/pphlogger.php [v2.5.5] line 58-65

// $hostname = ($ip) ? ($ip) : '';
// $proxy_hostname = ($proxy_ip) ? ($proxy_ip) : '';
function gethost ($ip) { // linux only!
 $host = `host $ip`;
 return (($host ? end ( explode (' ', $host)) : $ip));
}
$hostname       = ($ip)       ? ($ip)       : '';
$proxy_hostname = ($proxy_ip) ? ($proxy_ip) : '';



For PPHLogger v3 I think it could be neat the put the lookup into the admin interface or some cronjob. For me the issue is fixed and I felt I wanna share it. Maybe someone else gains some benefit from it.

I'm not sure if I break some boardrules to post code here, if so please move the post into the appropriate area. Thanks ;-)

best,
Lynxx

edit: some typos
_________________
Lynxx
Console++ http://72dpi.console.cc/
Back to top
View user's profile Send private message
gavinm



Joined: 17 Mar 2004
Posts: 11
Location: Nottingham UK

PostPosted: Thu Sep 16, 2004 5:41 pm    Post subject: Reply with quote
Interesting - thanks for that. I'll look over it and try on my site the next time I notice any slow response.

I must admit that doing a monthly optimise seems to be keeping my site reasonably fast at the present.

Gavin
_________________
Gavin Murray
Back to top
View user's profile Send private message
lionel



Joined: 09 Dec 2003
Posts: 76

PostPosted: Sat Sep 25, 2004 3:15 pm    Post subject: Reply with quote
I experiencd some slowness for about a week, where the users page would load and it would then be waiting for the counter code to load, but hasn't happened again.
But, i have so many users any speed adjustments are interesting Smile
What details in the stats does the reverse lookup actually give us?

Lionel Smile
Back to top
View user's profile Send private message
Post new topic   Reply to topic    phpee.com Forum Index -> PPhlogger Support All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8
Theme design based on Team 101 Designs, modified by Philip Iezzi