Magento 2 is an incredibly powerful development tool, but when you're working on a local host you may find yourself looking for ways to improve its performance. There are basic things that can be done to help the loading speed of your site, but if you're after a more sophisticated solution, follow our helpful guide...
Tips and tricks for improving Magento 2's performance on local hosts...
The first thing to take into account is your operating system and the extent to which it's affecting your performance. Where operating systems are concerned, Linux will generally prove to be the most powerful in terms of performance, while Windows can be problematic - it isn't supported by Magento and requires the use of virtualisation in order to properly work.
Where possible avoid running compiler as well as static deploy scripts, they will slow things down considerably.
It's a good idea to set up Magento in vagrant, using 2G of memory and NFS for your file sharing.
Make sure you take full advantage of developer mode. When you are in developer mode, make sure you deploy any static content upfront, and ensure you only delete files relating to elements you've modified. This ensures changes are reflected when the page loads. If you fail to delete corresponding files generated by deploying static content upfront, you won't see the changes you have made reflected.
Always enable all of your caches, except in cases where you are working with in start modify layouts. In these cases disable Blocks, FP, and Layout caches.
Try using PHP7 with opcache. Configure it to recheck your files every second, and make sure you only enable xdebug extensions if you need to debug.
Try using APCLite for your cache adapter.
You may notice that when you are spinning up AWS EC2 instances, M2 installations will prove to be much faster. The EC2 instance may not run all your local processes. The minimum suggestion for allocating RAM in this case is 750MB. Always make sure you have plenty of RAM free to run M2.
Are you looking for further help with Magento 2 Agency? Get in touch, we're happy to discuss your needs and find the best solution for you.