0

We are looking to separate our blog platform to a separate ec2 server (In Nginx) for better performance and scalability.

Scenario is:

  1. Web request (www.example.com) -> Load Balancer/Route -> Current EC2 Server
  2. Blog request (www.example.com/blog) -> Load Balancer/Route -> New Separate EC2 Server for blog

Please help in this case what is the best option to use:

  1. Haproxy
  2. ALB - AWS
  3. Any other solution?

Also, is it possible to have the load balancer or routing mechanism in a different AWS region? We are currently hosted in AWS.

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67

3 Answers3

2
  • Haproxy

You would have to set this up on an EC2 server and manage everything yourself. You would be responsible for scaling this correctly to handle all the traffic it gets. You would be responsible for deploying it to multiple availability zones to provide high availability. You would be responsible for installing all security updates on the operating system.

  • ALB - AWS

Amazon will automatically scale this out to handle any amount of traffic you get. Amazon will handle all security patches of the underlying system. Amazon provides free SSL certificates for ALBs. Amazon will deploy this automatically across multiple availability zones to provide high availability.

  • Any other solution?

I think AWS Global Accelerator would work here as well, but you would have to weigh the differences between Global Accelerator and ALB to decide which fits your use case and budget the best.

You could also look at placing a CDN in front of everything, like CloudFront or Cloudflare.


Also, is it possible to have the load balancer or routing mechanism in a different AWS region?

AWS Global Accelerator would be the thing to look at if load balancing in different regions is a concern for you. Given the details you have provided I'm not sure why you would want this however.

Probably what you really need is a CDN in front of your websites, with or without the ALB.

Mark B
  • 183,023
  • 24
  • 297
  • 295
  • Hi Mark, Thanks for your response. The reason we want to do this is we are getting good SEO traffic for example.com/blog and don't want to disrupt that. I tried haproxy with path_beg ACL in local server it works fine. From scale/performance wise which one is better haproxy or ALB? Any pointers will be helpful. We are getting around 3 Million monthly visitors on our site. – Amit Shrivastava Apr 24 '21 at 15:43
  • None of this will change your SEO. From scale/performance perspective, an ALB is most likely going to better than haproxy on the same server, because it will take the load off your server and move it to a server managed by Amazon, that they will scale for you automatically. To really help with things like time-to-first-byte you need to look into a CDN if you don't already have one. – Mark B Apr 24 '21 at 15:49
0

Scenario is:

Web request (www.example.com) -> Load Balancer/Route -> Current EC2 Server Blog request (www.example.com/blog) -> Load Balancer/Route -> New Separate EC2 Server for blog

In my view you can use ALB deployed in multi AZ for high availability for the following reasons :-

i have answered on [something similar] it might help you also

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67
  • Thanks Jatin! Let me give ALB a try, also performance wise which one is better ALB? Or HAproxy? Any performance benchmark as mentioned we have decent scale in traffic. And the reason we want to move is to improve performance and page load time. – Amit Shrivastava Apr 25 '21 at 04:16
  • When you are looking for extreme performance then why not go for network load balancer provided by alb, it handles millions of requests per second latency is less like 100ms as compared to 400 ms for alb, hence better performance and page load time,static IP per AZsupports elastic IP too,in order to whitelist specific ip its exactly same as alb, also why I am inclined more towards was because load balancing is managed service which means you don't have to worry about upgrades, patching or failover, was will take care of everything – Jatin Mehrotra Apr 25 '21 at 05:22
  • i woudl recommend to go for https://aws.amazon.com/elasticloadbalancing/features/?nc=sn&loc=2#Product_comparisons as well faqs https://aws.amazon.com/elasticloadbalancing/faqs/?nc=sn&loc=5, however let me also tell you that nlb wont support path based routing as its l4 based load balancer so you need to set up your ec2 server accordingly ( which is achievable :)) – Jatin Mehrotra Apr 25 '21 at 05:39
0

This is my opinion, take it as that. I am sure a lot of people wont agree.

If your project is small or personal, you can go with HAProxy (Cheap USD4 or less if you get a t3a as a spot instance) Or free if you place it inside another EC2 of yours may be using docker.

If your project is not personal or not small, go with ALB (Expensive but simpler and better integrated to other AWS stuff)

HAProxy can handle tons of connections, but you have to do more things by yourself. ALB can also handle tons of connections and AWS will do most of the work.

I think HAProxy is more suitable for personal/small projects because if your project doesnt grow, then you dont have to touch HAProxy. It is set and forget the same as ALB but cost less. You usually wont mind about Availability zones or disaster tolerance in a personal project, so HAProxy should be easy to config.

Another consideration: AWS offers a free tier on ALB, so if your project will run for less than a year ALB is the way to go.

If you are learning, then ALB should be considered because real clients usually love to stick to AWS in all aspects, and HAProxy is your call and also your risk (just to reduce cost for a company that usually pays a lot more for your salary, so not worth the risk).

Jonathan Orrego
  • 131
  • 2
  • 6