-
Notifications
You must be signed in to change notification settings - Fork 7
High Performance
Magento was written for PHP 5.2 but has been kept up to date with all newer versions. PHP 7 is 30% faster than PHP 5 and HHVM is even faster than PHP 7. Whichever you use be sure to connect your web server with FastCGI.
Extra RESTful always sets a Cache-Control
header which makes it possible for intermediate caches/reverse proxies to work most efficiently. No other strategy increases performance as much as these options:
-
Apache with mod_cache and mod_cache_disk. If you are already using Apache then it is possible this solution is already installed and only needs configuring. Performance is respectable although it has trouble caching PHP output when the "Action" directive is used (as is typical for FastCGI), use "ProxyPass" instead.
-
NGINX is a load balancer first, web server second, and content caching was added as an afterthought. Still, it is one of the fastest choices. If operating as a web server use
fastcgi_cache
. If operating as a reverse proxy for another web server, such as Apache, useproxy_cache
. -
Varnish is a dedicated content cache which manages to be slower than NGINX. Varnish does not support encryption and needs the help of an SSL terminator, for which NGINX is typically used. So why not use NGINX instead of Varnish? If you also want to cache HTML content with Edge Side Includes (ESI, aka hole-punching) then Varnish is your only choice. For Magento, Turpentine makes configuration significantly easier. NGINX is not so much faster that it justifies having multiple caches, pick one or the other. The REST API does not directly benefit from ESI.
-
A Content Delivery Network (CDN) is ideal when an API's clients are geographically diverse such as with mobile apps and web apps. A CDN may have caches that are physically closer to clients and that reduces latency. A good CDN can be used to proxy all traffic, even the uncachable, and so protect your server from floods, DDOS, and other hacking attempts. CDN bandwidth is typically cheaper than a web host so might save money overall. Also it means less software to install and manage on your server, leaving the maintenance to professionals.
-
Squid is one of the slowest choices but has many features and is quite reliable thanks to it's long history of development. It is more often used as a general purpose web proxy than a site-specific reverse proxy.
-
Nuster is perhaps the fastest of all. Unfortunately it is new and largely unproven.