Magento – Magento 2 server in production become slow and not responding

magento-2.1.2performanceserver-setup

The server become slow when approximate 1000 users access the site at the same time, and later the server not responding at all (blank page).

I did the following tasks:

  • Production mode enable

  • Full cache enable

  • Compile the code (setup:di:compile)

  • Deploy static content (setup:static-content:deploy)

  • Merge JavaScript Files

  • Minify JavaScript Files

  • Merge CSS Files

  • Minify CSS Files

  • Apache GZIP compression

  • Enable use flat catalog category

Server

  • 32 RAM

  • 8 cores

I want to know what another thing can I do to improve the server performance and avoid the server crash?

Thank you very much.

Best Answer

There are several steps to prepare for better performance:

  • Review the store's code and seek in the extensions you have installed for poor performance code.
  • Look in PHP/Apache logs if there is code that does infinite loops. There are extensions that do this. Infinite loops can quickly block all your server's traffic.
  • Add Varnish. It's the recommended page cache solution in Magento 2 and easy to setup. http://devdocs.magento.com/guides/v2.1/config-guide/varnish/config-varnish-magento.html
  • Use Redis as backend cache (see devdocs.mgento.com)
  • Use for sessions Memcached or Redis http://devdocs.magento.com/guides/v2.1/config-guide/memcache/memcache_magento.html
  • Have a CDN setup for your store
  • Put all Magento's indexers on Update by Schedule. It will re-index once in a minute and not immediately after customer's purchase. Indexer also triggers cache flushes (product pages, category pages). You can increase in Admin how often cron indexer runs.
  • While the traffic is high, try to minimize as much of possible to save products and categories. When admins do save products or categories, the cache of the stored is flushed and it has effect on customer's experience.
  • To minimize cache flushes after customer purchase in checkout use an extension like https://marketplace.magento.com/innovo-module-cache-improve.html In Magento 2 default, after each purchase the cache is cleaned on related pages with the bought products.
  • If one sever is not enough, than put your Magento 2 store on a cluster with multiple frontends, Varnish in front of them and your MySQL servers in salve/master mode.
Related Topic