# Performance

**The LokiCheckout extensions mainly replace the regular Magento 2 checkout with a faster frontend tooling. When it comes to heavy loads, the custom JavaScript architecture, the bundled AJAX updates and the throttling of the AJAX queue, make sure that less calls to the server are needed. Still, if your Magento checkout is under heavy load (like with Black Friday or specific mailings), it makes sense to add additional tuning. This is out-of-the-scope of the LokiCheckout, because tuning is done mostly on the server-level. But this document might serve as a good reference point for what to tune.**

Note that the LokiCheckout core creates a separate Loki Component for every single address field. This makes sure that validation and page updates are instant. Yet, it also requires a quote save for every field that is being saved.

### Tuning the checkout
Temporarily switch of live API calls for specific shipping methods and/or payment methods. For instance, prefer table rates or carrier quotes. Minimize the number of cart price rules.

### Tuning PHP-FPM
Prefer `pm=dynamic`. Set the `max_children` properly, depending on the CPU cores available.

Enable the PHP OPcache. Set `opcache.memory_consumption` to the proper size: For instance, 256Mb for the Magento frontend, higher for the Magento Admin Panel. Set `opcache.validate_timestamps=0` and make sure to refresh the OPcache during deployment (for example, using Cachetool).

### Tuning MySQL
Set the `innodb_buffer_pool_size` high enough. Tune other settings over time with a script like `mysqltuner.pl`.

### Tuning Redis
Use separate Redis databases for the regular cache, the page cache and sessions. Consider setting `disable_locking` to `1`. Consider setting `compress_data` to `1` only. Consider setting `compression_lib` to either `lzf` or `zstd` if available.

### Note on Varnish
From the perspective of the checkout, adding Varnish does not have real benefits, except for the fact that the Varish Full Page Cache will offload the main PHP server, so that there are more resources for non-cacheable pages like the checkout.
