Moodle & PHP 7.0 (RC4) - Performance Retake

Moodle & PHP 7.0 (RC4) - Performance Retake

by Usman Asar -
Number of replies: 10
Picture of Plugin developers Picture of Testers

Back in June, I did manage to test PHP 7.0 (Alpha release 1) on my IIS 8.5 / MariaDB where I noticed 30% (not calculated) performance increase using PHP 7. While I have done re-tests to know performance difference, which you'll be able to find in screen shots/ tables below.

Recently my one of the shared hosting provider made PHP 7.0 (RC 4) available making me thinking of testing the claim of faster performance in PHP 7 and how much performance increase can be achieved particularly in Moodle. Whilst I already tested PHP 7 the day it released as Beta and I was impressed with results, but few things didn't worked for me to wait until RC versions started coming out. This tests includes both cases of Zend OpCache enabled and disabled so users can have idea how much OpCache alone can bring difference to the Moodle's performance.

I am using shared hosting environment with following resources allocated.

One thing to mention here, the web server I am using is LiteSpeed as opposed to Apache, so those who want to test on theirs, your results may vary based on plenty of factors and that includes web server performance factor where LiteSpeed is faster in performance when compared to Apache.

I haven't done advance tests like JMeter, for I am limited with what I can and cannot do on a shared hosting environment. So I am relying on "Performance Information" from the footer of the theme. The theme I am using is Elegance (Latest one), for I have mentioned theme for different themes have different code to render the page effecting the whole output.

Test is done on a course page with 7 Labels and 77 Page Module links (so fairly moderate course size). Browser window is refreshed 3 times before taking readings.

The tests were done using:

PHP 5.6 - OpCache Disabled

PHP 5.6 - OpCache Enabled

PHP 7.0 (RC4) - OpCache Disabled

PHP 7.0 (RC4) - OpCache Enabled

I am attaching the screen shots of "Performance Info" from Theme footer.


Test 1 - PHP 5.6 - OpCache Disabled


Test 2 - PHP 5.6 - OpCache Enabled

For those who want to know if using OpCache really makes a difference, then this above screenshot will be good enough to prove that, where not only time taken to render the page has decreased, as well amount of memory used has drastically reduced.

Test 3 - PHP 7.0 (RC4) - OpCache Disabled

Where just using PHP 7.0 roughly took same time, but see the amount of memory used, its almost halfed.

Test 4 - PHP 7.0 (RC4) - OpCache Enabled


And summarizing below, with % of improvement over PHP 5.6 both with and without using OpCache.



Now I am looking forward to Tim if he can manage to do the high level tests using JMeter etc.

Average of ratings: Useful (3)
In reply to Usman Asar

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Usman Asar -
Picture of Plugin developers Picture of Testers

apologies, % figure was embedded old, true % is as below


Average of ratings: Useful (1)
In reply to Usman Asar

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Paul Verrall -

Hi Usman

I guess this will come as no surprise, but I have been able to replicate you results very closely on my environment over at moopi.uk

Using php 7.0.3 Both un-cached initial page loads and subsequent reloads all benefited from at least a 30% increase over php 5.6. My best results were seen in 'Course editing' with a ~39% increase.

As you can imaging gains of this magnitude are very welcome on such a minimally resourced deployment smile

In reply to Paul Verrall

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Usman Asar -
Picture of Plugin developers Picture of Testers

Hello Paul,

Indeed it's even getting better, if ARM based CPU can achieve that much of performance, imagine the x86 architecture. Once again we are hitting the time of Moodle 1.9's requirements.

I really like the color scheme matching the Raspberry colour smile

In reply to Usman Asar

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Thanks for sharing this. I doubt I will be the first to do proper JMeter tests of PHP7. I hope someone does soon.

In reply to Tim Hunt

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

There you go: PHP 5.5 vs 7 on Moodle 3. Would be nice for someone else to reproduce our results.

Tomek

Average of ratings: Useful (1)
In reply to Tomasz Muras

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Usman Asar -
Picture of Plugin developers Picture of Testers
Cheers Tomek for a detailed test, every successful tests showing improvements on PHP 7 brings smile to my face for Moodle is once again reaching capability to be handled easily on a shared hosting environment without hiccups since version 1.9.
Using MariaDB would have showed even more improvements.
In reply to Usman Asar

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In reply to Visvanath Ratnaweera

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

We are actively working on Moodle compatibility with PHP7 and we aim to backport all necessary changes to 2.9 and 3.0:

https://tracker.moodle.org/browse/MDL-50565

Average of ratings: Useful (1)
In reply to Marina Glancy

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Just an update here - we will not backport to 2.9 because it is too risky. If all the testing goes well, 3.0.1 will be PHP7 compatible (to be released Dec 21st)

Average of ratings: Useful (3)
In reply to Marina Glancy

Re: Moodle & PHP 7.0 (RC4) - Performance Retake

by Usman Asar -
Picture of Plugin developers Picture of Testers

Thanks Marina, that is a quick turn around I must say, for me even PHP 7 on next Major release in May would be more than acceptable.

Thanks again for a quick response.