问题
It's been on the cards for a while, but now that Amazon have released Elastic Load balancing (ELB), what are your thoughts on deploying this solution for a high-traffic web application?
Should we replace HAProxy or consider ELB as a complimentary service in front of HAProxy?
回答1:
I've been running an ELB instead of HAProxy for about a month now on a site that gets about 100,000 visits per day, and I've been pretty pleased with the results.
A gotcha though (UPDATE, this issue has been fixed by Amazon AWS, see comments below):
- You can't load balance the root of a domain as you have to create a CNAME alias to your load balancer. Once solution is to redirect all traffic from
http://mysite.com
tohttp://www.mysite.com
.
Apart from that I really can't speak highly enough of the AWS ELB offerings. I'm also using the Cloudwatch monitoring and autoscaling. Oh and don't forget it's cheaper than running a small EC2 instance ($0.025 per hour instead of $0.10).
回答2:
ELB's dependence on DNS CNAME record indirection is pretty crippling for web services that need to be very fast. In our case we need to have very good response time. In a quick performance test, the use of an ELB increased the average latency for HTTP requests by a factor of almost 2. This is mainly because the TTL on the CNAME lookup is zero. Thus, all lookups involve hitting name servers for two different domains, so the name resolution is way slower. (I worry that defeating caching in DNS is simply an abuse of the system.) The only hope for ELB in our case would be to get away from CNAME records by having Amazon support an Elastic IP as the address of a load balancer instance.
回答3:
Another issue is getting the client IP address. For regular HTTP this works fine, as ELB sets the X-FORWARDED-FOR header. But for HTTPS this isn't possible because it is forwarding at the TCP layer. Hopefully some day ELB will have SSL termination.
回答4:
There are complaints in the Amazon forum about ELB's reliability. I suggest you head over there and search on ELB to form your own opinion on that front.
We wanted to use ELB to load balance web service requests, but we have many external callers, some of which send a 100-Continue HTTP message. Unfortunately ELB does not understand that part of the HTTP protocol, so we're unable to go beyond proof-of-concept until that's addressed.
2013 Update
According to an AWS forum post, HTTP 100-Continue is now supported.
https://forums.aws.amazon.com/message.jspa?messageID=144022
回答5:
One main problem for many users with ELB is that it does not support stickyness, which is a killer for many web application.
According to Amazon AWS developers it should however come in the next release.
来源:https://stackoverflow.com/questions/877468/elastic-load-balancing-in-ec2