[Seaside] Apache Load Balancing with Seaside
jtuchel at objektfabrik.de
jtuchel at objektfabrik.de
Mon Nov 14 06:55:42 UTC 2016
Am 12.11.16 um 11:14 schrieb Philippe Marschall:
> Unless you run on GemStone/S you need sticky sessions because there is
> generally a lot session related state required to service requests.
> That state is image local.
> Making mod_proxy_balancer do sticky sessions is fairly trivial, simply
> add a route to the session id. Have a look at the
That's exactly what we do, sticky sessions encoded in a Cookie, all
handled by Apache. It's surprisingly easy to configure.
However, we have the impression that the byrequests strategy favors the
first server and puts most load onto it, because byrequests is not the
same as "by new sessions". Of course, bytraffic is not really much
better, because number of bytes transferred is not necessarily related
to the workload needed to produce them.
So my question was probably just asked in a way too encoded way ;-)
I was wondering if people found a scheme that works better in a Seaside
scenario without writing their own Apache module (We're way too busy to
learn how to do that right now). For a moment I thought that some of the
quite cryptic sentences in the Apache docs imply that using URL encoding
instead of Cookies for saving the session marker in the
requests/responses might work better. And what I thought was said in the
docs (between the lines, obviously, because in the lines it says nothing
but "usually this is done by the backend") is that therefor the Seaside
part would have to provide some URL parameter that can be used by
Apache. And instead if implementing something on my own, I thought the
_s parameter would probably be the cheapest possible solution.
I guess the WARouteHandlerTrackingStrategy you mention is exactly that.
OTOH, thinking abou this a little more, there is almost no chance Apache
could do much better with URL parameters assigned by the backend as long
as the strategy where to send an initial request is as good or bad as it
is now. No matter how great a backend supports marking a session as his
own, as long as apache decides to send two thirds of the requests to the
same image over and over again, this won't change much.
So this all possibly boils down to this question:
Has anybody found a way to teach Apache to do the balancing based on
previously unassigned sessions rather than just requests (remember, each
request for a js or css file counts in the byrequests strategy)?
I guess a simple round robin for each not yet attached session would be
almost infinitely better than what we see right now.
> WARouteHandlerTrackingStragety hierarchy in the Seaside-Cluster 
> package. Then you'll just need to make sure that requests without a
> session are evenly distributed across images.
Exactly. That is the key.
> There are still issues left. First you can't dynamically add and
> remove images.
I haven't done any further research, but the Drain mode in
mod_proxy_balancer looks very promising, as well as the hot standby
mode. Not sure how I would change these modes programmatically though.
> Second when an image has more load than an other for
> whatever reason you can't tell mod_proxy_balancer to favour the less
> strained images for new sessions.
Yeah, that would be great. Hardware is cheap, though, so I am quite sure
we could live with it for quite a while. In my naive amateur's mind,
this would probably be better handled in "real" load balancers anyways
and will be something to look into once we've taken this step and run
into problems with horizontal scaling in Apache. Seems like it won't be
any time soon.
> mod_cluster allows you to do this,
> but I have only an incomplete and buggy implementation.
>  http://www.squeaksource.com/ajp.html
> seaside mailing list
> seaside at lists.squeakfoundation.org
Objektfabrik Joachim Tuchel mailto:jtuchel at objektfabrik.de
Fliederweg 1 http://www.objektfabrik.de
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
More information about the seaside