To ensure high availcapability and also performance of Net applications, it is now widespread to use a load-balancer.While some human being offers layer 4 load-balancers, it have the right to be at some time recommended to usage layer 7 load-balancers to be even more efficient via HTTP protocol.
You are watching: Why would you need to use single affinity?
NOTE: To understand much better the difference in between such load-balancers, please review the Load-Balancing FAQ.
Discover even more by registering for our webinar: “Summary to lutz-heilmann.info Stick Tables“A load-balancer in an infrastructure
The image below mirrors just how we usually install a load-balancer in an infrastructure:
This is a logical diagram. When working at layer 7 (aka Application layer), the load-balancer acts as a reverse proxy.So, from a physical point of check out, it have the right to be plugged everywhere in the architecture:in a DMZin the server LANas front of the servers, acting as the default gatewayfar amethod in an various other separated information centerThe difficulties of load-balancing internet applications
Well, HTTP is not a connected protocol: it suggests that the session is completely independent from the TCP relationships.Even worst, an HTTP session can be spread over a couple of TCP connections…When there is no load-balancer associated, tright here won’t be any type of problems at all, considering that the single application server will certainly be mindful the session indevelopment of all individuals, and whatever before the number of client connections, they are all redirected to the unique server.When making use of a number of application servers, then the problem occurs: what happens as soon as a user is sfinishing repursuits to a server which is not aware of its session?The user will certainly acquire ago to the login web page because the application server can’t access his session: he is considered as a new user.
To prevent this type of problem, tbelow are a number of ways:Use a clustered internet application server wbelow the session are easily accessible for all the serversSharing user’s session information in a database or a document device on application serversUse IP level information to keep affinity between a user and also a serverUse application layer information to keep persistence in between a user and a server
NOTE: you have the right to mix various technc listed above.
Building a web application cluster
Only a few products on the industry enable administrators to produce a cluster (prefer Weblogic, tomcat, jboss, etc…).I’ve never configured any of them, but from Administrators I talk as well, it does not seem to be a straightforward task.By the way, for Internet applications, clustering does not mean scaling. Later, I’ll write an short article explaining while even if you’re clustering, you still might need a load-balancer in front of your cluster to develop a robust and scalable application.
Sharing user’s session in a database or a file system
This Technic uses to application servers which has no clustering functions, or if you don’t want to permit cluster attribute from.It is pretty easy, you pick a means to share your session, normally a paper device like NFS or CIFS, or a Database like MySql or SQLServer or a memcached then you configure each application server via correct parameters to share the sessions and to accessibility them if required.I’m not going to provide any kind of details on how to perform it below, simply google through proper keywords and you’ll acquire answers incredibly conveniently.
IP source affinity to server
An straightforward way to keep affinity between a user and a server is to usage user’s IP address: this is called Source IP affinity.Tbelow are most issues doing that and I’m not going to information them appropriate currently.The only point you have to understand is that resource IP affinity is the latest approach to use once you want to “stick” a user to a server.Well, it’s true that it will settle our worry as long as the user use a single IP deal with or he never before readjust his IP resolve during the session.
Application layer persistence
Because a internet application server hregarding identify each individuals individually, to stop serving content from a user to an various other one, we might use this indevelopment, or at least attempt to redevelop the exact same habits in the load-balancer to preserve persistence between a user and also a server.The information we’ll use is the Session Cookie, either set by the load-balancer itself or making use of one put up by the application server.
See more: Why You Keep Playing With My Heart (Ft, Avstin James
Affinity: this is once we use an information from a layer listed below the application layer to maintain a customer research to a single serverPersistence: this is once we usage Application layer indevelopment to stick a client to a single serversticky session: a sticky session is a session kept by persistence
The primary benefit of the persistence over affinity is that it’s a lot more specific, however occasionally, Persistence is not doable, so we have to count on affinity.
Using persistence, we intend that we’re 100% sure that a user will get redirected to a solitary server.Using affinity, we intend that the user may be redirected to the exact same server…The interactivity through load-balancing
In load-balancer you have the right to pick between a number of algorithms to pick up a server from a internet farm to forward your client requests to.Some algorithm are deterministic, which implies they have the right to usage a customer side indevelopment to select the server and always send the owner of this indevelopment to the very same server. This is wright here you typically do Affinity