Introduce load balancing in software engineering

负载均衡是一种在网络工程中用于分散流量到多台服务器的技术,防止单个服务器过载。它在处理软件系统的可扩展性时至关重要,特别是在横向扩展Web应用并添加额外服务器时。负载均衡器可以是硬件、软件或两者兼有,它们位于网络服务器前面,根据不同的算法如最少连接法、最少带宽法等分配客户端请求。此外,全球服务器负载均衡(GSLB)可以路由地理分布的服务器之间的流量,提高响应时间和整体性能。
摘要由CSDN通过智能技术生成

Introduce load balancing in software engineering

1. Introduction

在这里插入图片描述

Load balancing is a technique used in software engineering to distribute incoming network traffic among multiple servers or resources to prevent a single server from becoming overloaded and ensure that no server becomes overworked. Load balancing is essential when dealing with scalability in our software systems, especially when we need to scale our web app horizontally and purchase a few additional servers, each hosting a replica of our app. Load balancers sit in front of our network servers, and our network must contain one or more redundant servers or resources that it balances incoming traffic for.

A load balancer can be a piece of hardware or software (and sometimes both) that helps distribute requests between different system resources. Load balancers can reside on-premise, in a regional or global data center, or in the cloud, making it easy to set up load balancing services residing anywhere in the world. Load balancing can be performed by dedicated load balancers or in an Application Delivery Controller (ADC) with load balancing capabilities. Load balancing is pre-built into many popular software packages, and it is so pervasive that unless one is actively working on it, they may not even realize it is there.

Load balancers route traffic at Layer 4 or Layer 7 of the Open Systems Interconnection (OSI) model. They advertise their address as the destination IP address for a service or website. Balancers receive incoming client requests and select servers to process each request. Layer 4 (L4 OSI Transport layer) balancers do not inspect the contents of each packet. They make routing decisions based on the port and IP addresses of the incoming packets and use Network Address Translation (NAT) to route requests and responses between the selected server and the client. Layer 7 (L7 OSI Application layer) balancers route traffic at the application level. They inspect incoming content on a package-by-package basis. L7 balancers route client requests to selected servers using different factors than an L4 balancer, such as HTTP headers, SSL session IDs, and types of content (text, graphics, video, etc.). L7 balancers use more computational power than an L4 server. They can be more efficient because they route based on context-based factors.


2. Load balancing algorithms

在这里插入图片描述

Load balancers use algorithms to determine where to route client requests. Some of the more common load balancing algorithms include:

  • Least Connection Method. Clients are routed to servers with the least number of active connections.

  • Least Bandwidth Method. Clients are routed to servers based on which server is servicing the least amount of traffic, measured in bandwidth.

  • Least Response Time. Server routing occurs based on the shortest response time generated for each server. Least response time is sometimes used with the least connection method to create a two-tiered method of load balancing.

  • Hashing methods. Linking specific clients to specific servers based on information in client network packets, such as the user’s IP address or another identification method.

  • Round Robin. Clients are connected to servers in a server group through a rotation list. The first client goes to server 1, second to server 2, and so on, looping back to server 1 when reaching the end of the list.

在这里插入图片描述

Global server load balancing (GSLB) is also available. GSLBs can route traffic between geographically dispersed servers located in on-premise data centers, in the public cloud, or in private clouds. GSLBs are generally configured to send client requests to the closest geographic server or to servers that have the shortest response time.

Using load balancing techniques, we can direct traffic to different network adapters servicing the same servers, distribute data queries to different servers, increasing reliability, integrity, and response time, and improve overall on-premise, mobile, and web performance.


3. Summary

Load balancing is a solution for horizontal scaling, and it is a core networking function that can be used anywhere to uniformly distribute workloads across different computing resources. It is essential when dealing with the scalability of our software systems, especially when we need to scale our web app horizontally and purchase a few additional servers, each hosting a replica of our app. Load balancers use algorithms to determine where to route client requests, and they can reside on-premise, in a regional or global data center, or in the cloud, making it easy to set up load balancing services residing anywhere in the world.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值