惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
Martin Fowler
Martin Fowler
P
Palo Alto Networks Blog
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
博客园_首页
量子位
小众软件
小众软件
F
Full Disclosure
Vercel News
Vercel News
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
博客园 - 聂微东
V
V2EX
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
WordPress大学
WordPress大学
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
L
Lohrmann on Cybersecurity
H
Hacker News: Front Page
Spread Privacy
Spread Privacy
AI
AI
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CERT Recently Published Vulnerability Notes
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Recorded Future
Recorded Future
L
LINUX DO - 热门话题
Microsoft Azure Blog
Microsoft Azure Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Latest news
Latest news
W
WeLiveSecurity
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 司徒正美
博客园 - 叶小钗
T
Threat Research - Cisco Blogs
P
Privacy International News Feed
O
OpenAI News
Help Net Security
Help Net Security
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
博客园 - Franky

轶哥博客

blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog
blog
2020-11-06 · via 轶哥博客

遇到一个奇怪的需求,需要在项目未正式交付前,各台服务器使用率满足“CPU不低于 20% ,内存不低于40%,磁盘不低于40%”的要求。

CPU使用率

下载负载生成程序

使用方法

例1:所有CPU核心负载30%运行10秒钟

./cpu -p 30 -t 10

例2:所有CPU核心负载30%持续运行

./cpu -p 30

例3:只让2个CPU核心负载30%运行10秒钟

./cpu -p 30 -c 2 -t 10
  • all CPU load = (num of para c _ num of p) / (all cores count of CPU _ 100)
  • may not specify cores run the load only, it just promise the all CPU load, and not promise each cores run the same load

例4:后台运行,CPU使用率不低于20%

nohup ./cpu -p 21 >> cpu.log 2>&1 &

参数说明

--coresCount value, -c value   使用多少核心 (可选, 默认: 8)

--timeSeconds value, -t value  运行多长时间 (可选, 默认: 2147483647)

--percentage value, -p value   每个核心的负载百分比 (必须)

--help, -h                     显示帮助信息

内存使用率

下载内存泄露程序

下载地址一:http://todo.sercretcore.cn/memory.zip

下载地址二:https://cdn.wyr.me/files/memory.zip

使用方法

例1:快速进行内存泄露至2GB

$ ./memory -d 5 -l 2048
Leaked: 2048 MiB ███████▒▒▒ 
Holding at 2048 MiB 

例2:后台运行内存泄露至13GB

nohup ./memory -l 13312 >> memory.log 2>&1 &

参数说明

./memory [-d <泄露延迟 ms; 默认 100>]
 
  -d int    选项: 调整泄漏率的延迟(毫秒); 默认 100ms

  -l int    选项: 内存泄漏上限 (MiB); 默认无上限

硬盘占用

进入到需要生成占用文件的目录,使用dd命令生成对应大小文件。

dd if=/dev/zero of=data bs=1M count=1024

上述命令将生成1G大小的名为data的文件。修改1024调整生成文件的大小。

更多

希望以后不要再遇到这种需求。

使用到的开源项目,感谢原作者的付出