Ever wondered how you YaBB performs, i.e. how fast the pages are created of the day?
Here's an idea I came across some time ago. You can easily monitor you YaBB using MRTG. It can generate nice graphs that show you the load time of your YaBB over days/weeks/month/years.
Examples Monitoring a YaBB boardindex load time (note that for example "20k" on the y-axis means "20 seconds" needed to generate boardindex) :
This is a very bad performing YaBB on a crappy shared hosting...
This is a very well performing YaBB on a dedicated server (execpt the few spikes, the load time is always around 0.2 seconds, i.e. 200 milliseconds in the graph)
Here's a small tutorial to setup MRTG to generate such graphs.
Requirements- Shell access on a server (not necessarily the server you're running your board on)
- YaBB 1.5+
Install and test MRTGGet MRTG from
http://people.ee.ethz.ch/~oetiker/webtools/mrtg/ and install it. Instructions for Unix/Windows are available on their website.
Test you installation to be sure MRTG is working properly and add a cron entry to execute MRTG every 5 minutes.
Configure YaBBGo to your Admin Center -> Installed 'Mods' Settings and Options -> Activate "Display time taken to create every page" -> Save settings
Now check that "Page created in ?? seconds" appears at the bottom of every YaBB page.
Create the monitor scriptOn the shell, go to the directory where you installed MRTG (for example "cd /usr/local/mrtg-2") and create a new file called "yabb.pl" with the following content:
#!/usr/bin/perl
@res = `lynx -cache=0 -source -dump http://www.yourdomain.com/yabbse/index.php| tail -n 3`;
foreach $res (@res) {
if ($res =~ /created in (.*) seconds/) { $time = $1; last } else { next }
}
$time=int($time*1000);
print "$time\n";
print "$time";
Be sure to use the correct quotes in the @res = ... line (not ", nor ', but `)!
Replace
http://www.yourdomain.com/yabbse/index.php
in this code with the URL to your main page. You can also monitor a different page, of course.
Now make sure that
yabb.pl can be executed by typing
chmod 755 yabb.pl
on the shell.
Test the script with
perl yabb.pl
It shoud output something like this:
211
211root: /url/local/mrtg-2#
(The time taken to generate the page in milliseconds, two times)
Configure MRTGEdit your MRTG config file mrtg.conf (can be found whereever you created it using the cfgmaker while installing MRTG).
Add the following section to your mrtg.conf:
Target[yabb]: `/path/to/yabb.pl`
Options[yabb]: growright, gauge, noo, nobanner, nopercent, noinfo
MaxBytes[yabb]: 120000
Title[yabb]: My YaBB performance
YLegend[yabb]: msecs
ShortLegend[yabb]: msecs
Again, be sure to use the correct quotes (not ", nor ', but `)!
You can change the MaxBytes to a higher value if you board takes a lot of time to load. All values higher that MaxBytes will be clipped. Note that that value is in milliseconds (seconds*1000)!
Test your setupExecute mrtg manually at least 3 times:
mrtg /path/to/mrtg.conf
The first two to three times MRTG will complain about missing log files, you can ignore that. No other errors should occure.
Now wait some time and let MRTG gather some data. A HTML file called "yabb.html" will be created in your MRTG workdir.
If that all went fine, you can include the daily/weekly graph in your Admin Center if you like.
Please note:
- The scaling of thy y-axis in the MRTG graph will convert any number higher that 1000 to 1k (1 kilo, with 1k= 1000). As we are measurng the time in milliseconds this means that a value of 10k is equal to 10 seconds.
- As MRTG is executed only every 5 minutes (default) the graph will NOT show you what's happening in between this 5 minute update interval! It should be enough to get an overview how you YaBB performs, though.
- You can monitor other pages that the BoardIndex, of course, but do not monitor a thread as the view count of the thread will be incremented by MRTG! I'd recommend monitoring either the BoardIndex or the Recent Posts page.
Possible problems:
- If you dont have lynx installed on your system, you can also use w3m. Change
@res = `lynx -cache=0 -source -dump http://www.yourdomain.com/yabbse/index.php| tail -n 3`;
in your yabb.pl to
@res = `w3m -dump http://www.yourdomain.com/yabbse/index.php| tail -n 3`;
- The script requires that the "Page created in" string is found within the last 3 lines of your HTML page. If that's different in your case, you can either increase the lines parsed by increasing the number after the "-n" in the above quoted yabb.pl line or remove the "| tail -n 3" from that line (actually it's only a small performance tuning).
- Your running Windows... -> Install Linux
That's all
If you have any problems, ask
Chris
AddendumYou can "stress test" you YaBB using
ab or any other webserver stress tool. If you do that, set the time to stress test you YaBB to a higher value that your MRTG update interval so that MRTG is executes while your YaBB is stress tested.