Moodle 2 pages loading up to 2000% faster

Posted by TJ on Geeks with Blogs See other posts from Geeks with Blogs or by TJ
Published on Thu, 07 Jun 2012 08:10:25 GMT Indexed on 2012/06/07 10:41 UTC
Read the original article Hit count: 349

Filed under:

On average our Moodle 2 pages were loading in 2.8 seconds, now they load in as little as 0.12 seconds, so that’s like 2333.333% faster!

What was it I hear you say?

Well it was the database connection, or more correctly the database library. I was using FreeTDS http://docs.moodle.org/22/en/Installing_MSSQL_for_PHP, but now I’m using the new Microsoft Drivers 3.0 for PHP for SQL Server http://www.microsoft.com/en-us/download/details.aspx?id=20098.

I’m in a Windows Server IT department, and in both our live and development environments, we have Moodle 2.2.3, IIS 7.5, and PHP 5.3.10 running on two Windows Server 2008 R2 servers and using MS Network Load Balancing.

Since moving to Moodle 2, the pages have always loaded much more slowly than they did in Moodle 1.9, I’ve been chasing this issue for quite a while.
I had previously tried the Microsoft Drivers for PHP for SQL Server 2.0, but my testing showed it was slower than the FreeTDS driver.
Then yesterday I found Microsoft had released the new version, Microsoft Drivers 3.0 for PHP for SQL Server, so I thought I’d give it a run, and wow what a difference it made.
Pages that were loading in 2.8 seconds, now they load in as little as 0.12 seconds, 2333.333% faster…

I have more testing to do, but so far it’s looking good, I have scheduled multi user load testing for early next week (fingers crossed).

To make the change all I need to do was,

  • download the drivers
  • copy the relevant files to PHP\ext (for us they were php_pdo_sqlsrv_53_nts.dll and php_sqlsrv_53_nts.dll)
  • install the Microsoft SQL Server 2012 Native Client x64 http://www.microsoft.com/en-us/download/details.aspx?id=29065
  • add to PHP.ini, extension=php_pdo_sqlsrv_53_nts.dll, extension=php_sqlsrv_53_nts.dll
  • remove form PHP.ini, extension=php_dblib.dllv
  • change in PHP.ini, mssql.textlimit = 20971520 and mssql.textsize = 20971520
  • change Moodle config.php, $CFG->dbtype = 'sqlsrv'; and 'dbpersist' => True

and then reboot and test…

I've browsed courses, backed up/restored some really large and complicated courses, deleted courses etc. etc. all good.
Still more testing to do but, hey this is good start...

Hope this helps anyone experiencing the same slowness…

© Geeks with Blogs or respective owner