当前位置:网站首页>Why cluster chat server introduces load balancer
Why cluster chat server introduces load balancer
2022-07-23 21:18:00 【_ Soren】
List of articles
Load Balancer
At present, the project has only one server ,32 position Linux The system supports about 20000 user connections , To improve the concurrency of the server , Cluster or distributed deployment of servers is required .
The simpler way is to expand multiple servers horizontally , Each server runs independently ChatServer. Of course , The client cannot choose which server to connect to , The operation of this selection is left to Load Balancer , Also called reverse proxy device . Through the established algorithm , Distribute client requests to different servers .
Icon :
Nginx Configuration of
download Nginx After the installation package is decompressed , Enter this directory 
Execute the command :

This is a successful implementation , There may be a lack of PCRE Library or OpenSSL library , If it is missing, it will prompt , Follow the instructions to install .
Re execution make && make install, If there is an error , Enter the corresponding file according to the error , You can modify it. .
Two common mistakes can be seen here :【Nginx make How to deal with errors in 】
After the download , Get into /usr/local/nginx Under the table of contents

Get into conf Catalog , find nginx.conf file

stay events and http Between , To configure Nginx TCP Load balancing

listen 8000, Refer to Nginx The port number that will listen . Let all clients connect 8000 port .
proxy_pass Myserver: All connections in 8000 Port requests , All go to Myserver Load balancing in the module . At this time, there are two servers and port numbers in this module .
weight=1, Means weight , So the process of polling . If the following weight = 2, Then suppose there are three client connections , The first server will be assigned a client , The second one is allocated two . In this case , If the hardware configuration of a server is high , You can make its weight bigger .
max_fail: heartbeat , If the heartbeat fails three times , By default, the server is down , Then when the client requests to enter , The server will not be loaded .
边栏推荐
猜你喜欢

WinDbg实践--入门篇

支付宝常用接口统一封装,可直接支付参数使用(适用于H5、PC、APP)

LU_ASR01语音模块使用

Problems and abuse of protocol buffers

Problems and abuse of protocol buffers

WinDbg practice -- Introduction

Jetson nano recording stepping on the pit (it will definitely solve your problem)

数据库压力测试方法小结

LU_ Asr01 voice module usage

Oom mechanism
随机推荐
1062 Talent and Virtue
高数下|三重积分的计算2|高数叔|手写笔记
Identify some positions in the parenthesis sequence
【着色器实现RoundWave圆形波纹效果_Shader效果第六篇】
HDU - 2586 How far away ? (multiply LCA)
集群聊天服务器:集群与分布式理论
scala編程(初級)
ES6 feature: Promise (custom encapsulation)
剑指 Offer II 115. 重建序列 : 拓扑排序构造题
Scala Programming (Junior)
Jetson nano recording stepping on the pit (it will definitely solve your problem)
高数下|二重积分的计算3|高数叔|手写笔记
SQLite数据库
1309_STM32F103上增加GPIO的翻转并用FreeRTOS调度测试
High numbers | calculation of double integral 3 | high numbers | handwritten notes
UnauthorizedAccessException:Access to the path “/xx/xx.xx“ is denied
vite3学习记录
TypeScript基础
Problems and abuse of protocol buffers
One of QT desktop whiteboard tools (to solve the problem of unsmooth curve -- Bezier curve)