How to Scale your AWS Infrastructure - Part 2
Welcome to the second post in a series of “How to Scale your AWS Infrastructure”. In the first post, we talked about horizontal scaling, autoscaling, CI/CD, infrastructure automation, containerization, etc. In this post, we will continue the discussion around databases, loose coupling, caching, CDN, etc.
Let’s start the discussion with database scaling.
Morgan Perry
March 22, 2022 · 5 min read#Scaling your Database (Amazon RDS)
Amazon Relational Database Service (RDS) is a Database as Service offering from Amazon. It supports all the major relational database management systems. It provides many features which ensure scalability to your database. Let’s discuss some of those:
#Using Multi-AZ RDS
Multi-AZ is a feature of RDS which places a standby database in another availability zone to increase availability and fault tolerance. You just need to enable this in the RDS dashboard. Both the primary database and the standby database will be synced in real-time. If the primary database fails, all the calls to the primary database will be automatically routed to the standby database without changing anything.
Note that you cannot use a standby database to reduce the load on your database. It is just for fail over purpose. If you want to share the load among RDS databases, you need the feature of Amazon RDS Read Replicas, which is our next topic of discussion.
#Using Read Replicas
Amazon RSD Read replicas is a secondary server, the exact copy of the primary database server. Like Multi-AZ, both primary and secondary databases are synced automatically in real-time. However, you can directly route your application traffic to the Read Replicas instance to reduce the load on your primary database. Read Replicas is usually placed in another availability zone for high availability.
If the primary database goes down, you can promote read replica to become the primary database. Read replicas are mostly used where you can divide the read-only queries to your read replica instance.
#When to use Aurora
Amazon Aurora is an AWS native MySQL and PostgreSQL compatible relational database that combines the performance and availability of traditional enterprise databases, but with the simplicity and cost-effectiveness of open source databases. Compared to RDS, Aurora has built-in high availability, disaster recovery etc. If you migrate from commercial database engines like Oracle or SQL servers, you should go for Aurora because it will provide the same performance with less cost. If you have a small to medium workload and need limited concurrent connections to the database, RDS should be your preferred choice instead of Aurora.
#Facilitate loose coupling
Highly scalable systems have loose coupling between the components. Tight coupling is one of the biggest hindrances in scaling your systems. One of the best ways to reduce coupling is using message queues, Functions as Service (Lambda), Cloud Search, etc. Let’s discuss how we can use these to scale out your systems.
#SQS
Amazon Simple Queue Service (SQS) is used for building a highly reliable and scalable distributed system. If system A wants to send a message to system B, these two systems are dependent on each other, resulting in tight coupling. The more inter-dependent systems increase, your ability to scale decreases. Adding a queue between these systems will decouple this architecture in the simplest terms and increase your ability to scale. There is no administrative overhead in setting and managing SQS. SQS queues are dynamically created and scaled automatically so that you can build and grow applications quickly and efficiently. One of the most efficient ways of using SQS is utilizing the batching in SQS.
#Lambda
AWS Lambda comes under “Function as Service” offering from AWS. It is an excellent choice when building serverless architecture. Lambda is a powerful tool that lets you build a scalable application without needing to care about hardware.
It is best for any backend processing, whether document conversion, log analysis, external API integration, etc. Lambda scales out and scales in automatically based on the need, so it is also perfect for unpredictable workloads.
#Introduce Elasticache to scale your applications
Caching is an integral part of any enterprise application, especially web and mobile applications. As an application grows, it needs to keep up its standards about latency and improve user experience. Making a network call every time to fetch data from the database will result in technical debt. Adding a cache reduces latency in your application, releases load on the database, and improves your ability to scale out. AWS provides managed service of Elasticache, where you can use either Redis or Memcache based on your needs. Redis can also be used in cluster mode, where you can manage caching on multiple nodes for increased availability and fault tolerance.
#Using CDN to scale your content
Amazon CloudFront is a CDN (Content delivery network) that delivers the content closer to the user’s geographic location. Utilizing Amazon CloudFront and its edge locations as part of the solution architecture can enable your application to scale rapidly and reliably globally without adding any complexity to the solution. Cloudfront is an integral part of your architecture if your users are spread out geographically. Some of the best use cases for Cloud front include static web content delivery, replacement of S3 for global users, video streaming etc.
#Wrapping up
Scalability is a crucial component of enterprise software development. It helps businesses grow rapidly, resulting in reduced maintenance costs, better user experience, and higher agility.
The factors to consider in scalability include cost, predictive growth, technical needs, compliance needs, traffic/content type, etc.
AWS provides many services to achieve scalability, including Elastic Load Balancer, RDS Read Replicas, Elasticache, Elastic Container Service (ECS), CloudFormation, CI/CD services, SQS, Lambda, etc. Businesses can utilize a combination of these services to achieve the level of scalability they need.
While AWS provides various solutions for scaling your infrastructure, using a modern solution like Qovery is more accessible without any mandatory knowledge needed on DevOps/AWS. Qovery simplifies infrastructure management & scalability and allows you to deploy apps on AWS quickly. Discover Qovery today!
Your Favorite DevOps Automation Platform
Qovery is a DevOps Automation Platform Helping 200+ Organizations To Ship Faster and Eliminate DevOps Hiring Needs
Try it out now!Your Favorite DevOps Automation Platform
Qovery is a DevOps Automation Platform Helping 200+ Organizations To Ship Faster and Eliminate DevOps Hiring Needs
Try it out now!