This is an outstanding breakdown — one of the best around.
I’m still unsure of the best practices for handling sticky sessions. I went to a Meteor meetup a year+ ago where a speaker’s gist on the topic was “Nginx does not support sticky sessions so you must use HAProxy.” Reading up I found an Nginx module available, `nginx-sticky-module`, which claimed to handle it well. But the module exists in various forks and locations, and it’s not clear to me if there’s a canonical version or whether it’s maintained. I didn’t try it.
Your post taught me about `ip_hash` which sounds like it does the trick for most situations, but according to the sticky module documentation “Using a persistence by IP (with the ip_hash upstream module) is maybe not a good idea because there could be situations where a lot of different browsers are coming with the same IP address (behind proxies)and the load balancing system won’t be fair.”
I wonder if that’s a valid general concern, that we need to think about IP masking behind proxies when setting up sticky sessioning, or if it’s more of a special case concern or what. Not sure.
Thanks for a great read.