Hardware and performance

 
 
Picture of sam marshall
Performance perspectives - a little script
Group DevelopersGroup Particularly helpful MoodlersGroup Testers
Hi all.

Since I was relatively new to PHP before I started Moodle development (though with quite a lot of experience in other systems), I realised that I still don't have a solid grasp of performance issues re PHP in terms of which operations are slow and which are fast. Of course I have an intuition but it's one borne of other systems - is it still accurate?

Just for fun and because I was bored writing spec documents, I wrote a little script to check. Maybe this will also be useful background for other developers new to PHP.

Here are the results for our developer system (this is obviously using a machine and database that are less powerful than those in our real system):

In one second you can do...

  • 64000 function calls
  • 10300 16KB files read from disk (cache)
  • 4800 regular expression replaces over 1KB of text
  • 4000 16KB files written to disk (cache)
  • 570 get_record calls on the course table
  • 230 insert_record calls on the course table
  • 30 update_record calls on the course table
My intuitions were broadly, but not quite, correct.

The first thing I got slightly wrong was the CPU issue. 64,000 really isn't that many function calls for a whole second, and the regular expressions are kind of slow (it's not a complicated regular expression).

Disk access is comparably pretty quick, not surprisingly since in this test it's coming entirely from the cache. So if I really wanted to do 1KB regular expression replaces on something, and I needed to repeat the results frequently, it would be worth saving it as a file.

Database access, as expected, is dog slow (looking just at get_record for the moment). So not worth caching anything in the database unless the thing you're caching itself requires multiple database accesses to calculate, or a lot of file access or CPU time.

The last point I wouldn't necessarily have expected is update_record. Huh? Is that just our system? Why is it so appallingly slow compared to insert? Is there a mistake in my test? I could update records quicker with a pencil.

I don't know the specs of our development system, but this is using a Postgres 8.1 database which may have an effect on that update_record result. (By the way, I tried bracketing everything in begin_sql and commit_sql, because some suggested that makes a large performance difference on Postgres; but in this case it didn't seem to.)


Anyhow, maybe I'll run this on the real servers in a few weeks when there'll be a chance. If anyone else wants to run it, feel free - I've attached the script here. You need to put the script somewhere within your Moodle 1.7 install [may work in 1.6, don't know], and edit the file so that the require_once for config.php points to the right place.

If you try it, only run this on a test install. In particular the script should not be accessible by the public as it provides a possible route for a DoS attack, and also it modifies the real course table $CFG->prefix_course (hopefully undoing everything later, but still, maybe I screwed up and you lose your course table, does that sound like fun? didn't think so).

--sam
 
Average of ratings:Useful (3)
Martin in black and white
Re: Performance perspectives - a little script
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Nice test!

Results from this server (moodle.org) which uses MySQL:

In one second you can do...

  • 703000 function calls
  • 13800 16KB files read from disk (cache)
  • 8700 regular expression replaces over 1KB of text
  • 7700 16KB files written to disk (cache)
  • 4400 get_record calls on the course table
  • 450 insert_record calls on the course table
  • 250 update_record calls on the course table

 
Average of ratings: -
Picture of Pieterjan Heyse
Re: Performance perspectives - a little script
 
I really like this... Couldn't we add some system parameters ? I tried some things like adding echo system("uname -a"); echo system("cat /proc/meminfo");

This way we could compare the systems and know what parameters work and wich don't. Mayeb using some classes from the phpsysinfo package, to ease the parsing of those /proc files?

Perspective

In one second you can do...

  • 363000 function calls
  • 14600 16KB files read from disk (cache)
  • 5800 regular expression replaces over 1KB of text
  • 3400 16KB files written to disk (cache)
  • 2130 get_record calls on the course table
  • 310 insert_record calls on the course table
  • 150 update_record calls on the course table

 
Average of ratings: -
Picture of Maik Riecken
Re: Performance perspectives - a little script
 

Sounds a little like a contest...


This is my (very old) machine:
Duron 1200, 512MB Ram, Simple IDE-Bus

In one second you can do...
  • 550000 function calls
  • 12700 16KB files read from disk (cache)
  • 5300 regular expression replaces over 1KB of text
  • 2500 16KB files written to disk (cache)
  • 1010 get_record calls on the course table
  • 330 insert_record calls on the course table
  • 90 update_record calls on the course table
Not bad - moodle.org is only four to three times faster.... I've faith in fastCGI and lighttpd now.

Maik
 
Average of ratings: -
Martin in black and white
Re: Performance perspectives - a little script
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Actually, the moodle.org server was simultaneously serving normal load for several Moodle sites at that time ... wink

And the multiple CPUs wouldn't be taken into account because this script would be running in one process (moodle.org has dual dual-core cpus = 4).

But I agree apache is a massive hog ... one of the things we've been doing recently is trying to tune it more but ... ugh, so much RAM wasted ...
 
Average of ratings:Useful (1)
Picture of Maik Riecken
Re: Performance perspectives - a little script
 
I got a load of 2-3 at the moment of "benchmarking..."

One of the developers of MySQL is in my linux user group (Kristian Koehntopp, nick: isotopp). Apache is a threaded applikation and should scale very well with multiple CPU (or cores). With moodle always MySQL ist the bottleneck, PHP can be handled with caching - Kristian talks about "locking": MySQL-tables in write state have to locked to avoid inconsistency. A locked table is closed for any kind of MySQL-thread. The more CPUs you have the worse performance is, because more an more threads accessing the same table have to wait for each other and even handle their priorities. In a german forum around rootservers a case was discussed where a user increased from 4 to 16 CPU and MySQL got slower with that!

Kristian said that MySQL scales bad into height (more CPUs) but well into width (more machines/slaves). Maybe a hint for high usage machines.

At the moment my opinion is that it makes no real sense to buy the biggest machine for moodle - I use to say the people sometimes solve performance problems not by knownledge but by hardware power - a strategy which reaches limits when usage and users are increasing.

A good moodle setup has to be scalable in my opinion. This is much easier with lighttpd - but possible (and harder) with apache, too. I never could afford the three machines minimum needed for a cluster (1x Webserver / 2x MySQL) - but this would be a nice project sometime...

regards,

Maik
 
Average of ratings: -
Martin Langhoff - Sailing
Re: Performance perspectives - a little script
Group DevelopersGroup Particularly helpful Moodlers
> Apache is a threaded applikation

Actually, in terms of scalability with Moodle, your _main_ constraint on linux is memory, because you will be running Apache in prefork mode, not threaded. Of course you want to have good numbers here, but to actually serve a lot of users, you need to tune apache's maxclients, maxrequestsperchild, etc.
 
Average of ratings:Useful (1)
Picture of Stan Hoeppner
Re: Performance perspectives - a little script
 
Martin could you please expand on this threading setup for apache? Is there a reason I can't run in threaded mode insteaf of prefork? What are the pros and cons of each? And, can you give me some base line apache config settings that you use? We're running Apache 2.0, mysql 5.0 (latest rev), latest PHP4, and Moodle 1.7 on SuSE Linux Enterprise Server 10 with, AFAIK, the SuSE default settings for Apache 2, relating to threads, child processes, etc. I've done no performance tuning of the mysql settings either. Any recommendations here?

We've been having performance issues. I'm awaiting answers from our faculty as I don't know how many kids they had on at the time and if they're using chat heavily or not. It seems when we get multiple 10s of users online the server pegs CPU at 100% and the system become unresponsive. Because we're running this "machine" in VMware ESX server, I can throw 3 more 2Ghz Opterons and up to 4 GB of RAM at it if that will help.

Lemme see if I can run this test script. I'm sure our disk numbers will be great as the system boots and runs from a 200 MB/s fiber channel SAN array with 512 MB write cache and 8x500 GB 7200 RPM SATA drives in a RAID 5 pack.
 
Average of ratings: -
Picture of Iñaki Arenaza
Re: Performance perspectives - a little script
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

> Is there a reason I can't run in threaded mode insteaf of prefork?

While PHP itself if fully thread safe, some of the third party extensions and libraries are not. Unless you are 100% sure all the PHP extensions and libraries you are using are thread safe, running in prefork mode is the safe bet.

In addition to that, prefork mode or threaded mode are similar in performance under Linux given that:

  • fork()ing or clone()ing are almost the same code paths in Linux, so fork() performance is almost the same of clone() performance. This is quite different under Win32 (where process creation is way slower than thread creation).

  • copy on write (COW) techniques mean almost all of the Apache memory is shared among all of the parent/child processess, so you don't incur in a n-fold memory consumption compared to the threading model.

Saludos. Iñaki.

 
Average of ratings:Useful (2)
Picture of Samuli Karevaara
Re: Performance perspectives - a little script
Group DevelopersGroup Particularly helpful MoodlersGroup Translators
Numbers! smile Big numbers! big grin All in the name of science, of course. (All installations running MySQL.)

Windows XP box, around 3GHz, PHP 5.1.6:
* 971000 function calls
* 2200 16KB files read from disk (cache)
* 7900 regular expression replaces over 1KB of text
* 900 16KB files written to disk (cache)
* 360 get_record calls on the course table
* 500 insert_record calls on the course table
* 260 update_record calls on the course table

Same box with PHP 5.2.0RC7, notice the drop in regexps, ran this a few times, same results:
* 874000 function calls
* 4100 16KB files read from disk (cache)
* 2000 regular expression replaces over 1KB of text
* 900 16KB files written to disk (cache)
* 350 get_record calls on the course table
* 520 insert_record calls on the course table
* 240 update_record calls on the course table

A very similar machine running Linux (Ubuntu 6.04) got:

* 1001000 function calls
* 31500 16KB files read from disk (cache)
* 7400 regular expression replaces over 1KB of text
* 14900 16KB files written to disk (cache)
* 2500 get_record calls on the course table
* 1250 insert_record calls on the course table
* 210 update_record calls on the course table

Specially the disk access is much faster, which is quite important in a web server environment...
 
Average of ratings:Useful (1)
Picture of Rodrigo Velazquez
Re: Performance perspectives - a little script
 

With a dedicated server

· Server: Dell PowerEdge 1750
· Processor: 1 x Intel Xeon processor, 2.4 GHz
· Storage: 2 x 18 GB SCSI Hard Drives
· Memory: 1 GB
· Operating System: RedHat 7.3

And we have problems whith about 50 users online

Perspective

In one second you can do...

  • 639000 function calls
  • 6700 regular expression replaces over 1KB of text
  • 1520 get_record calls on the course table
  • 290 insert_record calls on the course table
  • 300 update_record calls on the course table
  • Linux 2.4.33.2 #4 SMP Wed Aug 23 10:41:21 EDT 2006 i686 unknown total: used: free: shared: buffers: cached: Mem: 1057566720 839749632 217817088 0 41250816 399245312 Swap: 526405632 78872576 447533056 MemTotal: 1032780 kB MemFree: 212712 kB MemShared: 0 kB Buffers: 40284 kB Cached: 384356 kB SwapCached: 5532 kB Active: 153460 kB Inactive: 278492 kB HighTotal: 131008 kB HighFree: 2044 kB LowTotal: 901772 kB LowFree: 210668 kB SwapTotal: 514068 kB SwapFree: 437044 kB
  • SwapFree: 437044 kB
 
Average of ratings: -
Picture of Colin McQueen
Re: Performance perspectives - a little script
 
Interesting thread this. Could we get something like this put together to provide a standard speed test and post results vs specification for a comparison table on the performance docs?

I have prettified the output and changed the script so each test was repeated. Not that I'm a programmer wink so there may be problems with the way I did this.

Computer Specifications

COMPAL System Model: BCY27
BIOS Version: PHOENIX BIOS BCY27_V1.04
Operating System Microsoft Windows XP Professional
Version: 5.1.2600
Service Pack: 2.0
Hot Fix: KB925486
Memory (RAM): 512 MB
Processor Mobile Intel(R) Celeron(R) CPU 1.80GHz
Version: x86 Family 15 Model 2 Stepping 7
Speed: 1798 MHz
Local Disk Total Capacity: 18.62 GB
Used: 17.75 GB
Free: 890.80 MB

Moodle 1.8 Dev
mysql 4.1.18
php 4.3.10
php_extension iconv not installed/enabled
php_extension mbstring is installed/enabled

PHP Speed Perspective
In one second this system did...
function calls 410000 387000
16KB files read from disk (cache) 4400 4600
regular expression replaces over 1KB of text 5200 5200
16KB files written to disk (cache) 800 500
get_record calls on the course table 620 640
insert_record calls on the course table 170 170
update_record calls on the course table 140 150

 
Average of ratings:Useful (1)
Picture of Colin McQueen
Re: Performance perspectives - a little script
 
Had a quick go on our £80 a year hosting package originally installed by fantastico but upgaded manually.

Moodle 1.53+
(Strange didn't work on my local laptop version of 1.53 due to a missing function call)
PHP 5.1.5
Iconv enabled 2.3.4
MySQl 5.0.24-standard
Apache 1.3.37
i686 processor
System Linux dedi4.ukhost4u.com 2.6.9-42.0.3.ELsmp #1 SMP Fri Oct 6 06:21:39 CDT 2006 i686
Build Date Aug 25 2006 12:19:22

Seems quite good to me for the price?

PHP Speed Perspective
In one second this system did...
function calls 901000 906000
16KB files read from disk (cache) 21700 21600
regular expression replaces over 1KB of text 8700 9000
16KB files written to disk (cache) 7700 7800
get_record calls on the course table 2210 2080
insert_record calls on the course table 460 430
update_record calls on the course table 210 210

 
Average of ratings: -
Picture of Morten Brydensholt
Re: Performance perspectives - a little script
 

My server(s) took forever to make backup.

From the log-files I found that there were thousands of courses named '!!!TEST'.

I suspect the performance script do not clean up after a test run.

Morten

 
Average of ratings: -
Picture of Johan sk4p
Re: Performance perspectives - a little script
 
Hello !

Good idea this script to compare performance and have an idea about configuration you can need. Actually, I'm studying our needs to install moodle on our intranet... We'll have around 1500 users and want to be sure that the installation will be reliable when the site will be open, otherwise, users won't use it anymore... So, I'm very interesting in this script but I can't run it ! Maybe I'm wrong in the way to use it...
I pasted it in my moodle directory and went to this URL : http://my_moodle_website/perspective.php and i got this error :

Warning: require_once(P:\_some_dir_\xampp\htdocs\moodle/../../config.php) [function.require-once]: failed to open stream: No such file or directory in P:\_some_dir_\xampp\htdocs\moodle\perspective.php on line 10

Fatal error: require_once() [function.require]: Failed opening required 'P:\_some_dir_\xampp\htdocs\moodle/../../config.php' (include_path='.;P:\_some_dir_\xampp\php\pear\') in P:\_some_dir_\xampp\htdocs\moodle\perspective.php on line 10

Any ideas ?

Thanks in advance, Johan

I'm running Moodle 1.6.3 with PHP5,Apache2 and MySQL 5.0.24a on Windows Server 2000
 
Average of ratings: -
Picture of rich holman
Re: Performance perspectives - a little script
 
PHP Speed Perspective
In one second this system did...
function calls 1341000 1351000
16KB files read from disk (cache) 2100 2500
regular expression replaces over 1KB of text 16200 15800
16KB files written to disk (cache) 400 300
get_record calls on the course table 990 760
insert_record calls on the course table 510 730
update_record calls on the course table 90 100

On Moodle 1.6.3 using php 5.1.6 with mysqldb hosted on servage.net

16KB file read and write is a concern as are the the 3 calls to the course table. I've tweaked everything I can on the server but still no improvement.

Any suggestions on how I might get these stats looking more respectable???

 
Average of ratings: -
Picture of Christian Bokhove
Re: Performance perspectives - a little script
 
PHP Speed Perspective
In one second this system did...
function calls 1335000 1329000
16KB files read from disk (cache) 23700 23200
regular expression replaces over 1KB of text 8100 10600
16KB files written to disk (cache) 1200 3900
get_record calls on the course table 4250 4160
insert_record calls on the course table 500 530
update_record calls on the course table 540 540

Am I correct in thinking this should be ample enough for a 1000 student school?

Still, the system crawls down to a grinding halt... sad

 
Average of ratings: -
Picture of C R
Re: Performance perspectives - a little script
 

Johan sk4p, it needs to be in a sub folder of the moodle website. i.e. http://moodle/stats/perspective.php

This good or bad?? this is on our moodle server (apache running on 2003), with 2500users / 30-50 concurrent connections usually.

Perspective

In one second you can do...

  • 553000 function calls
  • 3000 16KB files read from disk (cache)
  • 4800 regular expression replaces over 1KB of text
  • 1100 16KB files written to disk (cache)
  • 740 get_record calls on the course table
  • 370 insert_record calls on the course table
  • 90 update_record calls on the course table
 
Average of ratings: -
Picture of Jai Gupta
Re: Performance perspectives - a little script
 
my server results...

Perspective

In one second you can do...

  • 1137000 function calls
  • 10800 16KB files read from disk (cache)
  • 10700 regular expression replaces over 1KB of text
  • 6000 16KB files written to disk (cache)
  • 121470 get_record calls on the course table
  • 1010 insert_record calls on the course table
  • 360 update_record calls on the course table
and

PHP Speed Perspective
In one second this system did...
function calls 1205000 1180000
16KB files read from disk (cache) 9100 10700
regular expression replaces over 1KB of text 9600 8700
16KB files written to disk (cache) 7000 7100
get_record calls on the course table 118240 113870
insert_record calls on the course table 910 940
update_record calls on the course table 280 360

can any one tell me how many concurrent users can this server handle (i don't use quiz or chat)

thanks

 
Average of ratings: -
Picture of Ken Wilson
Re: Performance perspectives - a little script
 

Jai

Try running this version of the script, which gives an estimate of users your server can handle. It's purely an estimate and remember to disable the record cache for accurate results wink.

Ken

 
Average of ratings:Useful (1)
Picture of Ryan Thomas
Re: Performance perspectives - a little script
 
Cool. Thanks for tweak of script (to include estimate of max. concurrent users).

Results from Dual 2.3GHz G4 Xserve (from 2005) w/ 2GB RAM.

Moodle System Benchmarks
For Moodle 1.7 Only.
Note: Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 325000 317000
Regular expression replaces over 1KB of text 3900 3900
Disk performance
16KB files read from disk (cache) 3200 3200
16KB files written to disk (cache) 1600 1600
Database performance
Get_record calls on the course table 1750 1670
Insert_record calls on the course table 410 490
Update_record calls on the course table 210 210
Maximum users (approx): 34
 
Average of ratings: -
Picture of Grant Carmichael
Re: Performance perspectives - a little script
 
Custom Built PC w/ 512MB, P4, SATA Software Raid1, RHEL w/ no GUI and MySQL running locally on server.

Perspective
Moodle System Benchmarks
For Moodle 1.7 Only.
Note: Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 1262000 1289000
Regular expression replaces over 1KB of text 9600 9600
Disk performance
16KB files read from disk (cache) 13700 13700
16KB files written to disk (cache) 7800 7800
Database performance
Get_record calls on the course table 1730 1720
Insert_record calls on the course table 1090 1060
Update_record calls on the course table 410 410
Maximum users (approx): 96
 
Average of ratings: -
Picture of Mikel Stous
Re: Performance perspectives - a little script
 
WARNING - I noticed that the script leaves !!!TEST in the mdl_courses table.

----
My test machine going from Apache1.3/PHP4 to Apache2/PHP5 nearly doubled the number of function calls (527000 to 917000). Insert_record calls also doubled (300 to 780). Only slight improvement on the rest of the stats.

Dell Optiplex GX270 2.8Ghz P4step9 w/HT, 1.5Gb ram, 40Gb PATA HD
Ubuntu 6.06LTS server, Apache2, PHP5, MySQL 5.0.22, NO PHP acceleration
Moodle 1.7+

Moodle System Benchmarks
For Moodle 1.7 Only.
Note: Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
OS: Linux moodle1 2.6.15-28-server #1 SMP Thu Feb 1 16:58:14 UTC 2007 i686
Apache/2.0.55 (Ubuntu) PHP/5.1.2
Per Child: 0 - Keep Alive: on - Max Per Connection: 100
Connection: 300 - Keep-Alive: 15
Processor performance
Function calls 917000 904000
Regular expression replaces over 1KB of text 6700 6800
Disk performance
16KB files read from disk (cache) 23600 23600
16KB files written to disk (cache) 8000 8400
Database performance
Get_record calls on the course table 1350 1350
Insert_record calls on the course table 780 810
Update_record calls on the course table 170 170
Maximum users (approx): 86

 
Average of ratings: -
Picture of Mikel Stous
Re: Performance perspectives - a little script
 
I have a steep performance hit when these !!!TEST entries are left in mdl_course.

When I issue this SQL I see a dramatic speedup of pages.

DELETE FROM `mdl_course` WHERE `mdl_course`.`shortname` = '!!!TEST';


 
Average of ratings:Useful (1)
Picture of Ken Wilson
Re: Performance perspectives - a little script
 

Many of us have figured that there is some tidying-up to do after running this script. Attached is a version which does the deletion of the !!!TEST courses which are created at each run. It would also be useful to have a version available which displays system information in the way that yours does.

 
Average of ratings:Useful (3)
Julian Ridden
Re: Performance perspectives - a little script
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators

Once this is finished and tidied, it might be a good addition to the Admin/Server area as a test admins can run on their server as part of the setup process should they want/need too.

Great work on the update Ken smile

 
Average of ratings: -
Picture of Myles Carrick
Re: Performance perspectives - a little script
Group Developers
hey Julian,
Perhaps a performance test of some description is a good idea... but not this particular script!!!

Please do all be careful with this script. It's really quite useful but... Sam mentioned in his initial post the dangers of using this in your production environment ... it'll allow for DoS attacks (imagine someone automating a script to repeatedly call this!!!) AND is dangerous in that it writes to your actual moodle course tables. At the very least it'll increment the course IDs ...

Be sure to run it only on a dev/testing install AND configure to prevent it being called from the outside world.

Cheers,
MC


 
Average of ratings:Useful (1)
Picture of Martynas Adomavicius
Re: Performance perspectives - a little script
 
hi, maybe someone know how this script counts concurrent users ?
formula : $facttotal= $factfunctioncalls+$factregex+$factreaddisk+$factwritedisk+$factgetrecord+$factinsertrecord;

$userest=$facttotal / 8;

why $factfunctioncalls is a sum, and why dvi from 8 ?

 
Average of ratings: -
Picture of Alex Araujo
Re: Performance perspectives - a little script
 
Great script!

Processor performance
Function calls 1362000 1369000
Regular expression replaces over 1KB of text 10400 10200
Disk performance
16KB files read from disk (cache) 23100 22800
16KB files written to disk (cache) 9800 9500
Database performance
Get_record calls on the course table 2520 2380
Insert_record calls on the course table 1000 1120
Update_record calls on the course table 190 200
Maximum concurrent users (approx): 112

thanks!
 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers
The data would be even more informative if you say for which server - hardware and software.
 
Average of ratings: -
Picture of Nicolas Sicard
Re: Performance perspectives - a little script
 
Hi,
I made some tests with this little script on my MacBook with the last MAMP+Moodle1.7.2+ package. I know this is not a server but I was interested by comparison between different configurations. It's easy to switch between different php versions and activating php accelerator is only a checkbox. For information, my laptop has Intel Core 2 Duo 2.0GHz w/ 1GB RAM.
Here are the worst performances I got with Moodle 17 : php4 without eAccelerator

Moodle System Benchmarks
Macbook 2GHz-2GB RAM - MAMP/Apache2/MySQL5/PHP4
Processor performance
Function calls 715000 719000
Regular expression replaces over 1KB of text 11000 11000
Disk performance
16KB files read from disk (cache) 5200 5200
16KB files written to disk (cache) 1200 1200
Database performance
Get_record calls on the course table 2090 2100
Insert_record calls on the course table 430 420
Update_record calls on the course table 130 130
Maximum concurrent users (approx): 53

First, what surprises me is that thoses results are all better or equivalent than our dual core Xeon 2.8GHz 2GB RAM server with php4 and eAccelerator except for disk reading performances !

Moodle System Benchmarks
Server 2.8GHz dual core Xeon - 2GB RAM - RAID 5
Apache2/MySQL5/PHP4 with eAccelerator
Processor performance
Function calls 527000 529000
Regular expression replaces over 1KB of text 10200 10400
Disk performance
16KB files read from disk (cache) 17400 17400
16KB files written to disk (cache) 100 100
Database performance
Get_record calls on the course table 2020 2020
Insert_record calls on the course table 300 270
Update_record calls on the course table 150 150
Maximum concurrent users (approx): 54

But the main difference came after switching to php5 (on the Macbook) :
Moodle System Benchmarks
Macbook 2GHz-2GB RAM - MAMP/Apache2/MySQL5/PHP5
Processor performance
Function calls 1511000 1513000
Regular expression replaces over 1KB of text 14300 14300
Disk performance
16KB files read from disk (cache) 7100 7100
16KB files written to disk (cache) 1200 1200
Database performance
Get_record calls on the course table 2340 2330
Insert_record calls on the course table 1310 1280
Update_record calls on the course table 120 130
Maximum concurrent users (approx): 98

Almost all tests got better results except for file write and update records. Maximum concurrent users approximation almost doubled. I can add that A
activating eAccelerator got me 1609000 function calls with php5 and 100 concurrent users !

I made the same tests with Moodle 1.8 but I didn't get big differences comparing to Moodle 1.7.2.

My questions are :
1/ Can we expect such performance boost by using php5 instead of php4 ? I would be surprised...
2/ Our server is dedicated to Moodle. Are there any drawbacks to switch to php5 ?
3/ My consumer laptop seems at least as powerful as our dedicated server. It seems suspect to me. How relevant is this script ?
4/ I'm especially interested with quiz performances. What are the most critical tests for quizzes ?

Nicolas.
 
Average of ratings: -
Picture of Nicolas Sicard
Re: Performance perspectives - a little script
 
Precision : server is running Linux Debian "Etch".
 
Average of ratings: -
Picture of Maik Riecken
Re: Performance perspectives - a little script
 
Hello,

This is an amd64 3700+, 2GB RAM, no Raid

Environment:
lighttpd (worth a look), PHP5 (fastcgi), eaccelerator, MySQL5 (all debian etch).

Moodle System Benchmarks
For Moodle 1.7 Only.
Note: Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 1131000 1095000
Regular expression replaces over 1KB of text 9000 9000
Disk performance
16KB files read from disk (cache) 29600 28400
16KB files written to disk (cache) 12000 11800
Database performance
Get_record calls on the course table 5490 5520
Insert_record calls on the course table 1520 1340
Update_record calls on the course table 300 300
Maximum users (approx): 134


regards,

Maik
 
Average of ratings: -
Picture of John Rodkey
Re: Performance perspectives - a little script
 
Results for a 2 dual core Xeon 3.6 GHz processors, 2 G RAM,
running SuSE Linux 10.1, MySQL 5.0.18, Apache 2.2.0-21

Moodle System Benchmarks
Note for Moodle 1.7 and above:
Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 1604000 1637000
Regular expression replaces over 1KB of text 11400 12000
Disk performance
16KB files read from disk (cache) 36200 35800
16KB files written to disk (cache) 5700 5100
Database performance
Get_record calls on the course table 3040 3070
Insert_record calls on the course table 1030 970
Update_record calls on the course table 230 240
Maximum concurrent users (approx): 123


 
Average of ratings: -
Picture of Ger Tielemans
Re: Performance perspectives - a little script
 

If I do this test under 1.7 I get an estimation of 300 concurrent users.. plus or minus 25!!

Can someone explain this fluctuation of 50?

If I try to use this for measuring succesful tuning this is not very accurate.

 
Average of ratings: -
Picture of John Rodkey
Re: Performance perspectives - a little script
 
And here's the same system with APC added:
Moodle System Benchmarks
Note for Moodle 1.7 and above:
Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 1634000 1581000
Regular expression replaces over 1KB of text 12400 12200
Disk performance
16KB files read from disk (cache) 36400 36400
16KB files written to disk (cache) 7300 6800
Database performance
Get_record calls on the course table 3090 3110
Insert_record calls on the course table 1430 1060
Update_record calls on the course table 210 210
Maximum concurrent users (approx): 134


Note that only files written to disk and insert_record performance was significantly.
 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers
Server: AMD Opteron dual-core 1218, 2600 MHz, 4 GB DDR2-667 RAM, 2x 300 GB SATA HD in RAID-1

Moodle System Benchmarks

For Moodle 1.7 Only.

Note: Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls917000914000
Disk performance
16KB files written to disk (cache)75007300
Database performance
Insert_record calls on the course table1060900
Update_record calls on the course table220220
Maximum users (approx):95

LAMP:
- Debian 4.1, kernel 2.6.18.4, 64 bit
- Apache 2.2.4
- MySQL 5.1.20
- PHP 5.2.3
all custom compiled. Fresh installation, all went smoothly except for the warning about missing mbstring which I forgot to include.

Now the next questions:
What was the basis for the calculation of the number of maximum users?
I guess, they don't include users taking online tests (quiz). If so what is the formula to estimate the maximum number of quiz users?

I have to predict that number before the test begins! Any idea on how to rehearse?
 
Average of ratings: -
Picture of Visvanath Ratnaweera
Number of quiz users (was Performance perspectives - a little script)
Group Particularly helpful Moodlers
> what is the formula to estimate the maximum number of quiz users?

Or to put it in another way: Could people with similar machines and software can say from experience, how many quiz users are realistic, for Moodle 1.7?
 
Average of ratings: -
Picture of Hamid Takesh
Re: Performance perspectives - a little script
 

Hello everyone!

Guys, I need help! Tired of reconfiguering my server again and again!

I've got 2x Xeon 3.2GHz with 2GB RAM.
Running Moodle 1.6 on IIS 8, MySQL 5.0.27, PHP 5.2.

And the result I'm getting is this:

Moodle System Benchmarks
For Moodle 1.7 Only.
Note: Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 1208000 1199000
Regular expression replaces over 1KB of text 2900 2900
Disk performance
16KB files read from disk (cache) 5600 5600
16KB files written to disk (cache) 500 500
Database performance
Get_record calls on the course table 1810 1810
Insert_record calls on the course table 950 760
Update_record calls on the course table 110 110
Maximum users (approx): 60

What can be the problem?

Can anyone post the php.ini and my.cnf files here plz or send them to my e-mail (hamidych@gmail.com)? I'd really appriciate that.

Thanx.

 
Average of ratings: -
Picture of Robert Reyes
Re: Performance perspectives - a little script
 

Perspective

In one second you can do...

  • 324000 function calls
  • 8400 16KB files read from disk (cache)
  • 3800 regular expression replaces over 1KB of text
  • 200 16KB files written to disk (cache)
  • 310 get_record calls on the course table
  • 10 insert_record calls on the course table
  • 140 update_record calls on the course table

~~~~~~~~~~
How do you make the insert_record calls go higher than what I have (10)?
 
Average of ratings: -
Picture of Myles Carrick
Re: Performance perspectives - a little script
Group Developers
hi Robert,
Mate can you tell us anything about your system? (OS, hardware specs, etc)
ALL of those figures are really low... as an indicator, my little testing box (an old P4 machine with just 512MB RAM, running Ubuntu LAMP setup) gives:
  • 1056000 function calls
  • 32300 16KB files read from disk (cache)
  • 8200 regular expression replaces over 1KB of text
  • 11100 16KB files written to disk (cache)
  • 4180 get_record calls on the course table
  • 990 insert_record calls on the course table
  • 210 update_record calls on the course table
Cheers,
MC



 
Average of ratings: -
Picture of antonio gonzalez
Re: Performance perspectives - a little script
 

Perspective

In one second you can do...

  • 1155000 function calls
  • 31500 16KB files read from disk (cache)
  • 13500 regular expression replaces over 1KB of text
  • 6600 16KB files written to disk (cache)
  • 130 get_record calls on the course table  <---
  • 1868460 insert_record calls on the course table  <--

...

Hello,

We have a Moodle with Oracle10g. The results of get_records and insert_records calls are very strange.

 
Average of ratings: -
Picture of Daniel Lowe
Re: Performance perspectives - a little script
 
can get the script to "Insert_record calls on the course table" it keeps failing with error "Insert failed: The statement has been terminated."

i`m think it`s because of my setup, Linux Webservers running Apache and a Windows 2003 R2 running Mssql.

Everything else works on the server was just testing the performance of the unit and would like some base numbers from the script before moving the server to production.

Anyone have any ideas why the script is failing.?

Thanks
Daniel.
 
Average of ratings: -
Me in Buck Rogers Outfit
Huge increase in course ID - Re: Performance perspectives
 
After giving the first script a go and getting the following poor cache results.

In one second you can do...

  • 1149000 function calls
  • 3400 16KB files read from disk (cache)
  • 3400 regular expression replaces over 1KB of text
  • 500 16KB files written to disk (cache)
  • 67000 get_record calls on the course table
  • 690 insert_record calls on the course table
  • 120 update_record calls on the course table
I thought I'd try the scripts listed lower down the posts but they didn't work.

I've now just set up a new course and the id number has jumped from 29 to 720.

Has anyone any idea how to reset this? Or does it even matter?

Thanks in advance?

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: Huge increase in course ID - Re: Performance perspectives
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers
> Or does it even matter?

It doesn't matter at all smile

Saludos. Iñaki.
 
Average of ratings: -
Me in Buck Rogers Outfit
Re: Huge increase in course ID - Re: Performance perspectives
 
Awesbig grinme

Thanks Iñaki
David

 
Average of ratings: -
Picture of Myles Carrick
Re: Huge increase in course ID - Re: Performance perspectives
Group Developers
hi David,

It's one of the reasons why there are a stack of warnings higher up this post about not running this script on your production setup...

Be careful!!! ;)

MC

 
Average of ratings: -
Me in Buck Rogers Outfit
Re: Huge increase in course ID - Re: Performance perspectives
 
Yea I'm currently in the process of setting up a none production installation.

As general practise would this be best on the same server or should I keep a separate server.
 
Average of ratings: -
Picture of Myles Carrick
Re: Huge increase in course ID - Re: Performance perspectives
Group Developers
Yes, David - you definitely want to have at least one place where you do development and testing outside of your production environment - ideally one or more development setups (which can be local, etc) and then testing/staging environments which are as close as possible to your production environment (in particular, that are running the same OS, webserver, php, etc so that you can identify any issues/conflicts etc before applying the same changes in production.

The issue of performance testing is a tricky one, however, where you want to test the limits of your hardware+software+configuration - and where your hardware in production is likely to be MUCH more powerful than your test rig... If for instance you want to run Sam's script (the one from this thread) in your production setup, you should be fine just to be running in a separate database - perhaps a clone of your existing site or for the purposes of this (where existing data shouldn't have much/any impact),just a clean Moodle install. Definitely be sure to run the same version of Moodle that you're running in production, as there have been significant performance enhancements in the past couple of months.

Hope this helps,

MC



 
Average of ratings: -
Me in Buck Rogers Outfit
Re: Huge increase in course ID - Re: Performance perspectives
 
Thanks for your help and advice. the Moodle world really is a friendly place.
 
Average of ratings: -
Picture of Alan Richey
Re: Performance perspectives - a little script
 
I too am getting an "Insert failed:" message when running the script. The exact message is as follows:

"Insert failed: Duplicate entry '0-1009' for key 2"

Can someone tell me how to fix this issue, or at least point me in the right direction? The script works great up until the insert.

Thanks!
 
Average of ratings: -
Picture of Alan Richey
Re: Performance perspectives - a little script
 
Never mind guys, I got it working. The script is amazing by the way! Kudos!
 
Average of ratings: -
Picture of Xiaolin Wang
Re: Performance perspectives - a little script
 
I got exactly the same problem. How did you fix it, Alen? Thanks in advance!
 
Average of ratings: -
Picture of Carlos Massoglia
Re: Performance perspectives - a little script
 
Here the results for two of our systems, both running
  • moodle 1.8.3+
  • mysql 5.0
  • apache 2.2

- 8 processors model name : Intel(R) Xeon(TM) CPU 3.20GHz
- 16 Gb RAM
- 2 sata disc on raid 5
- OS. Linux Centos 5

Perspective

In one second you can do...

  • 2512000 function calls
  • 39100 16KB files read from disk (cache)
  • 22200 regular expression replaces over 1KB of text
  • 18700 16KB files written to disk (cache)
  • 3850 get_record calls on the course table
  • 1850 insert_record calls on the course table
  • 490 update_record calls on the course table


- 2 processors model name : Intel(R) Xeon(TM) CPU 3.20GHz
- 2 Gb Ram
- 2 HD on raid 5
- OS Linux Opensuse 10.2

Perspective

In one second you can do...

  • 1338000 function calls
  • 20200 16KB files read from disk (cache)
  • 13800 regular expression replaces over 1KB of text
  • 8900 16KB files written to disk (cache)
  • 2170 get_record calls on the course table
  • 880 insert_record calls on the course table
  • 210 update_record calls on the course table


 
Average of ratings: -
Picture of Tim Rhymer
Re: Performance perspectives - a little script
 
My results seemed sort of odd...the reg ex value seemed pretty low and the get_record looks really high. The 2 other values didn't load because of an exception:

Insert failed: Cannot insert the value NULL into column
'summary', table 'Moodle.moodle.mdl_course'; column does not allow nulls.

  • 1005000 function calls
  • 9800 16KB files read from disk (cache)
  • 2400 regular expression replaces over 1KB of text
  • 1600 16KB files written to disk (cache)
  • 63190 get_record calls on the course table
Specs:
Windows Server 2k3 with IIS 6
Moodle 1.8.2 production (i was feeling brave)
MSSQL 2000
php 5.2.3
Using ODBTP 1.1.4 to connect php to MSSQL
 
Average of ratings: -
Picture of HJWUCGA INC.
Re: Performance perspectives - a little script
 
Hello,

Could anyone tell me what the 2nd column is for?

In fact, it would be nice if we have some good/general/more descriptive documentation as to what each row* is about and what the ideal situation we should be targeting.

For example:

Function calls = this .... blah, blah ... the higher the number the better because blah, blah, blah. To improve performance, blah, blah...

* every row should address 3 areas - a description of test, best performance practice, and suggestions for improvement.

SuSE Linux Enterprise 10 (2.6.16.46-0.12)
MySQL 5.0.26
PHP 5.1.2
Moodle 1.9+ (build 2 days ago, April 30)
XEON 3.0
Running on VMWare I think

Processor performance
Function calls 2340000 2146000
Regular expression replaces over 1KB of text 16500 18500
Disk performance
16KB files read from disk (cache) 20700 18100
16KB files written to disk (cache) 14400 13100
Database performance
Get_record calls on the course table 3540 3720
Insert_record calls on the course table 1760 2340
Update_record calls on the course table 320 340
Maximum concurrent users (approx): 172

Thanks


 
Average of ratings: -
Picture of simon forder
Re: Performance perspectives - a little script
 
I though I'd do a little testing of my own, very basic with little experience of these things I have say sad . I have been bought a new XServe for Moodle and need to decide whether to use OSx or Linux on the hardware.

I setup moodle on a Mac Mini I have here and ran the latest perspective script from this forum.
1.83Ghz Intel duo
2GB Ram
Single 73GB SATA HDD

With Ubuntu 8.02, PHP5, Apache2
Processor performance;
function calls
1049000
regular expression replaces over 1KB of text 11400
disk performance;

16KB files read form disk (cache)
28800
16KB files written to disk (cache)
11200
database performance;

Get_record calls on the course table
4940
insert_record calls on the the course table
1190
update_record calls on the course table
260
max users approx.
125

With OSX 10.5, php5,

Processor performance;
function calls
1525000
regular expression replaces over 1KB of text 14300
disk performance;

16KB files read form disk (cache)
17500
16KB files written to disk (cache)
1900
database performance;

Get_record calls on the course table
4960
insert_record calls on the the course table
1520
update_record calls on the course table
190
max users approx.
122

Is the fact I am getting significantly lower disk writes a problem?

Simon
 
Average of ratings: -
Lewis Carr
Re: Performance perspectives - a little script
 
Just thought I'd join in.
We run Moodle on a Virtual Server Win 2003.
IIS, MySQL 5.2.4 PHP 5.

Perspective

In one second you can do...

  • 1142000 function calls
  • 600 16KB files read from disk (cache)
  • 3100 regular expression replaces over 1KB of text
  • 100 16KB files written to disk (cache)
  • 1520 get_record calls on the course table
  • 120 insert_record calls on the course table
  • 30 update_record calls on the course table

 
Average of ratings: -
Picture of Dan Marsden
Re: Performance perspectives - a little script
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators
Hi Lewis - are you running FastCGI? - if not you should! - (just be careful with the timeout values set in fastcgi - make them higher than default and rely on php timeout setttings instead) - you should post your changed results here, I've found it can make some dramatic improvements.

smile

Dan
 
Average of ratings: -
Sketch...
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers

> I've found it can make some dramatic improvements.

You can say that again, Dan! approve

I saw some nice improvements when I switched to FastCGI from ISAPI.

 
Average of ratings: -
Picture of Dan Marsden
Re: Performance perspectives - a little script
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators
I'd be really interested to see the difference between IIS6/IIS6 with fastcgi and IIS 7! - from what I've read - there seems to be a lot of nice improvements with IIS 7 that should really benefit PHP/Moodle!
 
Average of ratings: -
Picture of Martynas Adomavicius
Re: Performance perspectives - a little script
 
hi, maybe someone know how this script counts concurrent users ?
formula : $facttotal= $factfunctioncalls+$factregex+$factreaddisk+$factwritedisk+$factgetrecord+$factinsertrecord;

$userest=$facttotal / 8;

why $factfunctioncalls is a sum, and why div from 8 ?
 
Average of ratings: -
Picture of Monika Gupta
Re: Performance perspectives - a little script
 

Hi,

can somebody tell me what exactally this script does? I could get these statistics but not sure how it arives at it?

is this just checks the configuration of various components (DB,apache) etc and or runs some kind of test on the application?

Please note i have no knowledge of PHP, and was involved in the performance testing of our moodle kind of applicaiton.

Thanks.

 
Average of ratings: -
Picture of lawrence li
Re: Performance perspectives - a little script
 
I put this script on my server but not works....anything that I need to adjust?
 
Average of ratings: -
Oam
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers
Hello

@lawrence:
Do you use the version attached to the posting on 1. March 2007 ?

If no, it means you use the version attached to the very first post : you need to edit the script so that the require_once for config.php points to the right place (first lines) ... or use the version attached to the posting on 1. March 2007.


@everyone :
Martynas Adomavicius says :
hi, maybe someone know how this script counts concurrent users ?
formula : $facttotal= $factfunctioncalls+$factregex+$factreaddisk+$factwritedisk+$factgetrecord+$factinsertrecord;
$userest=$facttotal / 8;
why $factfunctioncalls is a sum, and why div from 8 ?

I am also interested to know how the script counts concurrent users ...

Here my results for our Supermicro Server :
MB X8DTT-IBX
2x INTEL XEON L5506 (Quad-core) 2.90 Ghz (~)
8Go DDR3 RAM
Seagate Barracuda 7200.11 SATA-300-7200trs/m-32 Mo (RAID 5 hard)

With Ubuntu 8.04, PHP5, Apache2, APC, Moodle 1.9.8

Separate DB Server :
MAC Xserve Xeon 2.0
2.0 GHz Dual Core Xeon 5130 (64 bits) x2
3 Go RAM
1 To SATA drives RAID 1
With MAC OS X, MYSQL 5


Processor performance
Function calls 2160000 2201000
Regular expression replaces over 1KB of text 17400 17400
Disk performance
16KB files read from disk (cache) 87700 88000
16KB files written to disk (cache) 600 800
Database performance
Get_record calls on the course table 2000 2000
Insert_record calls on the course table 1000 1000
Update_record calls on the course table 230 150
Maximum concurrent users (approx): 178

I am getting a very slow disk writes speed ...

Pascal

 
Average of ratings: -
Picture of Robin Singh
Re: Performance perspectives - a little script
 

Hello Sam and Moodler,

First of all thanks to Sam for this script and I just had a suggestion that if we could save all the Stats in a table then it would be easy for us to analys the changes easily.

What are your suggestions....

 
Average of ratings: -
Picture of sam marshall
Re: Performance perspectives - a little script
Group DevelopersGroup Particularly helpful MoodlersGroup Testers

Wow that was a long time ago.

Just by the way, I didn't reread the entire thread, but if people are using this type of script to evaluate their systems, I wonder if they are paying full attention to the limitations?

A single request (such as this one) will only ever use one processor core on your web server and one processor core on your database. On a large system, you likely have eight or more cores available on each of those machines. In cases where performance is limited by CPU (i.e. when you have plenty of RAM available to cache database tables) your performance is 'really' eight times better than a single-core system, but it will appear to be just the same.

Also, the database figures will be worse when you put the database server on a separate machine. This is a true reflection of performance for a single request (if you're only making one request at once, splitting onto different machines gets slower because of network delay; take-home conclusion for developers is, don't make hundreds or thousands of database queries within a single request) but is not a reflection of performance for a real system because that time when it's waiting for the response from the database is not wasted time; the web server can use that to service multiple requests. For example, say it takes 40ms to handle the PHP part of a request and 60ms to handle the database part. That means a single one-processor machine takes 100ms and can handle 10 requests per second. If you put the database on a separate machine it might add 10ms in waiting for network back-and-forth, meaning that it takes 110ms to handle a single request - so this appears slower - but it can now handle approximately 16 requests per second...

The performance script is simple and fun but I don't think it's a very good way to evaluate the capacity of a Moodle installation. For that, you'd probably be better off with a JMeter script or something similar that can make a large number of requests at a time.

Because of these limitations, I don't think this type of script should be made an official part of the Moodle system. It might be possible to develop another type of script that can make lots of sub-requests (back to the same server) which would more accurately evaluate performance. If so, perhaps that could be added as a Moodle admin report. Actually it would be quite fun to write...

--sam

 
Average of ratings: -
Picture of Robin Singh
Re: Performance perspectives - a little script
 

Hi Sam,

Thanks for the reply and also for clearing the misconception about the prespective script. I would quicky review JMeter and as you have said it would be fun to write. Why dont we start the fun.

People would real want some cool stuff which would help them to make the best out of their server and Moodle. Also i am still how is the user calculating Maximum concurrent users (approx)

Regards,

Robin

 
Average of ratings: -
Picture of Grant Mucha
Re: Performance perspectives - a little script
 

Does anyone still use / maintain this script for simple testing purposes?

Apparently it does not work with 2.0/2.0.1

 
Average of ratings: -
Picture of Walter Draffin
Re: Performance perspectives - a little script
 

Agreed.  It would be nice to have a 2.x compatible script like this.

 
Average of ratings: -
Picture of Phaessuh Kromah
Re: Performance perspectives - a little script
 

Here is my 2.0 update of perpective.php... I added the global declaration of $DB object and updated the DML_functions as described in http://docs.moodle.org/en/Development:DML_functions

 
Average of ratings: -
I Teach With Moodle
Re: Performance perspectives - a little script
Group Testers

Thanks for the update. I tested it for fun (I'm aware of the limitations of this script).

Here are the results. VPS Ubuntu 10.04 with 2GB RAM (burst to 4.5GB) - 6 cores 2.4GHZ. Moodle 2.2.3

Moodle System Benchmarks
Note for Moodle 1.7 and above:
Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 3535000 3522000
Regular expression replaces over 1KB of text 20200 20200
Disk performance
16KB files read from disk (cache) 77200 79100
16KB files written to disk (cache) 6300 6500
Database performance
Get_record calls on the course table 6080 5930
Insert_record calls on the course table 1890 2490
Update_record calls on the course table 2330 6270
Maximum concurrent users (approx): 251

I have also done some JMeter testing - I am very happy with this little box smile

Cheers, 
Fred

 
Average of ratings: -
Picture of julian maya
Re: Performance perspectives - a little script
 

Hi, I am trying to benchmark two installataions of moodle 2.3 running in amazon aws with rds. One its over apache and the other its over lighty.

But I cant make work the script, I tried just to copy to /mod/ but I cant make it work.

¿How does I install the script?

Thank you in advance

 
Average of ratings: -
Picture of Eric Malone
Re: Performance perspectives - a little script
 

I may be wrong, but I don't think that this script is usable anymore and hasn't been updated in quite some time.

 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers
Why is it not usable? Could you describe what you've tried and what happened?
 
Average of ratings: -
Picture of Matthew Di Giuseppe
Re: Performance perspectives - a little script
 

The script only works with moodle 1.9 and below. The database calls need to be updated for Moodle 2.0 and above:

get_record('course','id',1) : $DB->get_record('course',array('id' => 1))

insert_record('course',$newrecord) becomes $DB->insert_record('course',$newrecord)

update_record('course',$newrecord) : $DB->update_record('course',$newrecord)

delete_records('course','id',$ids[$count]) : $DB->delete_records('course',array('id' => $ids[$count]))

$db->ErrorMsg() : $DB->ErrorMsg() - there's 4 of these

 

I think that's everything.

 
Average of ratings:Useful (2)
Ricardo Caiado
Re: Performance perspectives - a little script
 
Hi Sam,

Does it work with PostgreSQL?

Ricardo

 
Average of ratings: -
Ricardo Caiado
Re: Performance perspectives - a little script
 
Weird behavior...

---
Moodle System Benchmarks
Note for Moodle 1.7 and above:
Disable the record cache (Site Admin -> Server -> Performance) for realistic results!
Processor performance
Function calls 2804000 2803000
Regular expression replaces over 1KB of text 20100 20000
Disk performance
16KB files read from disk (cache) 57000 56700
16KB files written to disk (cache) 19900 16500
Database performance
Get_record calls on the course table
---

After that I get this error message:

---
Get failed: MySQL server has gone away
---

Any Ideas?

>> Moodle 1.9.13+, Debian, Apache2, MySQL5, PHP5

 
Average of ratings: -
Picture of Jason Cameron
Re: Performance perspectives - a little script
 

I just ran this script on my Moodle 2 installation.  It appears as though NO cache is being written for text.

 

Disk performance
16KB files read from disk (cache) 1400 1500
16KB files written to disk (cache) 100

100

Am I missing a setting or something?  Shouldn't there be a lot more being written to disk?

 
Average of ratings: -
Picture of Martin Contreras
Re: Performance perspectives - a little script
 

Hi Jason,

Do you resolve your problem ? If yes can you say me how to do that?

Thank you in advance

 

Martin

 
Average of ratings: -
Picture of K P
Re: Performance perspectives - a little script
 

I get this error when trying to run this script:


Warning: require_once(/var/www/vhosts/DOMIAN.COM/httpdocs/moodle/stats/../../../config.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/vhosts/DOMIAN.COM/httpdocs/moodle/stats/perspective.php on line 15

Fatal error: require_once() [function.require]: Failed opening required '/var/www/vhosts/DOMIAN.COM/httpdocs/moodle/stats/../../../config.php' (include_path='.:') in /var/www/vhosts/DOMIAN.COM/httpdocs/moodle/stats/perspective.php on line 15

 

As previously stated, it is in a moodle subdirectory

 
Average of ratings: -
Picture of Alain Boltz
Re: Performance perspectives - a little script
 

It is just due to the path to config.php at the beginning of the script. Change it to correspond to where you place your script (the first script was using /../../config.php, now /../../../config.php, adapt it to yours)

 
Average of ratings: -
My picture
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers

Hello,Can you please clarify where to install the script when Sam mentions 'in your test install'?

 

Should I place perspective.php in any of the folders of my Moodle core code and then run mymoodlesite/perspective.hp

or do I need to add the scrip to the file install.php ?

If I run the file from the root directory moodle/

what path should be here:

require_once(dirname(__FILE__).'/../../config.php');

Thank you very much for your advice.

 
Average of ratings: -
My picture
Re: Performance perspectives - a little script
Group Particularly helpful Moodlers

I have found how to make ir work and also changed the require_once path, but the code is obsolete and needs to be rewritten.

get_record, for instance is now called as:

 

$DB->get_record(),

I am not a developer, but there are several lines that need to be updated.

It is a shame because I would have like to try it in our test site.

 
Average of ratings: -
Picture of Matthew Di Giuseppe
Re: Performance perspectives - a little script
 

I posted some Find & Replace instructions as a reply to someone else's post above, but I've attached the updated version for 2.0+, with a couple of minor changes. The 'require_once' path is expecting perspective.php to be in the root moodle folder.

 
Average of ratings:Useful (1)
Picture of Mathew Gancarz
Re: Performance perspectives - a little script
 

Thank you Matthew!

I've ran this script on our servers, Moodle v2.2.x results below:

dev server, with DB on same server:

In one second you can do...

240000 function calls
13900 16KB files read from disk (cache)
10000 regular expression replaces over 1KB of text
9500 16KB files written to disk (cache)
1440 get_record calls on the course table
90 insert_record calls on the course table
100 update_record calls on the course table
1.03 seconds to delete 90 entries
Script took 14.87 seconds to execute.

Live, with dedicated DB server:

In one second you can do...

1847000 function calls
42000 16KB files read from disk (cache)
14800 regular expression replaces over 1KB of text
19200 16KB files written to disk (cache)
1420 get_record calls on the course table
130 insert_record calls on the course table
140 update_record calls on the course table
1.01 seconds to delete 130 entries
Script took 15.11 seconds to execute.

Would anybody be opposed to me uploading this script up on Github as a public repository? Would be much easier to maintain it and find a copy of it also.

PS: Adding the below lines after: require_once(dirname(__FILE__).'/config.php');

Gates the script behind moodle site permissions, so only users with site:config permissions (Site Administrators) can run it.

// Moodle user Authentication
require_once($CFG->libdir.'/adminlib.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));

 
Average of ratings: -
Me, with my new 'slow explosion' hair!
Re: Performance perspectives - a little script
Group DevelopersGroup Particularly helpful Moodlers

Thanks, Matthew. This script should probably go on GitHub for collaborative tinkering. smile

Both machines below use PHP 5.3, MySQL 5.1 and Apache 2.

Local machine (Ubuntu 12.04 LTS, dual-core (speed unknown), 4Gb RAM) results:

In one second you can do...

  • 199000 function calls
  • 74400 16KB files read from disk (cache)
  • 26000 regular expression replaces over 1KB of text
  • 1900 16KB files written to disk (cache)
  • 870 get_record calls on the course table
  • 20 insert_record calls on the course table
  • 20 update_record calls on the course table
  • 1.19 seconds to delete 20 entries

Script took 15.40 seconds to execute.

Development server (Debian 6 on VMware, dual quad-core (~2.4Gb), 8Gb RAM) results:

In one second you can do...

  • 3143000 function calls
  • 67300 16KB files read from disk (cache)
  • 20100 regular expression replaces over 1KB of text
  • 17300 16KB files written to disk (cache)
  • 1740 get_record calls on the course table
  • 510 insert_record calls on the course table
  • 660 update_record calls on the course table
  • 0.81 seconds to delete 510 entries

Script took 14.11 seconds to execute.

Interesting results. While the server has the raw grunt (nearly seven times the number of function calls) the disk is only marginally faster. MySQL is located locally for both tests, so am glad to see 25 times as many insert_record calls and 33 times as many update record calls, but only 70% more get_record calls.

So I need to look into the disk speed. Will have to try this on the live systems too.

 
Average of ratings: -
Picture of Mark Jones
Re: Performance perspectives - a little script
 

have you or anybody worked on this for mssql 2008? it runs but stops before seconds to execute. which drive is the cache writing? is it in the moodledata or the moodle directory? mark

 
Average of ratings: -
Picture of Mark Jones
Re: Performance perspectives - a little script
 

have you or anybody worked on this for mssql 2008? it runs but stops before seconds to execute. which drive is the cache writing? is it in the moodledata or the moodle directory? mark

 
Average of ratings: -
Picture of imbu danilot
Re: Performance perspectives - a little script
 

Hello There,

I would like to understand if I can run the latest script on a production site without fear?

 

also how should I interpret results?

for instance on the DEV site I got the following. what does that tell me in terms of performance if I do not have comparison?

Thanks in advance!

Imbu

================================================

Speed test

In one second you can do...

  • 2928000 function calls
  • 5300 16KB files read from disk (cache)
  • 16900 regular expression replaces over 1KB of text
  • 300 16KB files written to disk (cache)
  • 640 get_record calls on the course table
  • 80 insert_record calls on the course table
  • 50 update_record calls on the course table
  • 0.94 seconds to delete 80 entries

Script took 15.10 seconds to execute.

 
Average of ratings: -
Júnior
Re: Performance perspectives - a little script
 

 

Hello guys,

I ran the script in my moodle and got the following data:

 

Speed test

In one second you can do...

  • 4016000 function calls
  • 54300 16KB files read from disk (cache)
  • 29000 regular expression replaces over 1KB of text
  • 19700 16KB files written to disk (cache)
  • 3840 get_record calls on the course table
  • 1540 insert_record calls on the course table
  • 1750 update_record calls on the course table
  • 1.34 seconds to delete 1540 entries

Script took 15.37 seconds to execute.

 

 

However I would like your help to understand the data and know how to optimize my environment, featuring walking slowly.

I thank everyone's attention.

 
Average of ratings: -