“How AWS Load Balancing Optimizes application performance and reliability”

TechnoLead
7 min readSep 15, 2023

--

NOTE : Load balancing is an application that takes requests and routes them to the instances to be processed.

Elastic Load Balancing

Elastic load balancing is a service provided by Amazon Web Services (AWS) that indeed serves this purpose of distributing incoming traffic to improve availability and performance by distributing the load across multiple targets. Elastic Load Balancer(ELB) works by creating a virtual IP address that all of your customers can connects to. When a customer connect to virtual IP , the Elastic Load Balancer(ELB) sends the request to one of your target. Elastic Load Balancer(ELB) uses a variety of factors to determine which request to send to which target.

Elastic Load Balancer(ELB) checks the health of your target and will stop sending the request to target if it becomes unhealthy. This ensures that your application is always available to customers.

Monolithic applications and microservices

Suppose application-A is sending messages to application-B and if for somehow Application-B fails and Application-A is unable to send message to Application-B, due to this error Application-A will also get problem , this is called TIGHTLY COUPLED (one application is dependent on other application).

Suppose that you have an application with tightly coupled components. These components might include databases, servers, the user interface, business logic, and so on. This type of architecture can be considered a monolithic application. In this approach to application architecture, if a single component fails, other components fail, and possibly the entire application fails.

To help maintain application availability when a single component fails, you can design your application through a microservices approach.

In a microservices approach, application components are loosely coupled. In this case, if a single component fails, the other components continue to work because they are communicating with each other. The loose coupling prevents the entire application from failing.

“A more reliable architecture is LOOSELY COUPLED (single failure won’t cause cascading failures).”

Here comes our next topic : Messaging and Queuing

If the above situation will arise here, then message will remain in the MESSAGE QUEUE as long as Application-B will be faultless or errorless.

Amazon Simple Notification Service (Amazon SNS) and Amazon Simple Queue Service (Amazon SQS)

Services that provide different messaging and communication capabilities to enable seamless interaction between different components of distributed systems or applications.

1. Amazon Simple Notification Service (Amazon SNS):

  • Amazon SNS is a messaging service that allows you to send messages or notifications to various endpoints, such as email addresses, SMS devices, HTTP endpoints, AWS Lambda functions, and more.
  • It is used for broadcasting messages or notifications to multiple subscribers or endpoints simultaneously.
  • Amazon SNS follows a publish-subscribe (pub-sub) model, where messages are published to topics, and subscribers receive messages from the topics they are interested in.
  • It helps in sending notifications and alerts to inform different parts of your application about specific events or conditions.

2. Amazon Simple Queue Service (Amazon SQS):

  • Amazon SQS is a managed message queuing service that enables the decoupling of components within a distributed application.
  • Messages are placed until they are processed.
  • SQS uses queues to hold messages, and consumers retrieve and process messages from these queues.
  • It is commonly used to ensure that tasks are executed in a scalable and fault-tolerant manner, even when different parts of the application operate at different speeds.

“In summary, both Amazon SNS and Amazon SQS are AWS services that play crucial roles in facilitating communication and integration between different components or services of an application. SNS is typically used for broadcasting notifications, while SQS is used for asynchronous message processing and decoupling of application components. The choice between them depends on your specific application requirements and messaging needs.”

KEY POINTS :

Decoupling Components: “Decoupling” means breaking the tight connections or dependencies between different parts of an application. In a distributed application, different components or services often need to communicate with each other. SQS allows these components to communicate indirectly through message queues without being tightly coupled. This separation makes the application more flexible and resilient.

Asynchronous Communication: SQS enables asynchronous communication, meaning that one component can send a message to a queue without waiting for an immediate response. Another component can then retrieve and process the message at its own pace.

Earlier in my story, you learned about Amazon EC2, a service that lets you run virtual servers in the cloud. If you have applications that you want to run in Amazon EC2, you must do the following:

  1. Provision instances (virtual servers).
  2. Upload your code.
  3. Continue to manage the instances while your application is running.

“serverless means you cannot see or access the underlying infrastructure all the functioning are being taking care for you. With serverless computing you focus more on innovating new products and features instead of maintaining servers.

Another benefit of serverless computing is the flexibility to scale serverless applications automatically. Serverless computing can adjust the applications’ capacity by modifying the units of consumptions, such as throughput and memory.

  • Throughput : It is a measure of the system’s capacity to handle and complete tasks efficiently.

Here comes our next topic : An AWS service for serverless computing AWS Lambda

AWS Lambda

AWS lambda is one serverless compute options. Service that lets you run code in lambda function without needing to provision or manage servers. While using AWS Lambda, you pay only for the compute time that you consume. Charges apply only when your code is running. You can also run code for virtually any type of application or backend service, all with zero administration.

How AWS Lambda works

  1. You upload your code to Lambda.
  2. You set your code to trigger from an event source, such as AWS services, mobile applications, or HTTP endpoints.
  3. Lambda runs your code only when triggered.
  4. You pay only for the compute time that you use. In the previous example of resizing images, you would pay only for the compute time that you use when uploading new images. Uploading the images triggers Lambda to run code for the image resizing function.

In AWS, you can also build and run containerized applications.

Containers

Containers provide you with a standard way to package your application’s code and dependencies into a single object. You can also use containers for processes and workflows in which there are essential requirements for security, reliability, and scalability. Container run on top of EC2 instances, host is EC2 instance here.

How containers work :

STEP 1 : Suppose that a company’s application developer has an environment on their computer that is different from the environment on the computers used by the IT operations staff. The developer wants to ensure that the application’s environment remains consistent regardless of deployment, so they use a containerized approach. This helps to reduce time spent debugging applications and diagnosing differences in computing environments.

STEP 2 : When running containerized applications, it’s important to consider scalability. Suppose that instead of a single host with multiple containers, you have to manage tens of hosts with hundreds of containers. Alternatively, you have to manage possibly hundreds of hosts with thousands of containers. At a large scale, imagine how much time it might take for you to monitor memory usage, security, logging, and so on.

Summary : Container orchestration is like managing a fleet of shipping containers. Imagine you have a large number of containers( like those you have seen on cargo ships) and each container holds something valuable. Container orchestration helps you efficiently manage, deploy and maintain these containers to insure they reach destination safely and efficiently.

container orchestration tools : Amazon Elastic Container Service and Amazon Elastic Kubernetes Service.

Amazon Elastic Container Service (Amazon ECS)

Amazon Elastic Container Service (Amazon ECS) is a highly scalable, high-performance container management system that enables you to run and scale containerized applications on AWS.

Amazon ECS supports Docker containers. Docker (we will learn about docker in my upcoming content) is a software platform that enables you to build, test, and deploy applications quickly. AWS supports the use of open-source Docker Community Edition and subscription-based Docker Enterprise Edition. With Amazon ECS, you can use API calls to launch and stop Docker-enabled applications.

Amazon Elastic Kubernetes Service (Amazon EKS)

Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed service that you can use to run Kubernetes on AWS.

Kubernetes is open-source software that enables you to deploy and manage containerized applications at scale. A large community of volunteers maintains Kubernetes, and AWS actively works together with the Kubernetes community. As new features and functionalities release for Kubernetes applications, you can easily apply these updates to your applications managed by Amazon EKS.

In summary, the choice between ECS and EKS depends on your specific requirements and familiarity with container orchestration tools:

  • Use Amazon ECS if you want a simplified, AWS-native solution for container orchestration and do not require Kubernetes-specific features. ECS is a good choice for quickly getting started with containers on AWS
  • Use Amazon EKS if you prefer the flexibility and extensibility of Kubernetes, want to leverage the Kubernetes ecosystem, or need advanced features provided by Kubernetes. EKS is a suitable choice for organizations with existing Kubernetes expertise.

--

--

TechnoLead

Exploring tech, science, and creativity. 🚀 | Sharing insights and ideas that spark curiosity. 🔥|🌟 #MediumAuthor | 🌟 #MediumAuthor | #CuriousMind