Magento is still one of the best eCommerce platforms available for merchants looking to optimize the eCommerce experience. Between incredible functionality and unrivaled product management, it provides the ability to create storefronts that can’t be created in other, comparable applications.
We know that one of the top reasons merchants choose Magento is functionality. Yet great functionality requires a lot of server resources. As a result, Magento is a known resource hog.
With over twenty years of experience in hosting and thirteen years supporting Magento stores, we understand the application’s complex performance requirements. This article looks at four of our optimizations and how they make your store faster.
PHP code lies at the foundation of Magento, and there are multiple ways that a web server can be configured to execute that code. Even minor changes to default configurations can lead to significant Magento performance improvements.
Usually, when you install PHP support on a web server, an apache module called mod_php is set up. This module offers a simple set of configurations that will provide a Magento installation with the type of performance you’ll see with any web host.
We don’t accept the default mod_php file configurations. Instead, we use PHP FastCGI Process Manager, commonly known as php-fpm, on our servers.
PHP-FPM allows Magento sites to make use of memory and CPU resources more efficiently than its mod_php counterpart. This helps Magento sites to better manage content and serve websites faster.
Usually, a mod_php setup is configured so that each Apache httpd process also contains a copy of the PHP interpreter. This inevitably means a larger memory footprint – even for Apache threads serving requests for static assets.
Under our configuration, there are separate PHP processes to serve dynamic requests, so the web server can serve only requests for static assets. This also allows us to tune settings related to how these processes behave to improve responsiveness or reduce memory footprint.
A Fine-Tuned OPcache
PHP is an interpreted programming language. This means that when PHP code is executed it must be parsed by an interpreter. This interpreter organizes the code into an internal representation that can then be executed by the PHP runtime.
Parsing must take place within the interpreter before the code can even begin to run. Usually, parsing repeats every time a request is made. That means that every time someone visits a new page on your site, the parser kicks in.
This is where OPcache can help. OPcache helps by saving the internal representation of the code so it doesn’t need to be parsed for each request. For an application like Magento, which has tens of thousands of PHP files, this translates into a significant performance improvement.
As part of our strategy for optimizing performance for Magento, we’ve tuned the settings for OPcache to support a large number of compiled files. This translates to less time spent parsing PHP code and more time spent running useful code that helps customers access your Magento store.
NGINX-Based Cloud Accelerator
By implementing built in microcaching using NGINX, static assets can be stored and served directly from memory for a short period of time. This is particularly useful for highly trafficked stores that have a selection of very popular products, with NGINX meaning that each visitor page load is faster and uses less server resources.
Nginx also provides HTTP/2 protocol support, which allows for optimizations such as server push, where a web server or web application can tell a browser to download additional assets in response to a request.
Traditionally a browser would not start downloading additional assets until it encountered them during a page load. Server push means a browser can be told to download static and other assets immediately.
Automatic Processing Priority
All multi-tasking operating systems have a mechanism called a CPU scheduler. This component determines which tasks are allowed to use the CPU at a given time and to what extent. On Linux, this is done by assigning a “niceness” value to a process. The value is called this because it determines how “nice” the process is, or how big a share of CPU resources that process will get. The idea is that nicer processes use less CPU resources.
Nexcess has created a system that automatically changes the niceness value of running processes so that web critical processes (NGINX, apache httpd, php, mysql, etc) get CPU priority over less critical tasks. (compressing files, backups, etc).
Additionally, we run most maintenance tasks with a low CPU priority. This helps ensure that your website responds quickly even when administrative or scheduled tasks are running.
Get Started With Managed Magento
Magento optimization starts on the server and finishes in the application. Server optimizations can help to provide merchants with a solid foundation for creating the Magento experience they want, but the development process is still vital.
We always recommend testing new code and implementations on a dev site before you push to your production site. Dev sites allow Magento merchants and developers to test speed and performance in a secure environment.
Interested in learning more about how we help merchants to optimize the eCommerce experience? Click Here to see what features come with a Magento install.