This article is contributed. See the original author and article here.

Overview


Magento is an open-source e-commerce application based on the LAMP (Linux, Apache, MySQL, and PHP) stack. As more customers using Magento move from on-premises implementations or other cloud platforms to Azure, we wanted to provide out-of-the-box configuration recommendations to ensure easy deployment and stable, solid performance.


 


We spent months testing Magento performance on Azure, and we learned a lot during the process. Today we’re pleased to announce the availability of Magento e-commerce in Azure Kubernetes Service (AKS) guidance on the Azure Architecture Center. This detail is designed for developers and architects who are planning to deploy Magento on Azure.


 


Solution architecture


The solution architecture for Magento running in AKS is shown in the following diagram.


magento-architecture.png


 


Key services


The key services involved in this solution architecture are described below.



  • AKS deploys the Kubernetes cluster of Varnish, Magento, Redis, and Elasticsearch in different pods.

  • AKS creates a virtual network to deploy the agent nodes. Create the virtual network in advance to set up subnet configuration, private link, and egress restriction.

  • Varnish installs in front of the HTTP servers to act as a full-page cache.

  • Azure Database for MySQL stores transaction data such as orders and catalogs. Using version 8.0 is recommended.

  • Azure Files Premium or an equivalent network-attached storage (NAS) system stores media files such as product images. Magento needs a Kubernetes-compatible file system such as Azure Files Premium or Azure NetApp Files, which can mount a volume in ReadWriteMany mode.

  • A content delivery network (CDN) serves static content such as CSS, JavaScript, and images. Serving content through a CDN minimizes network latency between users and the datacenter. A CDN can remove significant load from NAS by caching and serving static content.

  • Redis stores session data. Hosting Redis on containers is recommended for performance reasons.

  • AKS uses an Azure Active Directory (Azure AD) identity to create and manage other Azure resources like Azure load balancers, user authentication, role-based access control, and managed identity.

  • Azure Container Registry stores the private Docker images that are deployed to the AKS cluster. You can use other container registries like Docker Hub. Note that the default Magento install writes some secrets to the image.

  • Azure Monitor collects and stores metrics and logs, including Azure service platform metrics and application telemetry. Azure Monitor integrates with AKS to collect controller, node, and container metrics, and container and master node logs.


 


Key learnings


A summary of the key learnings we gained during this engagement are listed below.



  • We achieved more throughput by additional components such as Varnish, Redis, etc.

  • Turning off product count from layered navigation reduced the MySQL CPU consumption.

  • %CPU at NFS significantly went down by caching static content in CDN.

  • Turning off weblog from Varnish gave us additional performance gain.


 


I hope you find this guidance useful when setting up Magento in your own environment!


 


If you have questions or issues setting up Magento using Azure Database for MySQL, please contact the Azure Database for MySQL team at AskAzureDBforMySQL@service.microsoft.com.


 


Acknowledgements


My thanks go out to everyone who contributed to this project. I’d especially like to thank Darren Rich, Anil Dogra, Garima Gupta, Sumit Dua, Krishnakumar Ravi, Raj Sellappan, and Sakthi Vetrivel, who helped us conduct the performance testing and found/fixed many bottlenecks. In addition, Andrew Oakley, Lakshmikant Gundavarapu, and Parichit Sahay organized and executed countless work items to us achieve our goal.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.