1.0 Introduction

Today’s internet user experience demands performance and uptime.

To achieve this, multiple copies of the same system are run, and

the load is distributed over them. As load increases, another copy

of the system can be brought online. The architecture technique is

called horizontal scaling. Software-based infrastructure is increas‐

ing in popularity because of its flexibility, opening up a vast world

of possibility. Whether the use case is as small as a set of two for

high availability or as large as thousands world wide, there’s a need

for a load-balancing solution that is as dynamic as the infrastruc‐

ture. NGINX fills this need in a number of ways, such as HTTP,

TCP, and UDP load balancing, the last of which is discussed in

Chapter 9.

This chapter discusses load-balancing configurations for HTTP

and TCP in NGINX. In this chapter, you will learn about the

NGINX load-balancing algorithms, such as round robin, least con‐

nection, least time, IP hash, and generic hash. They will aid you in

distributing load in ways more useful to your application. When

balancing load, you also want to control the amount of load being

served to the application server, which is covered in Recipe 1.4.

1.1.0 介绍

如今的互联网产品的用户体验依赖与产品的可用时间和服务性能。为实现这

些目标,多个相同服务被部署在物理设备上构建称服务集群,并使用负载均

衡实现请求分发;随着负载的增加,新的服务会被部署到到集群中;这种技

术称之为水平扩展。由于其灵活性,基于软件的可扩展技术越来越受到青睐。

而无论是仅有两台服务器的高可用技术方案,还是成千上万台服务器的高可

用集群,它们的可用性都需要灵活的负载均衡解决方案才能得以保障。NGINX

提供了多种协议的负载均衡解决方案如:HTTP、TCP 和 UDP 负载均衡,其中

UDP 负载均衡将在第 9 章讲解。

本章将讨论 HTTP 和 TCP 负载均衡技术。还将学习负载均衡算法如:轮询,

最少连接数,最短响应时间,IP 哈希和普通哈希。这些负载均衡算法有助于

您在项目中选择行之有效的请求分配策略。此外,还将讲解如何将更多的请

求分配到那些服务器性能更好的机器上。

results matching ""

    No results matching ""