AWS’s Elastic Load Balancer (ELB) offers customers an easy way to handle load balancing for applications hosted on multiple Amazon EC2 instances. While using AWS ELB, there’s no need to worry about failover and availability – all that is managed by AWS. In this post, we’ll focus on some key features and then run a useful AWS ELB vs HAProxy comparison.
Distributing and efficiently balancing incoming traffic is a basic and critical requirement for most web applications. Load balancers help to distribute and balance traffic based on different algorithms to filter for effects like round robin, session affinity, geographical location, and latency. Load balancers have been around for long enough that they’re part of a fully matured market. Both hardware and software balancers are widely available.
Still, while placing a load balancer in front of your application will definitely improve performance, it does carry some overhead, including setup and maintenance costs, and the need to ensure high availability and properly handle failure.
ELB vs HAProxy: ELB concepts
Load balancer types
In Amazon’s architectural design, a Virtual Private Cloud (VPC) is an isolated network into which you can launch compute resources. If you have Internet-facing instances in a public availability zone within a VPC, you would place an external load balancer on top of your resources to manage traffic. For devices inside a VPC’s private availability zone (for a corporate intranet, for example), you could deploy an internal load balancer.
ELB supports SSL termination at the load balancer itself, removing the need to manage SSL certificates at the application instance level. Flexible cipher support allows you to control the ciphers and protocols the load balancer presents to clients.
Sticky sessions are central to the design of many web applications, and developers will usually need to write extra code to implement the feature. ELB can take over this task, allowing you to configure session stickiness in just a few steps…again, at the load balancer level.
Monitoring a load balancer can help you to identify all kinds of performance related issues related to metrics like request latency, request counts, and failed request counts. The data provided by Amazon CloudWatch can greatly simplify the monitoring process, leaving you free to concentrate on application development.
Using access logs to properly analyze web traffic or to diagnose application behavior is obviously very important. However, since AWS manages ELB – effectively keeping you away from the underlying hardware – you can’t get to your logs the way you normally would on servers that you manage directly. Enabling Access Logs and pointing to the S3 bucket where you’d like your logs stored will cause all relevant log data to be transferred to S3. From there, you’ll be able to analyze away to your heart’s content.
Before a load balancer can redirect requests to a server, it’s important to determine the availability (or health) of the underlying server/application. By pointing your balancer’s health check to a custom application endpoint, its status will be regularly monitored. Health checks will then try to ping, say, your index.html page. If it receives a “200” response code, then it will assume everything is fine. “400” responses would mean there’s trouble, and traffic could be routed away from that server.
ELB vs HAProxy
There may be times when you won’t want to use a load balancer provided by AWS. For instance,
- You may prefer an open source solution.
- You may wish to avoid vendor lock in.
- You don’t want to give up control over load balancer management and security.
For such scenarios you should be able to intelligently compare ELB vs HAProxy, a widely-adopted open source (software-based) load balancer. Besides being fairly simple to configure, here are some of the things that HAProxy does well:
- When comparing ELB vs HAProxy, the former can feel a bit limited as far as load balancing algorithms are concerned. It supports only round robin and session stickiness. But consider cases where you need to load the balancer based on incoming URL, or on the number of connections to be handled by individual underlying severs. HAProxy can handle those, and more.
- An Elastic Load Balancer can’t be associated with a static IP address – or even a range of IPs. It can therefore be difficult to create a whitelist to filter traffic coming through an ELB balancer. On the other hand, you could always set up HAProxy on an EC2 instance and assign an Elastic IP address to that instance. That IP can then easily be used in your firewall to whitelist requests.
- Pricing may or may not be a big deal for you, but it can’t hurt to bring it up. AWS charges you for each hour or partial hour that your Elastic Load Balancer is running, and for each GB of data transferred through your Elastic Load Balancer. Since HAProxy is open source, on the other hand, setting it up and running it on an EC2 instance will cost you nothing more than the normal instance usage.
You definitely shouldn’t think I’ve got anything against AWS ELB. In fact, they’re constantly improving their product. Rather, I’ve simply tried to present various scenarios that can have more than one possible solution. It’s up to you to compare ELB vs HAProxy (along with other options) and choose whatever will work best for you.
Therefore, if your business doesn’t require complex load balancing algorithms, and is fine with simple round robin patters then I would recommend ELB for its simplicity. Similarly, if your applications are deployed across different availability zones within an AWS region and the servers are running as part of an auto scaling group, then it will be much easier to seamlessly integrate your AWS resources if you use ELB.
Trying to get the same just done with HAProxy might not be quite so simple.
This post was intended to help you understand some key ELB features and, at the same time, introduce you to an important open source load balancer solution (HAProxy). The rest is up to you.
If you’d like to add your own thoughts on the ELB vs HAProxy conversation, please leave a comment.
If you want to get a jump start on ELB, check out Cloud Academy’s Introduction to ELB course.
New Content: AWS Terraform, Java Programming Lab Challenges, Azure DP-900 & DP-300 Certification Exam Prep, Plus Plenty More Amazon, Google, Microsoft, and Big Data Courses
This month our Content Team continues building the catalog of courses for everyone learning about AWS, GCP, and Microsoft Azure. In addition, this month’s updates include several Java programming lab challenges and a couple of courses on big data. In total, we released five new learning...
Where Should You Be Focusing Your AWS Security Efforts?
Another day, another re:Invent session! This time I listened to Stephen Schmidt’s session, “AWS Security: Where we've been, where we're going.” Amongst covering the highlights of AWS security during 2020, a number of newly added AWS features/services were discussed, including: AWS Audit...
AWS re:Invent: 2020 Keynote Top Highlights and More
We’ve gotten through the first five days of the special all-virtual 2020 edition of AWS re:Invent. It’s always a really exciting time for practitioners in the field to see what features and services AWS has cooked up for the year ahead. This year’s conference is a marathon and not a...
WARNING: Great Cloud Content Ahead
At Cloud Academy, content is at the heart of what we do. We work with the world’s leading cloud and operations teams to develop video courses and learning paths that accelerate teams and drive digital transformation. First and foremost, we listen to our customers’ needs and we stay ahea...
Excelling in AWS, Azure, and Beyond – How Danut Prisacaru Prepares for the Future
Meet Danut Prisacaru. Danut has been a Software Architect for the past 10 years and has been involved in Software Engineering for 30 years. He’s passionate about software and learning, and jokes that coding is basically the only thing he can do well (!). We think his enthusiasm shines t...
New Content: AWS Data Analytics – Specialty Certification, Azure AI-900 Certification, Plus New Learning Paths, Courses, Labs, and More
This month our Content Team released two big certification Learning Paths: the AWS Certified Data Analytics - Speciality, and the Azure AI Fundamentals AI-900. In total, we released four new Learning Paths, 16 courses, 24 assessments, and 11 labs. New content on Cloud Academy At any ...
New Content: Azure DP-100 Certification, Alibaba Cloud Certified Associate Prep, 13 Security Labs, and Much More
This past month our Content Team served up a heaping spoonful of new and updated content. Not only did our experts release the brand new Azure DP-100 Certification Learning Path, but they also created 18 new hands-on labs — and so much more! New content on Cloud Academy At any time, y...
AWS Certification Practice Exam: What to Expect from Test Questions
If you’re building applications on the AWS cloud or looking to get started in cloud computing, certification is a way to build deep knowledge in key services unique to the AWS platform. AWS currently offers 12 certifications that cover major cloud roles including Solutions Architect, De...
Overcoming Unprecedented Business Challenges with AWS
From auto-scaling applications with high availability to video conferencing that’s used by everyone, every day — cloud technology has never been more popular or in-demand. But what does this mean for experienced cloud professionals and the challenges they face as they carve out a new p...
Constant Content: Cloud Academy’s Q3 2020 Roadmap
Hello — Andy Larkin here, VP of Content at Cloud Academy. I am pleased to release our roadmap for the next three months of 2020 — August through October. Let me walk you through the content we have planned for you and how this content can help you gain skills, get certified, and...
New Content: Alibaba, Azure AZ-303 and AZ-304, Site Reliability Engineering (SRE) Foundation, Python 3 Programming, 16 Hands-on Labs, and Much More
This month our Content Team did an amazing job at publishing and updating a ton of new content. Not only did our experts release the brand new AZ-303 and AZ-304 Certification Learning Paths, but they also created 16 new hands-on labs — and so much more! New content on Cloud Academy At...
Blog Digest: Which Certifications Should I Get?, The 12 Microsoft Azure Certifications, 6 Ways to Prevent a Data Breach, and More
This month, we were excited to announce that Cloud Academy was recognized in the G2 Summer 2020 reports! These reports highlight the top-rated solutions in the industry, as chosen by the source that matters most: customers. We're grateful to have been nominated as a High Performer in se...