Unloading Power Outlets - AWS Elastic Loadbalancer

I had a question about how to load balanced power outlets with AWS elastic load balancer.

I have 2 EC2 instances behind AWS elastic load balancer.

When a user logs in, a user session will be established with one of the servers, for example, an instance of EC21. Now all requests from the same user will be redirected to the EC2 instance.

Now I have another stateless request coming from another system. This request will have userId. This request may fall into an EC22 instance. We must send a notification to the user based on userId in the request.

Now,

1) Assume a user session with an EC21 instance, but the notification comes from an EC22 instance. I am not sure how to notify the user browser in this case.

2) Are there any restrictions on connecting to a website, for example, 64K and ways to overcome it using multiple servers, since the user goes through a load balancer.

thanks

+7
spring-websocket amazon-ec2 elastic-load-balancer
source share
3 answers
  • You will need something else to notify the browser web server server of an event coming from another system. There are several publication-based solutions that may help, but without knowing the details, it's a little difficult to figure out which solution works best. Redis is usually a good answer, and Elasticache supports it.

  • I found this regarding AWB AWB limits: http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_elastic_load_balancer But none of them seem to be related to your question.

+4
source share

Websocket requests begin with an HTTP connection before being sent to websockets. Theoretically, if you can include a cookie in this initial HTTP request, then the sticky features of the ELB session will allow you to direct websites to specific EC2 instances. However, your websocket client may not support this.

The preferred solution would be to make your EC2 stateless instances. Store the websocket session data in AWS Elasticache (either Redis or Memcached) and then incoming connections will be able to access the session no matter which EC2 instance is used.

The advantage of this solution is that you remove the dependency on individual instances of EC2, and your application will scale and better deal with errors.

If the ELB has too many inbound connections, then it should scale automatically. Although I can not find a link to this. ELBs are relatively slow on a scale of minutes, not seconds, if you expect bursts of traffic, then AWS can preheat more ELB resources for you. This is done through support requests.

In addition, the coefficient in the ELB connection timeout. By default, it is 60 seconds; it can be increased using the AWS console or API. Your application needs to send at least 1 byte of traffic before the timeout, or ELB will disconnect the connection.

+3
source share

Recently I had to connect crossbar.io web ports using ALB. Basically, there are two things to consider. 1) For the attributes of the target group, you need to set the stickiness for 1 day. 2) You either need something on the same port that returns a static web page if the connection is not updated, or a separate port serving a static web page with a custom health check indicating that port in the target group. Go for ALB over ELB, ALB support ws: // and wss: //, they do not have enough health checks through websockets.

0
source share

All Articles