DEV Community

loading...

Hello AWS World!

Marcin Krzyżanowski
Software Engineer • Open Source Enthusiast • Magento Developer • Speedway & Football fan • Apple follower
・1 min read

One of our Magento 2 client has asked us what infrastructure to use when go live? They were fed up with single - private hosting they had. After the quick brainstorm session we had in out departament, we decided that cloud is the way. We were familiar with Microsoft Azure however, their services such as Redis did not live up to expectations we had. We have finally decided that Amazon Web Services will be the place we’ll give a try. We have also agreed on two things. First on all, everything that can, ought to be run as a service. Second of all, in order not to spend much money on the beginning we are starting from the very low instances type and, as time goes by, we will switch to more powerful ones.

Beginnings

After successful configuration of Magento services (RDS, Redis, S3 and Elasticsearch) we have created tiny node instance with 20GB SSD drive, 2 CPU and 2 GB of RAM. Nodes are basically for PHP-FPM and Nginx only. Magento’s media are stored in S3 bucket.
Client’s new Magento 2 store has been developing by our company for some time now, so after importing database from test environment we did the first artifacts deployment. Franky, I was pleasantly surprised when I hit the admin url and after cache warmup and successful login I saw admin panel which has been loaded pretty fast. Everything seemed to work.

Tune up

Even though backend works faster than I expected, basic products and category operation such as insert or edit were pretty slow. Nevertheless we found out that when more that two persons work with backend in the same time and, for instance, they are saving products or adding product’s images, we have deadlocks on database tables. It was about time to tune some things up.
Firstly, RDS instance. We have upgraded it to little more powerful with 16 GB of RAM memory and 4 CPU. Pretty interesting fact here is when you upgrading RDS instance, database settings like innodb_buffer_pool for instance are going to be dynamically changed as well. You don’t need to be worry about crucial settings when changing the instance. RDS will take care of it for you. Interesting two facts after upgrading RDS were that write count of IOPS has increased although we hadn’t changed SSD type and we didn’t find any deadlocks information in logs after upgrading.
After dealing with RDS, application node was the place we took care of. We have noticed that CPU utilization during pick hours was more than 80%. We have switched from micro instance to medium one (4 CPU, 4GB of RAM, 20GB of SSD) and we have added second application node for more redundancy. As far as we know, in backend multiple users are able to work now including heavy products or category operations with no delays or deadlock. Frontend however, can handle up to 70 users at the same time with no further issues whatsoever. At least that number we were able to count.

What else?

AWS console is awesome! It is user-friendly, easy to explore and very intuitional. Without knowing its nooks and crannies you need a couple of hours to get used to it and feel like you have been working with it for years.
Setting up second application node based on first one, honestly, cannot be easier. Few clicks and the job is done. What’s more, such operations, probably based on instance size, are not taking that much time.
Changing database advanced settings is simple as well. Settings grid is very clear, options are intuitional. Live operation status bar shows you what is happening at the moment when cluster applying settings and rebooting.
Free charts! For almost every instance and service basic charts are available. Of course they cannot be as advanced and precise as New Relic ones or backfire. However, you may always decide to use paid analytics tools with Amazon.

Summary

Naturally, there are some things that need to be done yet on our side like multi-node deployment, self-acting node scalability or enabling Amazon CloudFront but I am positive now that picking up an AWS was a great idea. Scalable, flexible and reliable infrastructure is now must have for every e-commerce client on the world. If you add well prepared monitoring to such infrastructure you can be sure that your shop availability will be as high as possible.

Discussion (0)