当前位置:网站首页>Server concurrency - note 1
Server concurrency - note 1
2022-06-12 14:13:00 【Panda general】
One 、 Improve server concurrency

1. queue + Connection pool
2. The main business logic is processed on the application server , The server only does auxiliary business processing
3. cache , Reduce database access .
3.1 Cache synchronization , When the cache fails, query the relevant data in the database , Poor real-time performance ;
3.2 Once the data in the database is updated , Notify the front end of the cache update , In this way, the real-time performance is better .
3.3 Cache page feed , Out of memory , Swap inactive data out of memory , Common algorithms FIFO,LRU( It is seldom used recently ),LFU( Least frequently used ).
4. Database read and write operations are separated , There are usually more query operations than update requests , Separate read and write operations to achieve load balancing . Databases usually have replication Mechanism ,Master The database is used to update data , Multiple Slave The database is used for query operations , When there is data update, it should be synchronized to multiple Slave database .
5. The application server can also realize load balancing .
5.1 Add a task server to realize , The task server monitors the load of the application server 、CPU Etc , Select the server with the lowest load to distribute tasks .
5.2 The application server takes the initiative to fetch tasks from the task server for processing , This load balancing will be fairer . The constraint is that all application servers can handle the same task .
6. The task server should have 2 One or more ,2 Heartbeat detection between stations , When one of them fails , It should be able to transfer to another one immediately ,FailOver Mechanism .
7. Four killers of server performance :
7.1 Data copy ---- cache
7.2 Environment switching ---- How to choose between single thread and multi thread , If the server is single core , Using multithreading will increase the switching overhead , The state machine programming mechanism is the most efficient ; If the server is multi-core , Multithreading can give full play to multi-core performance , However, environment switching should be avoided as far as possible , Not more is better .
7.3 Memory allocation — Reduce the amount of memory allocated to the operating system .
7.4 Lock competition — Use logic to avoid lock use .
边栏推荐
- Alibaba cloud development board haas510 sends the serial port data to the Internet of things platform
- 280 weeks /2171 Take out the least number of magic beans
- For cross-border e-commerce, the bidding strategy focusing more on revenue - Google SEM
- [advanced MySQL] query optimization principle and scheme (6)
- Dial up and Ethernet
- 高考回忆录
- Player practice 18 xresample
- TestEngine with ID ‘junit-vintage‘ failed to discover tests
- Mold and remainder
- 肝了一个月的原创小袁个人博客项目开源啦(博客基本功能都有,还包含后台管理)
猜你喜欢

Greed issues - Egypt scores

TestEngine with ID ‘junit-vintage‘ failed to discover tests
![[video lesson] a full set of tutorials on the design and production of Android studio Internet of things app -- all mastered during the National Day](/img/8d/3bfb5d2798797be3e0b10e25c978d3.png)
[video lesson] a full set of tutorials on the design and production of Android studio Internet of things app -- all mastered during the National Day

基于Profibus-DP协议的PLC智能从站设计

拆改广告机---业余解压

什么是自动出价?它的优势是什么?

阿里云开发板HaaS510解析串口JSON数据并发送属性

Alibaba cloud development board haas510 submission device attributes

Relevant knowledge points of cocoapods

阿裏雲開發板HaaS510報送設備屬性
随机推荐
Dismantle and modify the advertising machine - Amateur decompression
IAT hook hijacking process API call
English learning plan
Alibaba cloud development board haas510 connects to the Internet of things platform -- Haas essay solicitation
Remote code injection
如何使用android studio制作一个阿里云物联网APP
one × Convolution kernel of 1
Player practice 11 audio resampling
Shell notes
CSDN博客积分规则
Alibaba Cloud Development Board haas510 submission Device Properties
Player actual combat 13 create qtopengl project to promote window control and reload qoopenglwedge
Redis core configuration and advanced data types
初学者入门阿里云haas510开板式DTU(2.0版本)--510-AS
Alicloud development board vscode development environment setup
Démontage et modification de la machine publicitaire - décompression amateur
十四周作业
[MySQL advanced] index classification and index optimization scheme (V)
chapter19 Allocation
阿里云开发板HaaS510响应UART串口指令