Home
%3CLINGO-SUB%20id%3D%22lingo-sub-814054%22%20slang%3D%22en-US%22%3EDeploying%20Moodle%20on%20Azure%20%E2%80%93%20things%20you%20should%20know%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-814054%22%20slang%3D%22en-US%22%3E%3CP%3EMoodle%20is%20one%20of%20the%20most%20popular%20open%20source%20learning%20management%20platform%20empowering%20educators%20and%20researchers%20across%20the%20world%20to%20disseminate%20their%20work%20efficiently.%20It%20is%20also%20one%20of%20the%20most%20matured%20and%20robust%20OSS%20application%20which%20is%20developed%20and%20improvised%20by%20the%20community%20over%20the%20years.%20We%20have%20seen%20customers%20deploying%20Moodle%20in%20Azure%20from%20small%2C%20medium%20and%20large%20enterprises%20to%20schools%2C%20public%20sector%20and%20government%20organizations.%20In%20this%20blog%20post%2C%20I%20will%20be%20sharing%20some%20of%20the%20best%20practices%20and%20tips%20for%20deploying%20Moodle%20on%20Azure%20based%20on%20our%20experience%20working%20with%20some%20of%20our%20customers.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20size%3D%225%22%3EProvisioning%20a%20Scalable%20Moodle%20Cluster%20on%20Azure%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETo%20simplify%20the%20deployment%20and%20provisioning%20of%20Moodle%20Cluster%20on%20Azure%2C%20our%20engineering%20team%20has%20developed%20some%20canned%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FMoodle%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Resource%20Manager%20(ARM)%20templates%3C%2FA%3Eand%20made%20it%20available%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FMoodle%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ein%20our%20GitHub%20repository%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20Azure%20account%2C%20you%20can%20deploy%20Moodle%20via%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20portal%3C%2FA%3E%26nbsp%3Busing%20the%20button%20below%2C%20or%20you%20can%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FMoodle%2Fblob%2Fmaster%2Fdocs%2FDeploy.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edeploy%20Moodle%20via%20the%20CLI%3C%2FA%3E.%20Please%20note%20that%20while%20you%20can%20use%20an%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Ffree%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20free%20account%3C%2FA%3E%26nbsp%3Bto%20get%20started%20depending%20on%20which%20template%20configuration%20you%20choose%20you%20will%20likely%20be%20required%20to%20upgrade%20to%20a%20paid%20account.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBelow%20is%20a%20list%20of%20pre-defined%20deployment%20options%20based%20on%20typical%20deployment%20scenarios%20(i.e.%20dev%2Ftest%2C%20production%20etc.).%20All%20configurations%20are%20fixed%2C%20and%20you%20just%20need%20to%20pass%20your%20ssh%20public%20key%20to%20the%20template%20for%20logging%20in%20to%20the%20deployed%20VMs.%20For%20production%20deployments%2C%20%3CSTRONG%3Elarge%20size%20or%20Maximum%20template%3C%2FSTRONG%3Ebelow%20is%20highly%20recommended%20which%20provisions%20high%20performance%20SKUs%20and%20configures%20the%20environment%20for%20high%20availability.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22height%3A%20492px%3B%20width%3A%201000px%3B%20margin-left%3A%20auto%3B%20margin-right%3A%20auto%3B%22%20width%3D%221000%22%3E%0A%3CTHEAD%3E%0A%3CTR%20style%3D%22height%3A%2053px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%2053px%3B%20width%3A%20200px%3B%22%3E%3CP%3E%3CSTRONG%3EDeployment%20Type%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2053px%3B%20width%3A%20650px%3B%22%3E%3CP%3E%3CSTRONG%3EDescription%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2053px%3B%20width%3A%2050px%3B%22%3E%3CP%3E%3CSTRONG%3EEstimated%20Cost%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2053px%3B%20width%3A%20150px%3B%22%3E%3CP%3E%3CSTRONG%3ELaunch%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTHEAD%3E%0A%3CTBODY%3E%0A%3CTR%20style%3D%22height%3A%20132px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%20132px%3B%20width%3A%20212.5px%3B%22%3E%3CP%3EMinimal%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20132px%3B%20width%3A%20916.25px%3B%22%3E%3CP%3EThis%20deployment%20will%20use%20NFS%2C%20Azure%20Database%20for%20MySQL%2C%20and%20smaller%20autoscale%20web%20frontend%20VM%20sku%20(1%20core)%20that'll%20give%20faster%20deployment%20time%20(less%20than%2030%20minutes)%20and%20requires%20only%202%20VM%20cores%20currently%20that'll%20fit%20even%20in%20a%20free%20trial%20Azure%20subscription.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20132px%3B%20width%3A%20107.5px%3B%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.com%2Fe%2F5f9752c934ab41799ae3264dd2ee57d1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Elink%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20132px%3B%20width%3A%20162.5px%3B%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%23create%2FMicrosoft.Template%2Furi%2Fhttps%253A%252F%252Fraw.githubusercontent.com%252FAzure%252FMoodle%252Fmaster%252Fazuredeploy-minimal.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127715i2D1B94B13C4C1754%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%20106px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%20106px%3B%20width%3A%20212.5px%3B%22%3E%3CP%3ESmall%20to%20Mid-Size%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20106px%3B%20width%3A%20916.25px%3B%22%3E%3CP%3ESupporting%20up%20to%201000%20concurrent%20users.%20This%20deployment%20will%20use%20NFS%20(no%20high%20availability)%20and%20MySQL%20(8%20vCores)%2C%20without%20other%20options%20like%20elastic%20search%20or%20redis%20cache.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20106px%3B%20width%3A%20107.5px%3B%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.com%2Fe%2Ffd794268d0bf421aa17c626fb88f25bc%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Elink%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%23create%2FMicrosoft.Template%2Furi%2Fhttps%253A%252F%252Fraw.githubusercontent.com%252FAzure%252FMoodle%252Fmaster%252Fazuredeploy-small2mid-noha.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127715i2D1B94B13C4C1754%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%20106px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%20106px%3B%20width%3A%20212.5px%3B%22%3E%3CP%3ELarge%20size%20deployment%20(with%20high%20availability)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20106px%3B%20width%3A%20916.25px%3B%22%3E%3CP%3ESupporting%20more%20than%202000%20concurrent%20users.%20This%20deployment%20will%20use%20Gluster%20(for%20high%20availability%2C%20requiring%202%20VMs)%2C%20MySQL%20(16%20vCores)%20and%20redis%20cache%2C%20without%20other%20options%20like%20elastic%20search.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%20106px%3B%20width%3A%20107.5px%3B%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.com%2Fe%2F078f7294ab6544e8911ddc2ee28850d7%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Elink%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%23create%2FMicrosoft.Template%2Furi%2Fhttps%253A%252F%252Fraw.githubusercontent.com%252FAzure%252FMoodle%252Fmaster%252Fazuredeploy-large-ha.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127715i2D1B94B13C4C1754%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22height%3A%2095px%3B%22%3E%0A%3CTD%20style%3D%22height%3A%2095px%3B%20width%3A%20212.5px%3B%22%3E%3CP%3EMaximum%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2095px%3B%20width%3A%20916.25px%3B%22%3E%3CP%3EThis%20maximal%20deployment%20will%20use%20Gluster%20(for%20high%20availability%2C%20adding%202%20VMs%20for%20a%20Gluster%20cluster)%2C%20MySQL%20with%20highest%20SKU%2C%20redis%20cache%2C%20elastic%20search%20(3%20VMs)%2C%20and%20pretty%20large%20storage%20sizes%20(both%20data%20disks%20and%20DB).%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20style%3D%22height%3A%2095px%3B%20width%3A%20107.5px%3B%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.com%2Fe%2Fe0f959b93ed84eb891dcc44f7883f5b5%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Elink%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%23create%2FMicrosoft.Template%2Furi%2Fhttps%253A%252F%252Fraw.githubusercontent.com%252FAzure%252FMoodle%252Fmaster%252Fazuredeploy-maximal.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127715i2D1B94B13C4C1754%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENOTE%3C%2FSTRONG%3E%3A%20Depending%20on%20the%20region%20you%20choose%20to%20deploy%20the%20stack%20in%20-%20the%20deployment%20might%20fail%20due%20to%20SKUs%20being%20hardcoded%20in%20the%20template%20where%20they%20are%20not%20available.%20If%20your%20deployment%20fails%2C%20please%20revert%20to%20the%20fully%20configurable%20template%20and%20change%20the%20SKU%20parameter%20to%20one%20that%20exists%20in%20your%20region%20(i.e.%20Gen-5).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20template%20deploys%20the%20following%20architecture%20in%20Azure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20689px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127721iB3D4F4AE21793BC9%2Fimage-dimensions%2F689x355%3Fv%3D1.0%22%20width%3D%22689%22%20height%3D%22355%22%20alt%3D%22clipboard_image_4.png%22%20title%3D%22clipboard_image_4.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20size%3D%225%22%3EConfiguring%20Azure%20Database%20for%20MySQL%20for%20performance%20and%20scale%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EMoodle%20supports%20multiple%20databases%20like%20MySQL%2C%20PostgreSQL%20or%20SQL%20Server%20but%20the%20best%20performance%20and%20scale%20for%20Moodle%20is%20observed%20with%20MySQL%20database.%20As%20a%20result%2C%20MySQL%20is%20a%20preferred%20choice%20for%20customers%20and%20community%20when%20deploying%20Moodle%20for%20large%20number%20of%20concurrent%20users%20(1K%20%E2%80%93%2010K).%20Azure%20Database%20for%20MySQL%20is%20a%20fully%20managed%20database%20service%20with%20built-in%20high%20availability%2C%20elastic%20scaling%20and%20automatic%20backups.%20Leveraging%20a%20managed%20service%20ensures%20you%20do%20not%20have%20to%20worry%20about%20managing%20your%20database%20for%20backups%2C%20high%20availability%20and%20setting%20up%20additional%20database%20monitoring.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20provisioning%20Azure%20Database%20for%20MySQL%20server%20for%20Moodle%20deployments%2C%20following%20is%20the%20recommended%20tier%20which%20provides%20best%20price%20to%20performance%20ratio.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22208%22%3E%3CP%3E%3CSTRONG%3EConcurrent%20Users%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22224%22%3E%3CP%3E%3CSTRONG%3ECompute%20(vCores)%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22191%22%3E%3CP%3E%3CSTRONG%3EStorage%20Tier%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22208%22%3E%3CP%3E%3CSTRONG%3E%26lt%3B%201000%20Users%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22224%22%3E%3CP%3E8%20vCores%20%E2%80%93%20General%20Purpose%20tier%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22191%22%3E%3CP%3E1TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22208%22%3E%3CP%3E%3CSTRONG%3E1K%20%E2%80%93%202K%20Users%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22224%22%3E%3CP%3E16%20vCores%20%E2%80%93%20General%20Purpose%20Tier%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22191%22%3E%3CP%3E2TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22208%22%3E%3CP%3E%3CSTRONG%3E2K%20%E2%80%93%205K%20Users%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22224%22%3E%3CP%3E32%20vCores%20%E2%80%93%20General%20Purpose%20Tier%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22191%22%3E%3CP%3E2TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22208%22%3E%3CP%3E%3CSTRONG%3E%26gt%3B%205K%20Users%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22224%22%3E%3CP%3E32%20-%2064%20vCores%20%E2%80%93%20General%20Purpose%20Tier%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22191%22%3E%3CP%3E2TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20notice%2C%20the%20recommendation%20for%20Storage%20tier%20is%202TB%20for%20higher%20concurrenct%20users%20irrespective%20of%20the%20size%20of%20the%20database.%20This%20is%20due%20to%20fact%20that%20in%20Azure%20Database%20for%20MySQL%20service%2C%20IOPs%20is%20not%20charged%20separately%20and%20it%20increases%20progressively%20with%20storage%20size%20provisioned%20(~3%20IOPs%2FGB).%20With%202TB%2C%20you%20get%206000%20provisioned%20IOPs%20which%20is%20recommended%20and%20required%20for%20Moodle%20when%20the%20number%20of%20concurrent%20users%20exceeds%201000%20users.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20addition%20to%20server%20scaling%2C%20configuring%20the%20right%20server%20parameters%20also%20plays%20an%20important%20role%20in%20the%20performance%20of%20Moodle%20application%20as%20recommended%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.moodle.org%2F37%2Fen%2FPerformance_recommendations%23MySQL_performance%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eofficial%20documentation%3C%2FA%3E.%20%26nbsp%3BYou%20can%20leverage%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fhowto-server-parameters%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20portal%3C%2FA%3Eor%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fhowto-configure-server-parameters-using-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20CLI%3C%2FA%3Eto%20configure%20the%20following%20server%20parameters%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EEnable%20the%26nbsp%3B%3CSTRONG%3Equery%20cache%3CBR%20%2F%3E%3C%2FSTRONG%3Equery_cache_type%20%3D%201%3CBR%20%2F%3Equery_cache_size%20%3D%2036M%3CBR%20%2F%3Equery_cache_min_res_unit%20%3D%202K%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3EIncrease%20the%20size%20of%20%3CSTRONG%3Eopen%20table%20cache%3C%2FSTRONG%3E%3CBR%20%2F%3Etable_open_cache%20%3D%201024%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3EIf%20you%20are%20migrating%20or%20restoring%20an%20existing%20Moodle%20database%20to%20Azure%20Database%20for%20MySQL%20service%2C%20it%20is%20recommended%20to%20perform%20%3CSTRONG%3EOPTIMIZE%20ALL%20%3C%2FSTRONG%3Eon%20the%20tables%20in%20the%20database%20following%20the%20restore.%20If%20it%20is%20a%20new%20deployment%20with%20no%20preexisting%20data%2C%20you%20can%20skip%20this%20step%3CBR%20%2F%3Emysqlcheck%20-a%20moodle%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3ELastly%2C%20we%20would%20highly%20recommend%20to%20%3CSTRONG%3Eenable%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-query-performance-insight%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EQuery%20Performance%20Insights%3C%2FA%3E%3C%2FSTRONG%3Eon%20your%20Azure%20Database%20for%20MySQL%20server%20which%20is%20an%20opt-in%20monitoring%20feature%20available%20at%20no%20additional%20cost.%20This%20will%20enable%20you%20to%20monitor%20and%20identify%20long%20running%20and%20slow%20performing%20queries%20on%20the%20database%20which%20might%20lead%20to%20poor%20performance%20or%20slowness%20in%20the%20application%3CBR%20%2F%3E%3CBR%20%2F%3EQuery%20Performance%20Insights%20can%20be%20enabled%20by%20enabling%20%3CA%20style%3D%22font-family%3A%20inherit%3B%20background-color%3A%20%23ffffff%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-query-store%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Equery%20store%3C%2FA%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3Ewhich%20requires%20setting%20the%20following%20server%20parameters%20from%20Azure%20Portal%3CBR%20%2F%3E%3C%2FSPAN%3ESet%20query_store_capture_mode%20to%20%3CSTRONG%3EALL%3CBR%20%2F%3E%3C%2FSTRONG%3ESet%20query_store_wait_sampling_capture_mode%20to%20%3CSTRONG%3EALL%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3ETo%20give%20you%20an%20example%20of%20relevance%20of%20this%20feature%20in%20performance%20tuning%2C%20I%20want%20to%20share%20the%20following%20screenshot%20of%20the%20Long%20Running%20Queries%20report%20for%20a%20Moodle%20application%20running%203K%20concurrent%20users%20which%20was%20seeing%20an%20avg%20response%20time%20of%20%26gt%3B%20100%20seconds%20which%20was%20unacceptable.%3CBR%20%2F%3E%3CBR%20%2F%3EAfter%20turning%20ON%20Query%20Performance%20Insights%2C%20we%20were%20able%20to%20identify%20the%20top%20query%20(Query%20ID%201065)%20in%20the%20report%20below%20which%20further%20enabled%20us%20to%20discover%20that%20we%20are%20hitting%20a%20known%26nbsp%3B%3CA%20style%3D%22font-family%3A%20inherit%3B%20background-color%3A%20%23ffffff%3B%22%20href%3D%22https%3A%2F%2Ftracker.moodle.org%2Fbrowse%2FMDL-54035%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ebug%3C%2FA%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%26nbsp%3Bin%20Moodle%20causing%20slow%20performance%20in%20the%20application.%20On%20applying%20the%20workaround%20suggested%20in%20the%20bug%20tracker%20of%20truncating%20the%20expired%20cache%20in%20mdl_cache_flags%20table%20and%20creating%20indexes%20on%20expiry%20and%20timemodified%20columns%2C%20the%20performance%20was%20back%20to%20%26lt%3B%2010%20seconds%20which%20was%20expected.%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20760px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127720iB38B94CC9EACF429%2Fimage-dimensions%2F760x444%3Fv%3D1.0%22%20width%3D%22760%22%20height%3D%22444%22%20alt%3D%22clipboard_image_5.png%22%20title%3D%22clipboard_image_5.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%225%22%3E%0A%3CLI%3EIt%20is%20also%20important%20to%20check%20and%20validate%20that%20binlog%20and%20slow_query_log%20is%20disabled%20as%20it%20may%20cause%20additional%20IO%20overhead%20and%20adds%20slowness%20to%20the%20server%20for%20high%20concurrent%20users.%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BEnsure%3CSTRONG%3Elog_bin%3C%2FSTRONG%3Eis%20set%20to%3CSTRONG%3EOFF%3C%2FSTRONG%3E%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BEnsure%20%3CSTRONG%3Eslow_query_log%3C%2FSTRONG%3Eis%20set%20to%20%3CSTRONG%3EOFF%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFinally%2C%20it%20is%20important%20to%20leverage%20%3CA%20href%3D%22https%3A%2F%2Fdocs.moodle.org%2F37%2Fen%2FSession_handling%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ERedis%20Cache%20for%20Session%20handling%3C%2FA%3Eand%20%3CA%20href%3D%22https%3A%2F%2Fdocs.moodle.org%2F37%2Fen%2FOPcache%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOPCache%20%3C%2FA%3Eto%20ensure%20MySQL%20database%20is%20not%20flooded%20with%20queries%20as%20caching%20can%20help%20alleviate%20a%20lot%20of%20pressure%20on%20the%20backend%20database%20and%20improve%20the%20overall%20performance%20and%20scale%20for%20the%20application.%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-2013912406%22%20id%3D%22toc-hId-2013912406%22%3ENext%20Steps%3C%2FH1%3E%0A%3CP%3EGet%20started%20by%20deploying%20your%20Moodle%20application%20on%20Azure%20using%20the%20above%20template.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20some%20feedback%20or%20discover%20any%20additional%20finding%2C%20please%20reach%20out%20to%20us%20%3CA%20href%3D%22mailto%3AAskAzureDBforMySQL%40service.microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAskAzureDBforMySQL%40service.microsoft.com%3C%2FA%3Eand%20we%20will%20be%20happy%20to%20incorporate%20it%20to%20our%20blog.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EParikshit%20Savjani%3CBR%20%2F%3ESenior%20Program%20Manager%2C%20Microsoft%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-814054%22%20slang%3D%22en-US%22%3E%3CP%3EMoodle%20is%20one%20of%20the%20most%20popular%20open%20source%20learning%20management%20platform%20empowering%20educators%20and%20researchers%20across%20the%20world%20to%20disseminate%20their%20work%20efficiently.%20It%20is%20also%20one%20of%20the%20most%20matured%20and%20robust%20OSS%20application%20which%20is%20developed%20and%20improvised%20by%20the%20community%20over%20the%20years.%20We%20have%20seen%20customers%20deploying%20Moodle%20in%20Azure%20from%20small%2C%20medium%20and%20large%20enterprises%20to%20schools%2C%20public%20sector%20and%20government%20organizations.%20In%20this%20blog%20post%2C%20I%20will%20be%20sharing%20some%20of%20the%20best%20practices%20and%20tips%20for%20deploying%20Moodle%20on%20Azure%20based%20on%20our%20experience%20working%20with%20some%20of%20our%20customers.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-814054%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Database%20for%20MySQL%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMoodle%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

Moodle is one of the most popular open source learning management platform empowering educators and researchers across the world to disseminate their work efficiently. It is also one of the most matured and robust OSS application which is developed and improvised by the community over the years. We have seen customers deploying Moodle in Azure from small, medium and large enterprises to schools, public sector and government organizations. In this blog post, I will be sharing some of the best practices and tips for deploying Moodle on Azure based on our experience working with some of our customers.

 

Provisioning a Scalable Moodle Cluster on Azure

To simplify the deployment and provisioning of Moodle Cluster on Azure, our engineering team has developed some canned Azure Resource Manager (ARM) templates and made it available in our GitHub repository.

 

If you have Azure account, you can deploy Moodle via the Azure portal using the button below, or you can deploy Moodle via the CLI. Please note that while you can use an Azure free account to get started depending on which template configuration you choose you will likely be required to upgrade to a paid account.

 

Below is a list of pre-defined deployment options based on typical deployment scenarios (i.e. dev/test, production etc.). All configurations are fixed, and you just need to pass your ssh public key to the template for logging in to the deployed VMs. For production deployments, large size or Maximum template below is highly recommended which provisions high performance SKUs and configures the environment for high availability.

 

Deployment Type

Description

Estimated Cost

Launch

Minimal

This deployment will use NFS, Azure Database for MySQL, and smaller autoscale web frontend VM sku (1 core) that'll give faster deployment time (less than 30 minutes) and requires only 2 VM cores currently that'll fit even in a free trial Azure subscription.

link

clipboard_image_0.png

Small to Mid-Size

Supporting up to 1000 concurrent users. This deployment will use NFS (no high availability) and MySQL (8 vCores), without other options like elastic search or redis cache.

link

clipboard_image_0.png

Large size deployment (with high availability)

Supporting more than 2000 concurrent users. This deployment will use Gluster (for high availability, requiring 2 VMs), MySQL (16 vCores) and redis cache, without other options like elastic search.

link

clipboard_image_0.png

Maximum

This maximal deployment will use Gluster (for high availability, adding 2 VMs for a Gluster cluster), MySQL with highest SKU, redis cache, elastic search (3 VMs), and pretty large storage sizes (both data disks and DB).

link

clipboard_image_0.png

 

NOTE: Depending on the region you choose to deploy the stack in - the deployment might fail due to SKUs being hardcoded in the template where they are not available. If your deployment fails, please revert to the fully configurable template and change the SKU parameter to one that exists in your region (i.e. Gen-5).

 

The template deploys the following architecture in Azure.

 

clipboard_image_4.png

 

 

Configuring Azure Database for MySQL for performance and scale

Moodle supports multiple databases like MySQL, PostgreSQL or SQL Server but the best performance and scale for Moodle is observed with MySQL database. As a result, MySQL is a preferred choice for customers and community when deploying Moodle for large number of concurrent users (1K – 10K). Azure Database for MySQL is a fully managed database service with built-in high availability, elastic scaling and automatic backups. Leveraging a managed service ensures you do not have to worry about managing your database for backups, high availability and setting up additional database monitoring.

 

When provisioning Azure Database for MySQL server for Moodle deployments, following is the recommended tier which provides best price to performance ratio.

 

Concurrent Users

Compute (vCores)

Storage Tier

< 1000 Users

8 vCores – General Purpose tier

1TB

1K – 2K Users

16 vCores – General Purpose Tier

2TB

2K – 5K Users

32 vCores – General Purpose Tier

2TB

> 5K Users

32 - 64 vCores – General Purpose Tier

2TB

 

If you notice, the recommendation for Storage tier is 2TB for higher concurrenct users irrespective of the size of the database. This is due to fact that in Azure Database for MySQL service, IOPs is not charged separately and it increases progressively with storage size provisioned (~3 IOPs/GB). With 2TB, you get 6000 provisioned IOPs which is recommended and required for Moodle when the number of concurrent users exceeds 1000 users.

 

In addition to server scaling, configuring the right server parameters also plays an important role in the performance of Moodle application as recommended in the official documentation.  You can leverage Azure portal or Azure CLI to configure the following server parameters

 

  1. Enable the query cache
    query_cache_type = 1
    query_cache_size = 36M
    query_cache_min_res_unit = 2K

 

  1. Increase the size of open table cache
    table_open_cache = 1024

 

  1. If you are migrating or restoring an existing Moodle database to Azure Database for MySQL service, it is recommended to perform OPTIMIZE ALL on the tables in the database following the restore. If it is a new deployment with no preexisting data, you can skip this step
    mysqlcheck -a moodle

 

  1. Lastly, we would highly recommend to enable Query Performance Insights on your Azure Database for MySQL server which is an opt-in monitoring feature available at no additional cost. This will enable you to monitor and identify long running and slow performing queries on the database which might lead to poor performance or slowness in the application

    Query Performance Insights can be enabled by enabling query store which requires setting the following server parameters from Azure Portal
    Set query_store_capture_mode to ALL
    Set query_store_wait_sampling_capture_mode to ALL

    To give you an example of relevance of this feature in performance tuning, I want to share the following screenshot of the Long Running Queries report for a Moodle application running 3K concurrent users which was seeing an avg response time of > 100 seconds which was unacceptable.

    After turning ON Query Performance Insights, we were able to identify the top query (Query ID 1065) in the report below which further enabled us to discover that we are hitting a known bug in Moodle causing slow performance in the application. On applying the workaround suggested in the bug tracker of truncating the expired cache in mdl_cache_flags table and creating indexes on expiry and timemodified columns, the performance was back to < 10 seconds which was expected.

    clipboard_image_5.png

  

  1. It is also important to check and validate that binlog and slow_query_log is disabled as it may cause additional IO overhead and adds slowness to the server for high concurrent users.
             Ensure log_bin is set to OFF
             Ensure slow_query_log is set to OFF

 

Finally, it is important to leverage Redis Cache for Session handling and OPCache to ensure MySQL database is not flooded with queries as caching can help alleviate a lot of pressure on the backend database and improve the overall performance and scale for the application.

Next Steps

Get started by deploying your Moodle application on Azure using the above template.

 

If you have some feedback or discover any additional finding, please reach out to us AskAzureDBforMySQL@service.microsoft.com and we will be happy to incorporate it to our blog.

 

Parikshit Savjani
Senior Program Manager, Microsoft