How To Improve Your App's Performance Through AWS?
Improving performance revolves around optimizing your AWS infrastructure to best suit your app’s usage and business workflow. In this article, I'll offer up five ways that you can improve the performance of your app through AWS.
Join the DZone community and get the full member experience.Join For Free
If you are an app developer, either a new recruit or an old veteran, you may have heard sentences like AWS is amazing, AWS highly improved the app performance, on-demand infrastructure made my life easier, etc. Most of this is right. Some of it is not. But, that is not the topic of this post. Here we are going to take a deeper look at a single statement: AWS improved my app’s performance.
Amazon Web Services (AWS) has a lot of tweaks and features that allow you to improve the performance of your application, both for web and mobile. I am not saying that you won't need to improve performance by cleverly coding the app. This post is for those who are relatively new to AWS and its features, have created a suitable performance-optimized app, and are looking for more ways to stack up the performance from above and beyond what is possible from coding only.
Improving performance revolves around optimizing your AWS infrastructure to best suit your app’s usage and business workflow. So without further wait, here are five ways you can improve the performance of your app through AWS.
1. Choosing the Right EC2 Instance
Believe it or not, the first and the most important step is choosing the right infrastructure. Even though it is said that you have very high flexibility in cloud infrastructure, you may still depend on pre-assembled hardware combinations that Amazon provides in its 10-20 set of instances. From available general purpose, compute optimized, memory optimized, and storage optimized instance combinations, choose the ones that most suitable for your app. Choose the newer generation instances M4, C4, R3, etc.
Though I must admit from firsthand experience that choosing the right instance is hard... very hard. The prices are tricky and performance even more so. There are no clear benchmarks that can differentiate the performance of one over another, and AWS's internal virtual-machining software is not accurate in distributing computing power. But, you can always use trial and error.
2. Burstable Compute For Sudden Workloads
If your app have sudden spikes in CPU requirement,and you don't want to spend too much on more expensive work instances, you can instead opt for instances that have burst compute features like T2 series.
3. Choosing the Right Elastic Block Storage (EBS)
The next biggest problem is the block storage. EBS storage by Amazon is famous for its capacity and performance. As you may understand, when we talk about performance in storage, we talk about the read and write speeds, or as Amazon puts it Input/Output Per Second (IOPS).
Amazon EBS instances come in many types, with Provisioned IOPS EBS instances having more IOPS speeds, followed by General Purpose SSD, and HDD storage types.
For most small use cases, HDDs are sufficient, but if your app needs high performance, then you can go for Provisioned ones. However, we recommend using a General Purpose SSD, it's the right combination of speed and price.
4. Initialize Snapshot EBS Blocks
Another thing to consider is warming-up the EBS block. The new instances of EBS volumes don't need warming, but blocks that have been restored from snapshots have to be initialized to before your apps can use it. This warming up takes time and, if not addressed cleverly, may result in sever I/O latency. One of the solutions to this problem is making sure that your app reads all blocks on the volume before it uses it, a process called initialization. This can be done by using dd or fio utilities in Linux server. In our experience, fio utility has been faster than dd. Fio, unlike dd, does not come pre-installed and needs to be installed.
5. EBS Optimized Instances
In many of the lower priced Amazon instances, the input/output bandwidth is shared between the normal traffic and EBS storage. This causes latency in performance when bandwidth is pressured by both traffic and EBS requests. The solution is to use EBS optimized instances that have dedicated bandwidth for EBS instances. C4, M4, R2, I2, G2, instances and some of lower generation instances are EBS Optimized.
These are not the only ways that you can improve the performance. There are options for offloading your DNS dependencies from normal hosts to AWS Route53, accelerating web apps using CloudFront and Elastic load, using enhanced networking options, and much more. The ones I have talked about are some of the most critical and also the easiest to take care of. Maybe in future posts, iI will talk about other ways in more detail. Until then, stay tuned.
Opinions expressed by DZone contributors are their own.