PDA

View Full Version : Miscellaneous Hacks - AP Lightweight Performance Statistics


AusPhotography
05-19-2011, 10:00 PM
This is a very lightweight hack that adds basic page performance statistics to each page display.

It only displays for Moderators and Admins, as we don't want the unwashed masses ;) to see this information.

Installation: Install the product file from AdminCP

Displays as the last line of the page: Uptime: 13 Days 0:58:17 MySQL Uptime: 0 Days 14:30:11 Page generated in 0.56116 seconds with 31 queries [Server Load Averages (1:5:15) 3.67 : 4.31 : 3.89]

I have this running on vB4.1.3 but it should run on any vB4.0.0 and up.

There are 3.x hacks like this that do more, the trade off being this is very low impact.

2.0.1 Removed can_moderate and added AdminCP option that allows you to set the user-groups that can see the statistics
2.0.2 Added uptime (Linux only)
2.0.3 Phrased and fixed to handle no available uptime in Linux
2.0.4 Added options MySQL uptime - optional - requires MySQL 5.1.12 or higher - off by default - adds one query per page if turned on
2.0.7 Minor updates as implemented on my site

Enjoy!

Kym

AusPhotography
05-20-2011, 12:10 AM
Here is a screen shot...

129287

AdminCP options: (2.0.4)

130250

lapiervb
05-20-2011, 12:53 AM
Do you have a demo or pics?

AusPhotography
05-20-2011, 01:08 AM
I posted a screen shot in post 1 :D

ozzy47
05-20-2011, 01:30 AM
Where is it coded to only show to Admin and Moderators?

Never mind I found it, if (can_moderate())

So this code is marked Re - Usable, can I take the code and add it to another mod I have on my forum, to display there instead?

AusPhotography
05-20-2011, 01:51 AM
can_moderate is the condition. ;)

You can take it and change as you need.

ozzy47
05-20-2011, 01:57 AM
Thank you sir, excellent codding btw.

Boofo
05-20-2011, 01:58 AM
can_moderate adds a query, you do know that, right?

AusPhotography
05-20-2011, 02:31 AM
can_moderate adds a query, you do know that, right?

Fixed, thanks!

Sayid
05-20-2011, 07:09 AM
nice mod, tagged

djilou
05-20-2011, 01:15 PM
WTF in CMS home I see :
Page generated in 1.03960 seconds with 1738 queries [Server Load Averages (1:5:15)

1738 queries :eek::eek:

BadgerDog
05-20-2011, 01:25 PM
Works great ... thank you ... :up:

I've always wondered about what the math numbers of the Server Load Averages mean.

Does anyone have a simple definition?

Regards,
Doug

doctorsexy
05-20-2011, 02:04 PM
cms home i get this
Page generated in 0.55868 seconds with 82 queries [Server Load Averages (1:5:15) 2.86 : 3.18 : 2.91]

Working ..smashin...thanks

AusPhotography
05-21-2011, 12:06 AM
Load averages here http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages

They are 1, 5 and 15 minutes loads. The meaning of the numbers are very dependant on the number of cores (CPUs).
Very simplistically - If you're running 2 x quad core then anything under 8 is ok.

AusPhotography
05-21-2011, 12:09 AM
WTF in CMS home I see :
Page generated in 1.03960 seconds with 1738 queries [Server Load Averages (1:5:15)

1738 queries :eek::eek:

What OS are you running?

BadgerDog
05-21-2011, 09:18 AM
Load averages here http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages

They are 1, 5 and 15 minutes loads. The meaning of the numbers are very dependant on the number of cores (CPUs).
Very simplistically - If you're running 2 x quad core then anything under 8 is ok.

Thanks ... :up:

Regards,
Doug

COL NIL SATIS
05-21-2011, 10:44 AM
tagged!!!! looks ace this does

djilou
05-21-2011, 10:45 AM
What OS are you running?

CentOs 5

COL NIL SATIS
05-21-2011, 10:55 AM
Installed

Page generated in 0.71467 seconds with 57 queries [Server Load Averages (1:5:15) 0.65 : 0.81 : 0.73]

works ace too !!!

Alan_SP
05-22-2011, 12:41 AM
Is there a guide how many queries are normal for Forum, CMS, Blog? Or at least average.

For me first load of CMS was about 250, Forum index is 24-25. CMS reloaded is 170-200.

AusPhotography
05-22-2011, 07:52 AM
We are forum only,I have no idea what is normal for CMS

But hundreds seems high, i.e. I reckon some tuning by vB.com is needed for future versions

Boofo
05-22-2011, 08:38 AM
We are forum only,I have no idea what is normal for CMS

But hundreds seems high, i.e. I reckon some tuning by vB.com is needed for future versions

That has been the norm for the CMS for a while now, IIRC. They need to do some work on that.

sisterhood
05-22-2011, 08:57 AM
extra nice thx you

MarceloS
05-24-2011, 06:41 PM
It shows on my site but not the averages. It stops at "(1:5:15)"

Is it an error?

Boofo
05-24-2011, 06:55 PM
snoopytas, when are you going to add the server uptime to this? ;)

AusPhotography
05-25-2011, 08:48 AM
snoopytas, when are you going to add the server uptime to this? ;)

Just for you mate!! (Aussie accent)

Kym

Boofo
05-25-2011, 10:20 AM
You are da man! ;)

doctorsexy
05-25-2011, 06:47 PM
is it possible to have it a different colour..
what is it under in the stylevars....

AusPhotography
05-26-2011, 12:00 AM
is it possible to have it a different colour..
what is it under in the stylevars....

I'll look into it and come up with something next week

Alan_SP
05-26-2011, 02:38 AM
Could you phrase output of mod?

MarceloS
06-01-2011, 10:32 PM
It shows on my site but not the averages. It stops at "(1:5:15)"

Is it an error?

Can anyone help me on this?

My server is LINUX. Latest version of the mod.

My board shows:
"Page generated in 0.12074 seconds with 20 queries [Server Load Averages (1:5:15)"

AusPhotography
06-01-2011, 11:33 PM
@MarceloS You will need to see if either of the two methods are active for the Apache account.

I.e.
1. Can the file /proc/loadavg be accessed by the Apache account?
-or-
2. Does uptime run?

If neither work, then its a Linux permissions/shell problem.

If you are running security enhanced linux then you may need to adjust the security profile.

Kym

EasyEazy
06-01-2011, 11:37 PM
Installed on 4.1.1 and working great.

Thanks

AusPhotography
06-02-2011, 03:45 AM
is it possible to have it a different colour..
what is it under in the stylevars....

Could you phrase output of mod?

I've phrased it so you can more easily change the words and/or colours etc.
It uses the default colours per class="smallfont" at the footer.

Alan_SP
06-03-2011, 01:54 AM
Thank you! :up:

MarceloS
06-03-2011, 10:58 AM
@MarceloS You will need to see if either of the two methods are active for the Apache account.

I.e.
1. Can the file /proc/loadavg be accessed by the Apache account?
-or-
2. Does uptime run?

If neither work, then its a Linux permissions/shell problem.

If you are running security enhanced linux then you may need to adjust the security profile.

Kym

1. Support says that "The file "/proc/loadavg" is under the ownership of root. So Apache user cannot access it." They say that it can't be changed.

2. Uptime not working. After the update, I get only this: "Page generated in 0.10525 seconds with 19 queries"

AusPhotography
06-08-2011, 09:24 AM
@MarceloS, it seems your hosting provider has more limits than mine. Not much i can do about that.

AusPhotography
06-21-2011, 06:33 AM
Updated !

It now optionally shows the MySQL uptime.
This adds one query per page, is off by default, and needs MySQL 5.1.12 or higher

RedDevil
06-21-2011, 04:21 PM
Added seems to work fine on VB 4.1.3 and 4.1.4, maybe add colour change in settings rather than edit phrases.

Nice addon

AusPhotography
06-22-2011, 07:16 AM
The colour is not something I want as this mod is intended to be light, fast and only for site staff.
It's not really intended for all your forum members as it really aimed at performance monitoring.

M.C.
01-18-2015, 09:35 AM
sorry any idea why I don't see server load details? all I see is "Page generated in 0.14538 seconds with 16 queries"
thanks

AusPhotography
01-19-2015, 09:13 PM
sorry any idea why I don't see server load details? all I see is "Page generated in 0.14538 seconds with 16 queries"
thanks

What operating system is your system running on?

The load details presume that your have read access to /proc/loadavg or the uptime command (usually on Linux)