当前位置:网站首页>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 .
边栏推荐
- [leetcode] day101 rotating image
- 大三实习生,字节跳动面经分享,已拿Offer
- Minimum spanning tree: Kruskal
- Junior intern, ByteDance, after sharing, has been offered
- Chapter1 data cleaning
- Chapter 2 Regression
- 剑指Offer第二版:字符串(简单)
- 模块化开发
- Understanding of signals
- Unity解决动画不可用:The AnimationClip ‘XXX‘ used by the Animation component ‘XXX‘ must be marked as Legacy.
猜你喜欢

做一个有职业操守的软件匠人

Protocol buffers 的问题和滥用

Unity—3D数学-Vector3

Unity solves that animation is not available: the animationclip 'xxx' used by the animation component 'xxx' must be marked as legacy

LeetCode_ 376_ Wobble sequence

The common interfaces of Alipay are uniformly encapsulated and can be used directly for payment parameters (applicable to H5, PC, APP)

Connect with Hunan Ca and use U_ Key login
![[shader realizes roundwave circular ripple effect _shader effect Chapter 6]](/img/3f/90c2f0004303dc577eba1615fa3fd7.png)
[shader realizes roundwave circular ripple effect _shader effect Chapter 6]

【微信小程序】你了解小程序开发吗?
![[100 cases of scratch drawing] Figure 46-scratch drawing flowers children's programming scratch programming drawing case tutorial grade examination competition drawing training case](/img/44/832686f3ee198772794cbd53e7d5a5.png)
[100 cases of scratch drawing] Figure 46-scratch drawing flowers children's programming scratch programming drawing case tutorial grade examination competition drawing training case
随机推荐
221. Largest square ● &1277. Square submatrix with statistics all 1 ● ●
One of QT desktop whiteboard tools (to solve the problem of unsmooth curve -- Bezier curve)
【愚公系列】2022年06月 .NET架构班 084-微服务专题 Abp vNext微服务通信
Kubevela offline installation
集群聊天服务器:如何解决跨服务器通信问题 | redis发布-订阅
LeetCode_376_摆动序列
Microservice architecture vs single service architecture [what can Huawei cloud service do in the microservice mode]
Jetson nano recording stepping on the pit (it will definitely solve your problem)
High numbers | calculation of triple integral 1 | high numbers | handwritten notes
高数下|二重积分的计算4|高数叔|手写笔记
[wechat applet] do you know about applet development?
WinDbg practice -- Introduction
Jetson nano烧录踩坑记(一定可以解决你的问题)
High numbers | calculation of double integral 3 | high numbers | handwritten notes
1309_ Add GPIO flip on STM32F103 and schedule test with FreeRTOS
"Pulse" to the future! Huawei cloud Mrs helps smooth migration to the cloud
手机股票开户安全吗?
High numbers | calculation of double integral 4 | high numbers | handwritten notes
告诉我十大证券公司?请问网上开户安全么?
分布式能源的不确定性——风速测试(Matlab代码实现)