π§πΎβπ» prep
Scalbility and monitoring
What is scalability?
Learning Objectives
Scalability is the capability of a system to handle a growing amount of work or its potential to be enlarged to accommodate that growth. In the context of cloud computing and web applications, scalability often refers to adding more resources or modifying the system architecture to manage increased load.
Let’s consider a hypothetical social media platform as an example. When the platform is new and has a small number of users, a single server might be sufficient to handle the traffic and data. But what happens when the platform goes viral and suddenly attracts millions of users?
Database Queries: The number of queries hitting the database will grow exponentially.
File Storage: Photos, videos, and other media files will consume more and more storage.
Bandwidth: More users mean more data transfer.
To continue providing a seamless user experience, the system needs to scale. This could mean adding more servers, optimizing database queries, or increasing the bandwidth capacity.
So, in tech, scalability isn’t just about making things bigger; it’s about making them more efficient to handle a growing user base or data volume.
Why is scalability important?
Learning Objectives
Performance: As your application grows, you’ll need to ensure it remains responsive.
Cost-Effectiveness: Proper scalability strategies can help you use resources more efficiently, thereby saving costs.
Availability: Scalability ensures your application can handle increased load without going down.
Scalability Challenges
Complexity: Scaling often involves re-architecting your application, which can be complex and time-consuming.
Cost: While cloud resources are generally inexpensive, costs can add up as you scale.
Management: Increased resources and complexity require better management strategies.
High Availability
High Availability (HA) is closely related to scalability. It’s about ensuring that a service is available as much as possible, even in the face of various kinds of failures (hardware failure, software crashes, etc.). While scalability focuses on accommodating more users, high availability focuses on providing reliable service to the existing user base. In many cases, these two go hand-in-hand because a system that scales well is often better equipped to maintain high availability.
For more information, you can read about High Availability in the AWS Well-Architected Framework.
Types of scalability
Learning Objectives
Vertical Scaling
Also known as “scaling up,” this involves adding more resources like CPU, RAM, or storage to an existing server. While easy to implement, there are physical limits to how much you can scale vertically.
Horizontal Scaling
Also known as “scaling out,” this involves adding more servers to share the application’s load. This is often considered more flexible but can be complex to manage.
π Resources
Implementing Scalability in the Cloud
Learning Objectives
Implementing scalability in the cloud involves various strategies and technologies that help you adapt to the demands of your user base and workloads. Below are some popular methods for achieving scalability in the cloud using AWS services.
Horizontal Scaling and Vertical Scaling
Horizontal Scaling with AWS EC2
In horizontal scaling, additional instances are added to or removed from a resource pool as needed. AWS EC2 offers Auto Scaling Groups that allow you to scale the number of EC2 instances up or down automatically based on pre-defined conditions such as CPU usage or incoming network traffic.
# AWS CLI command to update an existing Auto Scaling group
aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --min-size 1 --max-size 5
Vertical Scaling with AWS RDS
AWS RDS allows you to resize your database instances to better meet your application’s needs. For instance, you could switch from a db.t2.micro
to a db.m4.large
instance type, thus vertically scaling your database.
# AWS CLI command to modify an RDS instance
aws rds modify-db-instance --db-instance-identifier mydbinstance --db-instance-class db.m4.large
Load Balancing with AWS ELB
AWS Elastic Load Balancer (ELB) distributes incoming traffic across multiple EC2 instances. ELB can be an essential part of both horizontal and vertical scaling strategies.
Elasticity and Provisioning with AWS S3
AWS S3 is designed to scale automatically. It automatically partitions your buckets as they grow, without any need for manual intervention. S3 also offers provisioned capacity for demanding workloads.
State Management in AWS RDS
Managing state in scalable systems is crucial. AWS RDS supports Multi-AZ deployments enhancing high availability and failover support for DB instances.
For more detailed information on AWS scalability strategies, you can refer to the AWS Well-Architected Framework.
By understanding and implementing these AWS-specific concepts, you’ll be better prepared to build scalable and reliable cloud-based applications.
Monitoring Tools
Learning Objectives
Monitoring is crucial for understanding the behavior of your applications and infrastructure, particularly in cloud environments where many components work together to deliver an application. Monitoring not only helps you to diagnose and fix issues faster, but it also plays a pivotal role in optimizing performance and planning for scalability.
Why is Monitoring Important?
Performance Tuning: Real-time data helps you understand how well your system is performing and where bottlenecks may be forming.
Issue Identification: Proactive monitoring can alert you to issues before they impact your users, allowing for quicker resolution.
Security: Monitoring can help identify unauthorized access or anomalies that could indicate a security breach.
Observability
Observability is the ability to understand the internal state of your system just by examining its outputs. An observable system makes it easier to identify the root causes of failures and debug or optimize code. Observability is often considered the superset of monitoring, logging, and other diagnostic activities.
Monitoring with AWS CloudWatch
AWS CloudWatch is a robust monitoring solution that allows you to collect and track metrics, collect and monitor log files, and set alarms. CloudWatch can monitor AWS resources like EC2 instances, RDS databases, and S3 buckets, as well as custom metrics generated by your applications.
Using AWS CloudWatch, you can create dashboards to visualize metrics, set thresholds for alarms, and even automatically react to changes in your AWS resources.
By setting up monitoring tools and learning the importance of observability, you are taking proactive steps to maintain high availability and performance of your cloud services and applications.
Backlog
Learning Objectives
In software development, we break down complex projects into smaller, manageable parts, which we work on for a week or two. These periods are called “sprints.”
A sprint backlog is like a to-do list. It lists what the team has decided to work on this sprint. It’s chosen from a larger list, usually called the “product backlog,” which holds the entire project to-do list.
For your course, the mandatory work has been scheduled already. You will add any other tickets you want to work on to your backlog and schedule them according to your own goals and capacity. Use your planning board to do this.
You will find your backlog in the Backlog view on every sprint.
Copy the tickets you are working on to your own backlog. Organise your tickets on your board and move them to the right column as you work through them. It’s a flowchart:
flowchart LR Backlog --> Ready Ready --> in_progress in_progress[In Progress] --> in_review in_review[In Review] --> Done
Backlog (30 minutes)
- Find the sprint backlog
- Copy your tickets to your own backlog
- Organise your tickets on your board