⚖ Load Balancing vs ⚙ Failover
- 
					
					
					
					
 :scales: Load Balancing vs :hourglass: Failover
 Apart from Application Development, To become a DevOps EngineerorSystem Adminyou need to learn some production leveldeploymentandmaintenancetechnique to design betterserver architectureto providehigh available service.In this small blog, We will see about 2 important things, - Load Balancing
- Failover
 Both are server setup techniquesto provideHigh AvailableorZero Downtimeservices.Let's See one by one. 
 The problem When you deploy our application. The server will serve the service to our clients. 
 The client will send arequestto server, Then our server willresponseto client.When so many clients use our service / app, They will send millions of requests per second. Everything has a limited capacity. We can do limited tasks using our two hands.Like that Server will handle only limited requestsper second (around 1000 req/ sec But it depends on the internal architecture).In above case, When server meet the maximum limit, It will get trouble to process the requests. So the server will stop service / hang automatically. This is what we calledServer Down. In this case, Client's will not access our service / application / website which is hosted in that perticlular server.To avoid this problem, some server softwares automatically decline the clients' requests when reach limit. But this will create a bad opinion:angry: :angry: on ourusers'orclients'mind about our service. They will be disappointed when they couln't access our service.Here we need to implement Load BalancingorFailover.
 The Load Balancing The name will give you a idea. Just think balance the load. Load Balancing means divideanddistributethetraffic (requests)between more than one servers.For example 
 You have 3 servers, Each server will handle 1000 requests per second.When you receive 2500 requests per second, The load balancer will divide the requests and serve to 3 servers something like, Server 1 - 900 Req / S 
 Server 2 - 900 Req / S
 Server 3 - 700 Req / SHere your servers will work together without getting stucked.  
 There are 2 typesofload balancers.- Physical Load Balancer
- Logical Load Balancer
 
 Physical load Balancer This is a device looks like a network switch. Connected with servers to balance incomming traffic.  
 Logical Load Balancer Thit will run as a service inside the main serverorproxy. It will receive allrequeststhen transfer to other services insame serverorsubservers.Something like this, Main Server - yourapp.com The main server will get request, Then will forward & balance between below services. App1 - localhost:80 
 App2 - localhost:8080
 App3 - localhost:8000
 App4 - localhost:8001The Nginxis a famousweb serverwith built-inreverse proxy&load balancerSample Load Balancer Configuration of Nginx. http { upstream myapp1 { server srv1.example.com; server srv2.example.com; server srv3.example.com; } server { listen 80; location / { proxy_pass http://myapp1; } } }Click Here to Read More About nginx Load Balancing. 
 FailoverFailoveris little different fromload balancing. Here we are not going to balance the load.Here also we need more than 1 server. But we will fireup other server instead of one, When that server went down. Confusing? For Example We have following 2 servers. Server 1 : 192.168.8.100 Server 2 : 192.168.8.103 Here, We don't use both servers at the same time. We will start the second server, When the first server went down. When our first server stop working, Thefailovermachanismautomatically turn-onserver 2.
 These are the main concepts of Load BalancingandFailover. Hope now you have learn new thing.Just put a comment, If you want to write about anything else. Or if you have any questions. Thank you! With :hearts: B6. 
- 
					
					
					
					
 Thanks bro 
- 
					
					
					
					
 Good work bro. keep posting. this is very clean articles, Thanks 
- 
					
					
					
					
 @root Thank you bro :) 
- 
					
					
					
					
 Good article. 
- 
					
					
					
					
 @Chirantha-Jananath Thx Bro 
- 
					
					
					
					
 Good explanation 
- 
					
					
					
					
 @Piumal-Kavinda thank you 
- 
					
					
					
					
 Great post. Simple and accurate.. 
- 
					
					
					
					
 @b6 I have a question , can this two methods apply for virtualised servers ? 
- 
					
					
					
					
 @Piumal-Kavinda you mean VPS ? 
- 
					
					
					
					
 @root Not exactly , nowdays most companies using virtual servers by hyper v and Vmware so load balancing and fail over technologies must be support that platforms . .  
- 
					
					
					
					
 ahh ok, this can work with virtual architectures. no problem bro 
- 
					
					
					
					
 @Piumal-Kavinda Yes, You can apply. The logical load-balances handles the virtual instances. And physical machanism used to manage the parent instance. And nowadays no one using Virtual Architecture with Virtual Machines because of performance and scalability. Use containers instead of VMs. Docker & Kubernate are rocking today's architecture, 
- 
					
					
					
					
 @dinlinux Thank you! 
 
			
		 
			
		