aMiSTACX AWS EC2 Speed Optimization Tips

Our stacks are designed for simplicity and speed, and we have continually improved on both since our launch in June 2017.

Almost all of our new stacks have a few items worth noting, and we wish to share a few tips should you be tweaking the most out of your page speed and quality scores.

For simple deployments, we recommend making use of Cloudflare as your CDN/DNS provider. Coupled with our stacks you can achieve grade A performance on just about any speed and quality test.

Test! Live Demo in Brazil approved for GTMetrix.

Important! Take a full AMI image backup before messing around with any of these settings.

Remove the SWAP

  • Our older < G4 stacks have a swap file configured. This acts like a crutch when RAM memory is undersized, but the results on performance are noticeable, especially with Magento. This is because the EC2 disk has slower I/O than RAM. Our G5+ stacks will have the swap file removed. If you want to up your aMiSTACX vintage performance, then increase your instance EC2 to at least a t3-medium, and then remove the swap.

sudo swappoff -a

nano /etc/fstab  #remove only the second line in the file. The one that says something like: “/mnt/1GiB.swap swap swap defaults 0 0”

cd /mnt/1GiB.swap
sudo rm 1GiB.swap
sudo reboot

Troubleshooting w/ SWAP

Sometimes you need a crutch in order to troubleshoot a memory leak, or other memory consumption issue, and you need more time. A SWAP file work great in this situation, but at the sacrifice of performance.

Here we create a 3G swap file:

sudo fallocate -l 3G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

#free -h or htop will show swap usage

Performance modules S3R-Alpha & Ramjet

  • Weaponize your business with our S3R-Alpha module for media served from AWS S3. When used with a CDN such as Cloudflare, this is an instant boost for your WordPress or Magento site.
  • One of the most noticeable day/night upgrades you can make for Magento 2.2+ is to make use of aMiSTACX’s Ramjet cache booster. Included on all S3 Titanium stacks.

Redis Caching

  • All of our legacy G3/G4/G5 stacks have Redis caching. For Magento, this local server caching engine is really a stable and useful alternative to other caching engines. For legacy stacks G3/G4, we have it automatically enabled, just follow your stack guide on how to implement it for Magento. For WordPress, Redis is disabled by default, and you will need to find a good plugin to leverage its use.

Cloudflare Configurations

  • If you decided to use Cloudflare for your CDN, then a little note worth trying A/B testing with is with Cloudflare’s Rocket Loader. In some cases it will improve your quality scores [good], but also increase the page loading times [not good], and in others instances it will decrease your quality scores [not good], but keeps page loading times about the same [not good]. So with a simple toggle of On/Off you can A/B test Rocket Loader’s impact on your aMiSTACX stack, and make the call to keep it on or off based on your results.

G4/G5/G6 Stacks for Magento 2.3.x+

  • Without a doubt, making use of our S3 Titanium for Magento 2.2.x+ will help put a smile on your face when you see how fast your site loads. No more Magento piggy here. With our performance modules, S3R-Alpha and Ramjet, and following our guidelines, your site will fly.
  • Make sure you use our newest G6F stacks. These are state-of-the-art stacks built on Ubuntu 22.04 LTS, and have AWS EC2 T3/M5/C5 class support. Plus lots and lots of performance tweaks 😉

WordPress S3 Titanium

  • Finally a plugin that not only handles image compression and deployment to S3, but also includes static deployment and RDS read replicas. We’re talking about our S3 Titanium Module for WordPress! Lots of bells-n-whistles to explore.

HTTP2 for Apache

  • All of our G6, G5, G4, G3 stacks have HTTP2 configured for Apache; however, for some strange reason some stacks have it off. Please make sure it is enabled to increase performance.sudo a2enmod http2
    sudo service apache2 restart

Remove to Improve

For Magento, removing and disabling modules that are not used will increase performance. Removing dependencies on 3rd party embeded scripts will also increase performance. and also improve page score ratings.

For production stacks, we also recommend removing Magento’s Developer tools. These can be found in your composer.json file in Magento’s root. These tools increase attack vector risks, and can also lead to ping backs and slower loading times.

To a limited extent, the same can be applied to WordPress. Removing modules that are not used will also decrease attack vectors and malware risks.

Bookmark this page and check periodically. We will provide more tips.

~ Lead_Robot