Benchmarking performance

Benchmarking performance

by Martin Dougiamas -
Number of replies: 11
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
For quick benchmarking I have these lines in my test sites (including moodle.org  wink )

At the top of header.html:
   <?php $CFG->startpagetime = microtime(); ?>

Near the bottom of footer.html:
    <?php
    if (isadmin()) {
        echo "<p align=right><font size=-3>";
        echo microtime_diff($CFG->startpagetime, microtime());
        echo "</font></p>";
    }
?>


Average of ratings: -
In reply to Martin Dougiamas

Re: Benchmarking performance

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
For detailed analysis of the database, there is a new monitoring feature in ADOdb.

You can run this very easily - the following script can go in your moodle root folder:

<?php
    include_once('config.php');

    require_login();
    if (isadmin()) {
        $perf =&NewPerfMonitor($db);
        $perf->UI($pollsecs=5);
    } else {
        error("Sorry, admins only.");
    }

?>

In reply to Martin Dougiamas

Re: Benchmarking performance

by Ger Tielemans -

Nice, I put it behind a button on the administration overview page.

If I press trhe button I get this screen. Great, what does it mean?

Attachment screen.png
In reply to Ger Tielemans

Re: Benchmarking performance

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
All of your database tables are of type MyISAM, so you can ignore the other types.  99.688% cache hit ratio is excellent!
In reply to Martin Dougiamas

Re: Benchmarking performance

by Ger Tielemans -

Thanks, I will sent your compliments to my Linux administrator.

We have sometimes problems with the clock, for example when a teachers creates a quizz with a time window and the clock is not in synch with real life: would be nice to have a date & timechecker in the administration-menu, to check now and then.

(A date/time checker AND resetter is asking to much?)

I now use these two open sources for clock and date, each behind a button,

  • but I am not sure if they are looking at the right place
  • it is not language independant 
In reply to Martin Dougiamas

Re: Benchmarking performance

by Kam Vento -
Am I missing something. I cut and pasted the code into a standard html doc named bench.php and placed it in the moodle root. Got the following error: Fatal error: Call to undefined function: login()

Suspect it doesn't find the include file "config.php" This Moodle lives on the ISP website. Any hints are always appreciated. I think my slow performance issues might be with the mysql database and I sure would like to benchmark it.

Thanks
In reply to Kam Vento

Re: Benchmarking performance

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I agree your config.php line is probably not right.

I've put this into the main distribution now, as cvs:/moodle/admin/dbperformance.php, so try that.
In reply to Martin Dougiamas

Re: Benchmarking performance

by Kam Vento -
Martin
Thanks for the incredibly fast responsesmileapprove

Your new script works like a charm, I've attached a capture of the results. Doesn't look like I can blame MySql for the problem. Although I still suspicious of the database because it sometimes takes a long time to login or logout.
Attachment bench.jpg
In reply to Martin Dougiamas

Re: Benchmarking performance

by Kam Vento -

Can we modify the above code with an sprintf() to show a friendly time. I'm afraid I don't know how to calculate this number: 1069347663.7799

In reply to Kam Vento

Re: Benchmarking performance

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The resulting time should already be in seconds ... this page took 0.731284 seconds.
In reply to Kam Vento

Re: Benchmarking performance

by Ger Tielemans -

Maybe You forgot to place in header.html of your styleset:

 <?php $CFG->startpagetime = microtime(); ?>

In reply to Ger Tielemans

Re: Benchmarking performance

by Kam Vento -
I did forget, kinda of like customs, one needs to declare their valuables, in code one must  declare their variables. Thanks for the comment, its working like it should (even though its running on a Windows Server)smile