Moodle and PHP 7 – Impact on speed and efficiency
Moodle and PHP 7: What does it mean for Moodle speed?
Moodle and PHP 7, the long sought after marriage is finally here! is an Open Source Learning Management System, used by educational and corporate entities worldwide. Moodle can manage many Moodle instances for organizations ranging from small sports clubs with a handful of users to universities and corporates with 100,000+ users.
For a while now people across the world are anticipating the use of PHP 7.0 for Moodle. The current stable version of PHP 5.4.4 is supported by Moodle and PHP 7.0 is hotly anticipated for Moodle.
Why PHP 7?
The PHP upgrade topic that many people are interested in is speed improvement. The faster things work, the better the user experience, the more likely people will love and use the LMS.
There are many new features in PHP 7, including spaceships! If you want to know more about it, check it out here: https://www.zend.com/en/resources/php-7.
The faster that PHP can read, compile and return the result of a request of the web server, the faster a Moodle page will load (which your learners care about) and the more requests your web hosting infrastructure can handle in a given time period (which your system administrators care about). According to the people who are responsible for it, the current stable version PHP 5.6 is slower, and PHP 7 is 25%-70% faster than PHP 5.6. The ability to make your web application roughly 70% faster simply by updating a (free) piece of software is a big deal.
How fast is it?
The tests used the apache server to request the “My Home” page in the Moodle 2.9 instance 10,000 times using 20 concurrent threads. For this test, the performance difference that PHP7 may deliver over PHP 5.6 in the request, compile, and return cycle was analyzed. The only difference between tests runs was the version of PHP. For the tests, the Operational Code Caching (opcache) was also disabled.
Test Results are shown below:
ms = milliseconds, lower is better.
Total Time is taken to complete requests:
PHP 7 : 952ms
PHP 5.6 : 1074ms
Time is taken to serve 95% of requests:
PHP 7 : 2562ms
PHP 5.6 : 3036ms
PHP7 completed the 10,000 requests 12% faster than PHP5.6. With 95% of requests taking 16% less time to complete with PHP7. The test results above clearly show a performance increase for PHP7. However, achieving a 16% performance improvement is still a very good increase for a web application.
All aboard for PHP7
So PHP7 is indeed faster. Should we be all making the move to PHP7 for Moodle? Well no, at least not quite yet…
So in a matter of speed PHP 7 will be the better option compared to PHP 5.6. Hoping that as early as possible we will be using Moodle LMS along with PHP 7.