Performance testing!

Performance testing!

by Janne Mikkonen -
Number of replies: 6

I made some performance testing with this script that generates 200 GET requests to my moodle servers front page. Basically I wanted to know how many selects does my moodle generate.

Now I used 3 browsers and here are my results:
(php.ini setting max_execute_time 900 sec.)

On a Windows machine (W2K server on 500MHz AMD K6-2 with 256 Mb memory 8Gb IDE HD). IIS 5.0 webserver running PHP as a isapi module. MySQL database

7200 selects
9 connections to database (moodleuser).
execution time around 600 sec.

On Linux RedHat 7.3 (Same hardware exept harddrive is 4.3Gb bigfoot!!!) Apache 1.3.23 webserver with PHP as a module. MySQL database

7200 selects
15 connections to database (moodleuser).
execution time around 460 sec.

Windows 2000 server also made over 1400 page faults/sec dead.gif, when running this test.

- Janne Mikkonen -

Average of ratings: -
In reply to Janne Mikkonen

Re: Performance testing!

by Huib van Wees -
Nice script!
But I think I miss something, this is my output:

TCP/IP Connection

Fatal error: Call to undefined function: socket_create() in /srv/www/htdocs/test.php on line 19

Regards,

Huib
In reply to Huib van Wees

Re: Performance testing!

by Gustav W Delius -
Are you using a very old version of PHP by any chance? Moodle requires PHP 4.1.0 or later. The function socket_create is one of those not available in earlier versions.
In reply to Gustav W Delius

Re: Performance testing!

by Janne Mikkonen -

This one is for older PHP versions that uses fsockopen -function.

I hope it's not too buggy...

- Janne Mikkonen -

In reply to Janne Mikkonen

Re: Performance testing! - How to improve performance

by David Delgado -
Some results from your script in new servers:

1) Red Hat Linux 9, Kernel 2.4.20, 128MB RAM, Pentium III 450MHz, Apache 2.0, PHP 4.2.2 as a module/filter, MySQL 3.23.56 (from a testing server at the University of Las Palmas de Gran Canaria). This is a very poor system.

Result: 265.83 seconds (1.33 seconds per call)

2) Red Hat Linux 8, Kernel 2.4.20, 1GB RAM, 4 Pentium Xeon CPU's at 2GHz, Apache 1.3.28, PHP 4.3.2 as a module, MySQL 4.0.13 (from a server at www.totalchoicehosting.com ). This is a very nice system, but it is shared by more than 250 web servers.

Result: 0.81 seconds (0,004 seconds per call)

Take into account that I have put the script in the same server being tested. You would get higher values if you tested them from any other server.

I have been monitoring the first, slow, system and I saw that the main problem was not the memory (though it was very small), but the CPU, wich was slow and just 1, having always a nearly 100% usage, more than 95% just for the Apache server (httpd), wich also handles PHP as a module/filter.

MySQL 4.0 also makes a very good job caching the SQL queries (all them were repeated). Take into account that MySQL 3.23 does not have query cache. I bet your MySQL is 3.x. Is it?

Another point is that Apache 2.0 is known to still have some problems, and the PHP module for it is a pre-alpha, very unstable one.

So, I guess that if you use latest stable versions of the software, avoiding Apache 2.0, you will improve a lot the performance of your Moodle server. I guess the most important part is upgrading to MySQL 4.0.14 (MySQL 4.0 was declared stable since 4.0.12).

Also, adding a PHP Accelerator program, sush as PHP Accelerator itself, Turck MMCache or Zend Accelerator would improve a lot the PHP performance (I think that this would reduce a lot the CPU usage). Getting some more memory (at least 512MB) and a faster CPU (the more you can) would help also.

For Windows 2000, you are just in the "recommended" ammount of RAM (256MB). Normally, to run any Micro$oft application, you need at least twice the "reccomended" ammount, and 4 times it to work really fine. The "minimum" is just ridiculous: you will see the desktop if you are lucky. wink

And... in my opinion, Linux is a much better platform to run Apache/PHP/MySQL than Windows, more reliable and with better performance using less resources.

By the way, no way to run your scripts (any of the 2) in my Windows XP with latests updates and Apache 1.3.24, PHP 4.3.1 as a module and MySQL NT 4.0.12.

The first one got this error:
"TCP/IP Connection
Fatal error: Call to undefined function: socket_create() in c:\archivos de programa\apache group\apache\htdocs\moodletest.php on line 19"

The second one got this one:
"Connection nro: 1
TCP/IP connection
Fatal error: Call to undefined function: set_socket_timeout() in c:\archivos de programa\apache group\apache\htdocs\moodletestwin.php on line 19"

Any ideas?
In reply to David Delgado

Re: Performance testing! - How to improve performance

by Janne Mikkonen -

Thanks David,

And I totally agree with you that Linux gives us much better performance. Thats why I'm using Linux on my production version. As you can see my test Linux have a very old 5,25" Bigfoot harddrive and still it performed much better than my Windows server.

The first one got this error:
"TCP/IP Connection
Fatal error: Call to undefined function: socket_create() in c:\archivos de programa\apache group\apache\htdocs\moodletest.php on line 19"


The fist script is for php versions 4.1.0 or better with socket -functions enabled from your php.ini -file.

The second one got this one:
"Connection nro: 1
TCP/IP connection
Fatal error: Call to undefined function: set_socket_timeout() in c:\archivos de programa\apache group\apache\htdocs\moodletestwin.php on line 19"

This second script is for older php -versions under 4. Newer versions doesn't have set_socket_timeout -functions anymore. If your running this second version under php version 4.1.0 or better, you must replace following functions:

  • set_socket_timeout -> socket_set_timeout
  • set_socket_blocking -> socket_set_blocking

 And if you really want to increase the server load, read more data into $out -buffer.

- Janne Mikkonen -

In reply to Janne Mikkonen

Re: Performance testing! - How to improve performance

by David Delgado -
Thank you, I had not activated the sockets library. I did now and I got this result:

Windows XP with latests updates, 512MB RAM, Pentium 4 at 1.6GHz, and Apache 1.3.24, PHP 4.3.1 as a module and MySQL NT 4.0.12, AND Norton Personal Firewall activated:

Result: 303.17 seconds (1.52 seconds per call)

Worse than a very old Linux box with one fourth of the memory, a CPU about 4 times slower and a worse software. Linux Power! wink

Note that the kernel of Windows XP is even better than the one for Windows 2000 (both are NT sons).

Of course, all these comparisons are very relative, since each Moodle home page is different and has a different number of selects to make. Anyway, mine are similar, and the fastest one is also the biggest smile .