当前位置:网站首页>IO密集型和CPU密集型
IO密集型和CPU密集型
2022-06-22 06:10:00 【酷小亚】
一、计算密集型
需非常多CPU计算资源,让每个CPU核心都参与计算,CPU性能充分利用,避免过多线程上下文切换,理想方案是:线程数 = CPU核数+1
也可CPU核数*2,要看JDK版本,及CPU配置(服务器CPU有超线程)。1.8来增加并行计算,想线程数 = CPU内核线程数*2
二、IO密集型
网络、磁盘 IO (与DB、缓存),一旦IO,线程就等待,结束才执行。多设线程数,等待时去做其它事,提高效率。
线程上下文切换有代价。IO密集型公式:线程数 = CPU核心数/(1-阻塞系数) 阻塞系数一般0.8~0.9,双核CPU理想线程数20,动态线程池看压测情况。
三、1000个并发线程,10台机器,每台机器4核,设计线程池大小
思路:CPU、IO密集型的情况。压测得合理参数配置。线程池动态调整。
CPU 密集:减少上下文切换,核心线程数5,队列长100,最大线程数和核心线程数一致。
IO 密集:分配一点核心线程数,更好利用 CPU,核心线程数 8,队列长100,最大线程池10
上面都是理论上的值。从核心线程数5 开始压测,对比结果,确定合适设置。极限:核心线程数和最大线程数都是 4,队列96,刚好100 请求
边栏推荐
- 单细胞论文记录(part14)--CoSTA: unsupervised convolutional neural network learning for ST analysis
- Ethernet communication protocol
- Server PHP related web page development environment construction
- TCP连接细节问题
- Design input of Oracle project management system
- JTAG interface
- 单细胞论文记录(part7)--DL and alignment of spatially resolved single-cell transcriptomes with Tangram
- [Key review of cloud computing]
- h = key.hashCode()) ^ (h >>> 16) 详细解读以及为什么要将hashCode值右移16位并且与原来的hashCode值进行异或操作
- Array and foreach traversal in C #
猜你喜欢

Single cell paper records (Part8) -- cell2location maps fine grained cell types in spatial transcriptomics

Simple use of idea plug-in easy code

单细胞文献学习(part2)--stPlus: a reference-based method for the accurate enhancement of ST

On the matrix order of MNIST linear model

Case analysis of terminal data leakage prevention

reduce_sum()中的reduction_indices

Server PHP related web page development environment construction

Expert PID control in Simulink

System identification of automatic control principle

400 hash table (1. sum of two numbers, 454. sum of four numbers II, 383. ransom letter)
随机推荐
Assertion based validation
On the definition of jinja2 macro
StopWatch的使用
Markdown中插入类图(classDiagram)
Single cell thesis record (part13) -- spagcn: integrating gene expression, spatial location and history to
Single cell paper record (Part11) -- clustermap for multi-scale clustering analysis of spatial gene expression
Matlab system identification
信息系统项目管理 - 范围管理(划重点)
idea插件Easy Code的简单使用
雷达导引头伺服系统的建模与仿真
关于jinja2 宏定义的小问题
drop、truncate和delete的区别
Generics in C #
朗国科技助力OpenHarmony生态繁荣
Le contrôle MFC tabctrl modifie la taille de l'étiquette
D3D learning notes (1) - Introduction to the use conditions of autodraw at so stage
单细胞论文记录(part9)--Spatial charting of single-cell transcriptomes in tissues
Ptrade trading program code - from zero to firm offer 19
Single cell thesis records (part9) -- spatial charting of single cell transcriptomes in lectures
单细胞论文记录(part14)--CoSTA: unsupervised convolutional neural network learning for ST analysis