- Newest
- Most votes
- Most comments
First, don't consider the network (any network!) to be 100% reliable. There are so many things that can go wrong at different times during the lifetime of a session (WebSockets or other) or packet. If you are seeing intermittent connectivity issues there are many causes - far too many to go into here. That said...
The logs you have pasted show a 404 error being returned. That means that the client successfully connected to the server and the server responded indicating that the resource couldn't be found. In this case, end-to-end connectivity was achieved but something on the server threw an error. If you have multiple servers is it possible that they are not all configured identically?
Finally, NLB stickiness works when the client hits the same NLB node using the same source IP address. When the client does a DNS lookup for the NLB name, multiple IP addresses are returned and the client will choose one to connect to. On a second connection attempt, the client (which could be SignalR, the browser or the operating system) may choose a different IP address which will not deliver a "sticky" session.
To the comments above: The network should never be considered to be 100% reliable. In a failure scenario (say, the NLB node going down) then a client will definitely hit another node and stickiness is not assured. At an application level, you're going to have to deal with that so I'd encourage a design that doesn't require sticky sessions if at all possible because it's a better way to go.
The following statement is currently incorrect.
Finally, NLB stickiness works when the client hits the same NLB node using the same source IP address. When the client does a DNS lookup for the NLB name, multiple IP addresses are returned and the client will choose one to connect to. On a second connection attempt, the client (which could be SignalR, the browser or the operating system) may choose a different IP address which will not deliver a "sticky" session.
Regardless of NLB node your client connects through, NLB can route new connections from the same client to the same backend target with the Sticky sessions feature.
Relevant content
- asked 4 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
Thanks for your reply.
The servers are quite identical, because they are launched using the same AMI (in an autoscaling group). Besides, the issue happens with both servers, no matter the first that we hit.
So, the AWS NLB stickiness depends also on the NLB node the client hits, and not only on the source client IP address? Is this caused by the different availability zones the NLB is in? If I make the NLB available in only one zone, that would solve the issue?
Unfortunately, SignalR communication does require sticky sessions to be in place, to ensure the final connection is established with the same host that did the negotiation.
A great quote from Werner Vogels (Amazon CTO) is "everything fails all the time". Phrased another way: Plan for failure. Highly recommended reading is therefore the Amazon Builders Library.
Ok, thanks, I see I still have to think about this.