# Load balancer can't switch instantaneously between servers

**URL:** <https://community.ovhcloud.com/t/load-balancer-cant-switch-instantaneously-between-servers/30149>\
**Category:** Bare Metal et VPS\
**Created:** [Juin 17, 2020, 10:46 UTC](https://community.ovhcloud.com/t/load-balancer-cant-switch-instantaneously-between-servers/30149 "2020-06-17T22:46:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasB22](https://community.ovhcloud.com/letter_avatar/thomasb22/32/6_449c533f586939b6e5f246632a46421f.png) [@ThomasB22](https://community.ovhcloud.com/u/ThomasB22)\
**Post date:** [Juin 17, 2020, 10:46 UTC](https://community.ovhcloud.com/t/load-balancer-cant-switch-instantaneously-between-servers/30149/1 "2020-06-17T22:46:45Z")

</div>

Hi,  
I would like to receive help for a problem with Load balancer.  
It's about applying changes at once without ambigous transitions.  
   
Background.  
We have a frontend application JS and a Java application for the APIs, two machines each.  
  
To resume the Load Balancer configuration (no HTTPS involved at the moment) that we currently have:  
Blue frontend for users (port 80)  
Green frontend for developers (port 8888)  
  
In terms of servers:  
2 servers that serve a front Javascript application; these servers are here called front1 and front2  
2 servers that serve a back Java application for REST apis requested by the front application; these servers are called here back1 and back2  
  
In terms of clusters:  
1 cluster called Fronts, containing front1 and front2  
1 cluster called Backs, containing back1 and back2  
1 cluster called Front2, containing front2  
1 cluster called Back2, containing back2  
  
In terms of default server clusters  
Blue frontend defaults to cluster Fronts  
Green frontend defaults to cluster Front2  
  
In terms of routes/actions (43047, 43045, 43040)  
1 rule on Blue frontend: direct traffic to cluster Backs when: Host request header is [api.domain.com](http://api.domain.com)  
1 rule on Blue frontend: direct traffic to cluster Back2 when: host is [api.domain.com](http://api.domain.com) and Origin header ends with 8888   
1 rule on Green frontend: direct traffic to cluster Back2 when: host is [api.domain.com](http://api.domain.com)   
  
The default situation is:   
Users are directed to Blue frontend; their [domain.com](http://domain.com) requests are handled by cluster Fronts cluster (with active front1 and front2 servers), and their [api.domain.com](http://api.domain.com) requests by Backs cluster (with active back1 and back2 servers).  
Developers are directed to Green frontend; their [domain.com:888](http://domain.com:888) handled by Front2 cluster, [api.domain.com:8888](http://api.domain.com:8888) requests handled by Back2 cluster.  
Green frontend won't be touched during the process of a new deployment.  
  
Having a new deployment for front and back applications consist in the following operations:  
1. disabling front2 and back2 from Fronts and Backs clusters  
2. updating the applications  
3. invert whose active and inactive in clusters Fronts and Backs (which means that front2 and back2 become active, while front1 and back1 inactive), thus giving the possibility to update applications on the inactive servers  
4. put things back to normal  
  
The problem  
The problem that we encounter is that during phase 3, which consists in 4 changes to be applied to the Load Balancer, these rules are not applied at once with the /refresh endpoint, but step by step. This involves having users hitting during tens of seconds both the old application version and the new one.  
  
My question is:  
- Is there a better way to do this transition so that users are transitioned instantaneously on the same servers for front and back? Neither a change from round robin to source, nor tracking a session did solve the problem.   
- Are changes to the load balancer applied in the same order of their creation with the apis?
