[Wt-3.3.3] Wt load-balancing
Added by Thomas Saquet over 10 years ago
Hello,
We are currently working on an high-availability cloud-hosted Wt web server.
If we understood correctly, we cannot load-balance the requests : Wt is not able to pass a session to a server to "continue a session".
We found in a former version of the wish list:
"Session-Store-Failover: Ability to pass session to a database/server so that if system currently running the session dies the user can be redirected to other machine (through load balancing/fallover) and new instance can reload users session and continue."
This wishlist is deprecated, and I could not find it as a feature request. Is it still planned ? At first we will use a "light" load-balancing with Apache Traffic Server (based on http://redmine.webtoolkit.eu/projects/1/wiki/Using_HAProxy_as_a_reverse_proxy), but we really would like to be able to do it properly.
It seems to be mandatory to use Wt in a large-scale SaaS platform, what do you think about it ?
Thank you,
Regards,
Thomas
Replies (3)
RE: [Wt-3.3.3] Wt load-balancing - Added by Koen Deforche over 10 years ago
Hey,
The wiki page you reference also explains how to use 'session affinity' which is what you need to load balance the requests. It shows how you can configure HAproxy to do it.
What do you mean with "light" load-balancing and what do you mean with doing it properly? In our experience, HAProxy is well fit for load balancing (in fact, it's all it does, and it does it very well).
Regards,
koen
RE: [Wt-3.3.3] Wt load-balancing - Added by Thomas Saquet over 10 years ago
Hello Koen,
Indeed, I read and understood the "session affinity" configuration. That is what I call "light" load-balancing. This is "light" is because it sticks an user to a single server. It is user-balancing, but not really load-balancing.
What I need to do is to balance each request to a random server (by random i mean whatever server in my cluster) and to continue the session previously started on the first server : the cluster of servers behind the load balancer should be session-aware to do that.
It is much more reliable in order to dispatch the load between servers than the "session affinity" method.
Maybe can you briefly explain me how this is implemented in Wt and I maybe could change it for my purpose ? I imagine that I can use Memcached to share the session between servers ?
Thank you in advance,
Regards,
Thomas
RE: [Wt-3.3.3] Wt load-balancing - Added by Koen Deforche over 10 years ago
Hey Thomas,
No, such a thing is not implemented (nor would it be possible do so since Wt doesn't know how to move the heap related to one session from one process to another in a way that keeps it consistent). Perpahs not impossible, but certainly not a trivial amount of work with all kind of gotchas and don'ts (like, what about open file descriptors, open tcp connections, ... ?).
However, in our experience, the "light" load-balancing method works really well. The only downside is that one server could go down and then you loose all sessions on it. But on the other hand, what if a server goes down while it's state has not be synchronized with some central repository, then you will loose these sessions too, even if you use such a 'heavy' load-balancing method. I believe it's for this reason that in practice, even most J2E deployments do not use this although J2E was designed for this kind of method.
Also, (well-runing) servers should have uptimes that outlive scheduled maintenance/network outages.
Personally, I find it strange to prefer random distribution of requests and then doing all the hard work to make sure all session state is distributed. That simply violates the 'locality' principle which is the mantra of a good scalable/performing application, and moreover relying on a heavy, shared, point of failure (the centralized session storage) surely is not more robust than keeping state nicely distributed and local?
Regards,
koen