Moodle is a popular learning management system (LMS) solution used by many universities , schools around the world. Moodle is available in Azure Marketplace today and in this blog post Im going to dicsuss how to boost the app performance using Wincache.Windows Cache Extension for PHP(Wincache) is a PHP accelerator that is used to increase the speed of PHP applications running on Windows and Windows Server. Once the Windows Cache Extension for PHP is enabled and loaded by the PHP engine, PHP applications can take advantage of the functionality without any code modifications.
- Increase PHP application performance on Windows by caching PHP bytecode in memory
- Reduce file system I/O overhead by caching the PHP scripts in memory
- Leverage the User Cache API’s to further improve the execution speed of PHP scripts
- Avoid redundant mapping for absolute paths by using relative file path cache
Here are the steps to follow to setup a Moodle app in Azure Web Apps and configure Wincache
- Login in to Azure preview portal and New > Web + Mobile > Blogs+CMSs >Moodle to initiate a Moodle web app deployment . Enter the site name , resource group, database information and app service plan . It is recommended to run Moodle on Standard Pricing Tier ( S1 –S3 ) when selecting App service plan. Moodle has a large number of tables and it is recommended to use minimum of Titan pricing tier as you receive more storage for your database. ClearDB is the MySQL provider on Azure and they offer dedicated MySQL solution as mentioned here.
- Complete through Moodle installation script. To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access http://yourwebapp.azurewebsites.net/install.php directly.Moodle installer script will walk you through to complete the installation which requires writing to configuration files and updating the database with Moodle schema.
- Once the Moodle app is successfully installed with the installer script, we need to enable Wincache to boost performance of the app. Wincache is enabled by default on Azure web apps platform. Go to the your Moodle web apps Site Admin > Plugins> Caching> Configuration page .The WinCache plugin should be ready as a cache store, click the Add instance link .
- Enter an appropriate name for the instance, such as Shared memory access via WinCache .Click the Save Changes button.Now the WinCache plugin is ready to be used.
You have two options to enable it and configure specific definitions or enable it as a default store (most common). To enable WinCache as the default , do the following
- Go to the Moodle Web App Site Admin> Plugins > Caching > Configuration page, if not already there
- Under the Stores used when no mapping is present section, click the Edit mappings link
- Click the Application drop-down and choose the instance you just created above .Click the Save Changes button