On Tue, May 9, 2017 at 2:11 PM, Lukas Tribus <[email protected]> wrote: > Hello, > > > Am 09.05.2017 um 02:52 schrieb redundantl y: > > The way ab is being executed is inline with our real world use. A > > separately hosted application will generate HTML with several (20-30) > > elements that will be loaded simultaneously by the end user's > > browser. There isn't a delay, the elements aren't loaded sequentially. > > I understand that, but I still doubt that a browser will open 10 > concurrent TCP connections within a millisecond. Also browser ALWAYS > keepalive, which you don't consider here (I don't know if you enabled > keepalive in haproxy though). I strongly suggest you look at the actual > browsers behavior (when keepalive is enabled in haproxy), before you > continue investing your time with a problem that may be hypothetical. > > It does open a lot of concurrent connections, within tens of milliseconds of each other.
For example, I have tried with the latest versions of Firefox, Safari, and Chrome. With 30 elements on the page being loaded from the server they're all being loaded within 70ms of each other, the first 5 or so happening on the same millisecond. I'm seeing similar behaviour, being sent to alternating backend servers until it "settles" and sticks to just one. >From what I've read, keep-alive is enabled by default with haproxy 1.5 on CentOS 7. > > > So is this behaviour we're seeing with haproxy expected? There's no > > additional options we can try to make it create and use a stick-table > > entry faster? > > This is not about stick-table being slow. Its about requests being > elaborated concurrently in haproxy, so one cannot depend on the other. > To get what you need, haproxy would have to block/queue incoming > requests (I guess you could "maxconn 1" in your frontend, but don't you > run this in production). > > >From what I can tell this is about the stick-table entry not being created fast enough. I'd love to be wrong about this. > > > In the mean time, we've changed the load balancing method from round > > robin to URI and are seeing the behaviour we desire, it'll just carry > > the risk of not having an even distribution of load to the backend > > servers. > > Concurrent requests from ab combined with concurrent request handling in > haproxy with roundrobin balancing will lead to this behavior. I don't > see how haproxy could behave differently in this configuration. > > > cheers, > lukas > > I misspoke, I didn't change it to URI. Instead of sticking on a url_param I'm now load balancing on the url_param desired. Specifically I have the following in my backend configuration: balance url_param email haproxy is creating a hash based on the value of that parameter and deciding which backend server to send it to, so all connections (whether I use ab or one of three web browsers) are being sent to a single backend server. My concern with this was if the hashing method being used was random enough to create an even split between the backend servers. So far in our testing it appears that it is pretty evenly split.

