aMiSTACX - S3Rocket Performance Configuration Tips

aMiSTACX S3 Titanium Magento Configuration Tips

aMiSTACX S3 Titanium Magento Configuration and Performance Tips

July 2018 – With the release of our S3Rocket Module ,S3Sonic Module, and Ramjet for AWS S3 [aka The S3 Titanium Module], horizontal scaling is now possible when used in conjunction with RDS, an AWS Load balancer, and with an AWS auto scale group.

These modules should be administered only by admins and developers with extensive knowledge of both Magento and AWS!

With Luma Sample data we have achieved load times as fast as 1.4 seconds [out-of-the-box], and quality speed/quality scores in the high 90s. We also have several customers that have up to 1 million catalog items using the aMiSTACX S3 Titanium configuration.

TROUBLESHOOTING / CONFIGURATION

Should you not see the aMiSTACX S3 modules after a fresh CloudFormation install [it is possible], then first follow these steps.

From CLI:

cd /var/www/magento

sudo composer update

sudo php bin/magento maintenance:enable
sudo php bin/magento cache:clean
sudo php bin/magento cache:disable
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:upgrade
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:di:compile
sudo chown -R www-data:www-data /var/www/magento
[optional] sudo php bin/magento setup:static-content:deploy
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento cache:enable
sudo php bin/magento cache:clean
sudo php bin/magento maintenance:disable
sudo chown -R www-data:www-data /var/www/magento

Some Images NOT appearing

It is best to run this prior to S3Rocket Sync with S3 for the first time:

sudo php bin/magento catalog:images:resize

Magento Developer Docs Ref:

If after an import you also see this issue, you may need to run the command again.

PERFORMANCE

S3Rocket Custom S3 Domain

Tip 1. – If you selected the option to configure a custom domain for your S3 name resolution, then here are some useful tips: Use a different domain than your root domain! And I do NOT mean a subdomain.

e.g. luma.awsamistacx.com [root] and s3r.awsamistacks.com [S3]

Note:
This will help quality scores improve as you will not be serving S3 content from a domain that sets cookies.

Fixing: Serve the following static resources from a domain that doesn’t set cookies:

You cannot disable cookies on resources served through Cloudflare. While some speed recommendations will suggest eliminating cookies for static resources, the performance implications are extremely minimal. Cloudflare cookies are also required so security features work properly.

Tip 2. – You need to have Cloudflare S3 CNAME set to CDN ON [Orange Cloud]. If you do not, then you will get mixed content warnings. Also make sure the S3 domain that Cloudflare is using has the Cloudflare SSL set to FULL.

Tip 3. – Very Important! Wait about 15-30 minutes for Cloudflare to kick in before you upload any Magento media content; otherwise, you will get certificate warnings. For example, say Magento sets a path to a media image that looks like this:

https://s3rtest.awsamistacks.com/catalog/product/6/4/640.png

But when Cloudflare CDN has not fully propagated, you will get served a URL that looks like this:

https://s3rtest.awsamistacks.com.s3-us-west-2.amazonaws.com/catalog/product/6/4/640.png

Plus you will get a certificate warnings.

Tip 4. Static Content Deployment to S3

Our latest version of S3Rocket 1.0.5+ allows for static content deployment to AWS S3.

S3Rocket Deploy CSS to S3

When used in this configuration, we have removed Redis caching, and set CSS and JS settings in the Magento Console as follows:

Magento 2.2.x Developer CSS JS Settings

Make sure you test this on Dev environment first. Also, make sure you deploy your media files first, take a backup, and then test deployment of Static content to S3.

Additionally, when deploying static content to S3 you will need to follow the following steps to ensure success:

From CLI:

cd /var/www/magento

sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:upgrade
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:di:compile
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:static-content:deploy -f
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento cache:enable

*Must use the -f switch.

Tip 5. Image Compression

S3Rocket as of version 1.0.6 introduced an option to compress images. Although not WebP, you can experiment to see if there are any performance enhancements to be found. Our demo site https://luma.awsamistacx.com is set at 80% image compression.

Magento 2.2.x S3Rocket Image Compression

S3T TOOLS

Introduced in S3R v1.0.5 is the ability to sync to S3 via CLI. This comes in handy for mega image catalogs – like 150K +.

cd /var/www/magento

sudo php bin/magento s3rocket:bucket:sync

Note: It will sync the image path as defined in the S3Rocket module!

If you decide to use compression, then in S3R v1.0.6 you have the option to sync with CLI.

cd /var/www/magento

sudo php bin/magento s3rocket:bucket:sync --with-compressed

Note: Optimized images will use a special path on S3 and only be retained on S3. No local copy.

LAUNCH

Paying attention to details and making sure you follow your aMiSTACX admin guide, and of course your own experience, will help make sure your deployment is successful.

Video of Magento aMiSTACX Modules S3Rocket and S3Sonic w/ RDS and AWS Auto Scale

Better – Stronger – Faster!