vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   vbMicroStats: page load time, queries, GZIP and PHP version (https://vborg.vbsupport.ru/showthread.php?t=35811)

neocorteqz 04-21-2003 07:11 AM

Quote:

Today at 01:38 AM Sanjiyan said this in Post #800
Using the 2.3.0 version, and installed on 2.3.0 fine, apart from I get this:

Page generated in 1,050,903,363.6694 seconds (100.00% PHP - 0.00% MySQL) with 24 queries.
[Debug Mode OFF] [PHP v4.3.1] [GZIP enabled - level 2]

How do I change the Page generated in x.xxxxxxxx down to 1.234 seconds

And

It seems I have 100% PHP Load and 0% MySQL ??

Its running on a Windows XP Box atm.


change this value

// time format (how many digits you want to show)
$digits=8;

to anything you want, it's located in admin/functions
about 8 lines from

// ###################### Start dooutput #######################


as for the 100% PHP, rehack db_mysql.php, i believe thats the file..


I also have noticed you have your gzip level at 2, i was lead to believe then anything over a 1, wouldn't be any better. and would create more load. anyone else know if this is true??
https://vborg.vbsupport.ru/showthrea...ression+levels

ap0c 04-21-2003 10:08 AM

Quote:

Yesterday at 10:49 PM TECK said this in Post #798
76 queries??? This is huge, I hope you own the server because if it's a busy site, it will crash it.
I had to do some work:), the 76 queries came from the portal home page. It's down to Page generated in 0.16658294 seconds (83.29% PHP - 16.71% MySQL) with 55 queries, 44 queries for normal members.

the forum home page itself is now at 25 queries which seems about as good as I can get it.

Sanjiyan 04-21-2003 03:03 PM

Quote:

Today at 08:11 AM User_001 said this in Post #801
change this value

// time format (how many digits you want to show)
$digits=8;

to anything you want, it's located in admin/functions
about 8 lines from

// ###################### Start dooutput #######################


as for the 100% PHP, rehack db_mysql.php, i believe thats the file..


I also have noticed you have your gzip level at 2, i was lead to believe then anything over a 1, wouldn't be any better. and would create more load. anyone else know if this is true??
https://vborg.vbsupport.ru/showthrea...ression+levels


I did this for the $digit:

PHP Code:

  // time format
  
$digits=4;
  
$totaltime $endtime[0] - $starttime[0] + $endtime[1] - $starttime[1];
  
$trimmedtime number_format$totaltime $digits );
  
$percentphp number_format( ( ( ( $totaltime $querytime ) / $totaltime ) * 100 ) , ) . '% PHP';
  
$percentsql number_format( ( ( $querytime $totaltime ) * 100 ) , ) . '% MySQL'

And its still doing like 12 digitis long, and rehack the db_ file? I followed the install file right, I triple checked, after reading the thread, but its still doing it, I used the 2.3.0 verison of the hack, as I have a 2.3.0 board, or should I apply the older version?

neocorteqz 04-21-2003 04:42 PM

Quote:

Today at 11:03 AM Sanjiyan said this in Post #803
I did this for the $digit:

PHP Code:

  // time format
  
$digits=4;
  
$totaltime $endtime[0] - $starttime[0] + $endtime[1] - $starttime[1];
  
$trimmedtime number_format$totaltime $digits );
  
$percentphp number_format( ( ( ( $totaltime $querytime ) / $totaltime ) * 100 ) , ) . '% PHP';
  
$percentsql number_format( ( ( $querytime $totaltime ) * 100 ) , ) . '% MySQL'

And its still doing like 12 digitis long, and rehack the db_ file? I followed the install file right, I triple checked, after reading the thread, but its still doing it, I used the 2.3.0 verison of the hack, as I have a 2.3.0 board, or should I apply the older version?

The original instructions Work Great for me. No problems

and

Page generated in 0.1956 seconds (76.11% PHP - 23.89% MySQL) with 30 queries.

don't know why your didn't work... :confused:

Sanjiyan 04-21-2003 05:35 PM

could it be that I am running it under Apache 2 and Windows XP Pro?

TECK 04-22-2003 06:59 PM

Quote:

Yesterday at 06:38 AM Sanjiyan said this in Post #800
Using the 2.3.0 version, and installed on 2.3.0 fine, apart from I get this:

Page generated in 1,050,903,363.6694 seconds (100.00% PHP - 0.00% MySQL) with 24 queries.
[Debug Mode OFF] [PHP v4.3.1] [GZIP enabled - level 2]

How do I change the Page generated in x.xxxxxxxx down to 1.234 seconds

And

It seems I have 100% PHP Load and 0% MySQL ??

Its running on a Windows XP Box atm.

You did not hacked properly the db_mysql.php file.

Sanjiyan 04-23-2003 02:46 PM

TECH,

I've just reapllied the hack and it still displays 100% for PHP and 0% for MySQL.

I have attached the db_mysql.php file below, if I could borrow some of your time, in looking through the file, just to be sure I would be greatful.

Thanks

Red Blaze 04-23-2003 05:30 PM

Ok, I got this error.

Parse error: parse error, unexpected $ in /home/thesonic/public_html/vbtesting/admin/functions.php on line 1101

I went to line 1101 and couldn't find that "$".

EDIT: Nevermind, it got fixed on its own. :S

solent 04-24-2003 01:38 PM

help please

i have installed this hack and i get no errors at all. the problem is that i dont know the exact place to place this stats. and in some of the variables i get no value (see atach file).

can anyone point to me in which templates i need to edit to show the microstats at the bottom of every page as in vb.org?

also is the result shown in the attachment correct or i am doing something wrong with it?

I am using the template based version on vb2.3.0.


Thanks.

greate hack by the way. i love it. :D :D

Red Blaze 04-24-2003 04:54 PM

You have to place the variable into your footer. Preferably towards the bottom. Read the instructions, it tells you what variable to put.

solent 04-24-2003 04:56 PM

Quote:

Today at 07:54 PM Sonikku said this in Post #810
You have to place the variable into your footer. Preferably towards the bottom. Read the instructions, it tells you what variable to put.
To call your vbMicroStats, simply place the string {getmicrostats}
| anywhere you want in your templates (for example in footer).
|
| NOTE: The higher you place the string in your templates,
| the more inacurate your data will be.
|
| The variables you can use are:
|
| $digits - number of digits for microtime
| $trimmedtime - the time your page is loaded
| $query_count - number of queries executed
| $debugmode - tells if VB is in debug mode
| $versionphp - PHP version
| $percentphp - PHP percent page usage
| $percentsql - MySQL percent page usage
| $gziptext - GZIP compression library
| $gziplevel - GZIP compression level
| $serverload - your average server load

those are the final steps but which variable are you talking about?

maybe you mean the string?

have a look here the site is still not in production
http://www.depfacy.com/forums/showth...=12&forumid=39

well i have tried both by parsing the string and using the template and by inputing the whole thing in the footer template.
here is my footer just to tell me what is wrong.
PHP Code:

</td>
</
tr>
</
table>
<!-- /
content area table -->
</
center>
<
TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<
TR>
<
TD><a href="#top"><IMG SRC="{imagesfolder}/footer_01.gif" WIDTH=168 HEIGHT=69 border="0"></a></TD>
<
TD background="{imagesfolder}/footer_02.gif" width="100%" height="69"></TD>
<
TD><a href="http://www.vbforumskins.com" target="_blank"><IMG SRC="{imagesfolder}/footer_03.gif" WIDTH=530 HEIGHT=69 border="0"></a></TD>
</
TR>
<
br><center>Page generated in $trimmedtime seconds ($percentphp $percentsqlwith $query_count queries.$adminstats<center>
</
TABLE>
</
td></tr>
</
table>
</
center

is there any possibility that the page loads very fast that no time of % php and sql are recorded?
This is a dedicated machine of 800MHz and 768MB RAM and 10K rpm SCSI drivers and doesnt do anything else but hosting this board which is currently not used.

Also why can i not see the adminstats ?

TECK 04-24-2003 06:55 PM

Search the thread for answers. Those questions were asked (and answered) several times by many other users.

Red Blaze 04-24-2003 07:14 PM

Sorry TECK, but I'll answer it anyway, some people could be too lazy to search through a 55 page thread. *raises hand* =j

Dude, Just add {getmicrostats} anywhere in your footer Preferably after </table> since there is nothing after it. If you did everything right, {getmicrostats} should call everything that's needed.

solent 04-24-2003 07:34 PM

Quote:

Today at 10:14 PM Sonikku said this in Post #813
Sorry TECK, but I'll answer it anyway, some people could be too lazy to search through a 55 page thread. *raises hand* =j

Dude, Just add {getmicrostats} anywhere in your footer Preferably after </table> since there is nothing after it. If you did everything right, {getmicrostats} should call everything that's needed.


i aint lazy just missed the replacment thingy.

and what you said sonikku is not the solutions as that is the first thing i did.

well here are my results dunno if they are good but from what i have read over 100 queries i can be in trouble

forumhome
------------------------------
Page generated in 0.16079295 seconds (65.76% PHP - 34.24% MySQL) with 62 queries.
[Debug Mode OFF] [PHP v4.3.1] [GZIP enabled - level 1] [Server Load: 0.00 ? 0.03 : 0.00]


vbPortal Home
------------------------------
Page generated in 0.18081701 seconds (54.13% PHP - 45.87% MySQL) with 107 queries.
[Debug Mode OFF] [PHP v4.3.1] [GZIP enabled - level 1] [Server Load: 0.00 ? 0.03 : 0.00]

Red Blaze 04-24-2003 10:57 PM

107 Queries?! o.O;;; Daaaaaaamn! Is that natural? Anyway, if that's what you have, then I suppose you're ok. Check out what I have.

Tell, how many hacks do you have installed? And did you add alot of stuff in the head, and the php include?

Sanjiyan 04-24-2003 11:01 PM

bump for post:

https://vborg.vbsupport.ru/showthrea...954#post385954

TECK 04-24-2003 11:20 PM

Sanjiyan, search the thread (use the search option at the bottom of this page). Is your db_mysql.php file that does this. So check that file, there is your prob, not the hack.

solent, please tell me you don't have a busy site, orelse you will have your server account canceled with 107queries on ONE page.
107queries is EXTREMLY high, a total killer for the server.

solent 04-25-2003 07:19 AM

Quote:

solent, please tell me you don't have a busy site, orelse you will have your server account canceled with 107queries on ONE page.
107queries is EXTREMLY high, a total killer for the server.
TECK the server is mine and it will be hosted for free in an ISP as they will be our SPONSORS :D :D :D

the server is a 1 800MHZ CPU with 2 cpus cabable, 768MB of SDRAM PC100 and a 7.2K rpm SCSI Drive.

i am running vbportal www.vbportal.com together with vbulletin and maybe that is the reason. vbportal is the beggiset hack made for vbulletin. maybe that is why i am getting all that queries. the server will be probably have 100 concurrent users at the tops.

Sanjiyan 04-25-2003 07:39 AM

Thanks TECK problems solved, and its working now.

I was having the same problem as in this post:
https://vborg.vbsupport.ru/showthrea...047#post332047

TECK 04-26-2003 03:44 PM

Quote:

Yesterday at 09:19 AM solent said this in Post #818
TECK the server is mine and it will be hosted for free in an ISP as they will be our SPONSORS :D :D :D

the server is a 1 800MHZ CPU with 2 cpus cabable, 768MB of SDRAM PC100 and a 7.2K rpm SCSI Drive.

i am running vbportal www.vbportal.com together with vbulletin and maybe that is the reason. vbportal is the beggiset hack made for vbulletin. maybe that is why i am getting all that queries. the server will be probably have 100 concurrent users at the tops.

Still, you should direct yourself to scripts that use less then 25queries. A script that uses 100queries is really bad written.

solent 04-26-2003 04:15 PM

ok that sounds resonable enought TECK i will rebuild my board from scratch and this time i will be more carefull on installing hacks.

thanks

SiGmA_X 04-27-2003 04:57 PM

First off, I love this hack, really great; thank you :)

Now, I have a few comments.. Perhaps they have been covered, but I don't want to read through all of the many posts in this thread..

How does vBulletin figure out how many queries were executed? I am trying to write a script for my main site, but this is stumping me...

vbMicroStats uses @exec("uptime") to figure out the load. The problem is, many professional servers disallow the httpd/www-data user (Might be called something else, but it's the one that Apache spawns under) from executing things such as system() or exec() for obvious security reasons, you would have near-root permissions. On my server, this is the case. Here's what I came up with the get around it; Perhaps not as clean as yours, but it works :)

File: FORUM/admin/functions.php
PHP Code:

if ($stats=@exec('uptime')) {
  
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
  
$serverload=' [Server Load: <font color="{ hovercolor}"><b>'.$regs[1].'</b></font> " '.$regs[2].' : '.$regs[3].']';
} else {
  
$serverload='';


My Fix:
PHP Code:

if ( $stats = @fopen('/proc/loadavg''r') ) {
  if (
$fd fopen('/proc/loadavg''r')) {
    
$load split(' 'fgets($fd4096));
    
fclose($fd);
  } else
    
$load = array('N.A.','N.A.','N.A.');
  
$serverload ' [Server Load: <font color="{ hovercolor}"><b>';
  
$serverload .= $load[0] . '</b></font> " ' $load[1] . ' : ' $load[2] . ']';


For me, this has worked flawlessly. The only thing that I can think to go wrong would be the loadavg file not being in /proc/loadavg, but on most (If not all) UNIX/Linux systems, it is there.

TECK 05-05-2003 11:50 PM

If I'm correct, that won't work in safe mode...

Hobbes 05-06-2003 04:08 AM

I cant get them to show up......

Hobbes 05-06-2003 04:17 AM

ok, my new attach wouldn't show....

N9ne 05-07-2003 08:30 PM

For those having trouble with the functions.php replacement on 2.3.0 Final, replace your entire dovars section with the following code [it works] (NOTE!: this is for an unhacked vB! If you have modified this section at all with other hacks, don't use this!)

PHP Code:

// ###################### Start dovars #######################
function dovars($newtext$sendheader 1)
{
    
// parses replacement vars

    
global $PHP_SELF$DB_site$replacementsetid$gzipoutput$gziplevel$newpmmsg$microstats;
    static 
$vars;

    if (
connection_status())
    {
        exit;
    }

    if (!
is_array($vars))
    {
        
// build an array of $vars containing find/replace values
        
$vars = array();
        
$replacements $DB_site->query("
            SELECT findword, replaceword, replacementsetid
            FROM replacement
            WHERE replacementsetid IN(-1, '" 
intval($replacementsetid) . "')
            ORDER BY replacementsetid, replacementid DESC
        "
);
        while (
$replacement $DB_site->fetch_array($replacements))
        {
            if (
$replacement['findword'] != '')
            {
                
$vars["$replacement[findword]"] = $replacement['replaceword'];
            }
        }
        unset(
$replacement);
        
$DB_site->free_result($replacements);
    }

    
$newtext str_replace'{getmicrostats}' $microstats $newtext );

    if (
PHPVERSION '4.0.5' or 1)
    {
        
// do each replacement in turn for PHP < 4.0.5
        
reset($vars);
        while(list(
$find$replace) = each($vars))
        {
            
$newtext str_replace($find$replace$newtext);
        }
    }
    else
    {
        
// do all replacements in one go (PHP >= 4.0.5 only)
        
$newtext str_replace(array_keys($vars), $vars$newtext);
    }

    if (
$newpmmsg)
    {
        if (
substr($PHP_SELF,-strlen('private.php')) == 'private.php')
        {
            
// do nothing
        
}
        else
        {
            
$newtext preg_replace("/<body/i""<body onload=\"Javascript:confirm_newpm()\""$newtext);
        }
    }

    if (
$gzipoutput and !headers_sent())
    {
        
$newtext gzipoutput($newtext$gziplevel);
    }

    if (
$sendheader)
    {
        @
header("Content-Length: " strlen($newtext));
    }

    return 
$newtext;



ogden2k 05-07-2003 11:19 PM

Page generated in 0.09366798 seconds (71.57% PHP - 28.43% MySQL) with 21 queries.

Does that sound accurate? Which is better, more php then mysql or the other way around?

Lethal 05-08-2003 09:11 AM

that looks just fine

Lethal 05-08-2003 09:19 AM

ok so the reason my serverload is not showing is possibly because my server doesn't allow the @exec("uptime") to be used, at least thats what I have read. If i ask them will they allow it, because I really would like to know what my server load is. Any suggestions on how to get around it?

Zxin 05-14-2003 08:05 AM

If you have a problem look at the part of the instructions that say
Template: home_microstats

Do NOT create a new template called home_microstats

*DO* create a template called microstats

and bing, your {getmicrostats} will show up!

vB-Host.com 05-18-2003 10:13 AM

WoooHooo!!! Page generated in 0.35274894 seconds (60.67% PHP - 39.33% MySQL) with 124 queries. think I need to pull a few hacks off LOL

Any way to add server uptime to the stats?

neocorteqz 05-19-2003 06:04 AM

Page generated in 0.1907 seconds (90.37% PHP - 9.63% MySQL) with 24 queries.
[Debug Mode OFF] [PHP v4.3.1] [GZIP enabled - level 1] [Server Load: 0.79 ? 0.36 : 0.24]

damn that looks good. :D

xs1 05-19-2003 08:20 AM

<p align="center"><smallfont>
<!-- Do not remove this copyright notice -->
Powered by: vBulletin Version $templateversion<br>
Copyright ©2000 - 2002, Jelsoft Enterprises Limited.<br>
<!-- Do not remove this copyright notice -->
$copyrighttext<br>
{getmicrostats}
</smallfont></p>

i dont get thing at the bottom ! wat could be wrong ?

Thx

Lethal 05-20-2003 03:19 AM

go over each step and make sure all the code is in the right spot.

xs1 05-20-2003 05:34 PM

Page generated in 0.12096798 seconds (84.99% PHP - 15.01% MySQL) with 20 queries.

is that any good ?

TECK 05-24-2003 12:54 AM

Excellent. :)

insanctus 05-24-2003 02:12 AM

Page generated in 0.25907803 seconds (69.56% PHP - 30.44% MySQL) with 23 queries.

Very cool hack ~ clicks install.

SiGmA_X 05-29-2003 12:12 AM

I love this hack :) Customized it a bit (The damned exec() security hole..;)) but it works great. Is there a way to get the Apache version and the MySQL version? Currently I have them hard coded in, but a friend suggested parsing the phpinfo() command to get the versions.. Ideas?

eoc_Jason 05-29-2003 01:03 AM

The Admin Quick Stats might be just what you are looking for. It displays MySQL version & other useful info, I'm sure you can adapt it to display at the bottom if you wanted. I actually had to mod it myself because I use the attachments hack, so it just gets the size of the directory.


Quote:

Today at 08:12 PM SiGmA_X said this in Post #838
I love this hack :) Customized it a bit (The damned exec() security hole..;)) but it works great. Is there a way to get the Apache version and the MySQL version? Currently I have them hard coded in, but a friend suggested parsing the phpinfo() command to get the versions.. Ideas?

TECK 06-04-2003 05:04 PM

If you look for something more complex:
https://vborg.vbsupport.ru/showthrea...threadid=43232

There is a fix for the attachments as files listed in the first post.


All times are GMT. The time now is 03:37 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03230 seconds
  • Memory Usage 1,904KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete