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

推荐订阅源

www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
G
Google Developers Blog
MyScale Blog
MyScale Blog
The Register - Security
The Register - Security
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
V2EX - 技术
V2EX - 技术
F
Fortinet All Blogs
博客园_首页
S
Secure Thoughts
GbyAI
GbyAI
S
Security Affairs
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Archives - TechRepublic
Security Archives - TechRepublic
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Heimdal Security Blog
A
About on SuperTechFans
P
Proofpoint News Feed
H
Help Net Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Y
Y Combinator Blog
L
LINUX DO - 最新话题
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
博客园 - 叶小钗
A
Arctic Wolf
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
人人都是产品经理
人人都是产品经理
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Security Latest
Security Latest
The Hacker News
The Hacker News
T
Tor Project blog
O
OpenAI News
博客园 - 三生石上(FineUI控件)
PCI Perspectives
PCI Perspectives
量子位
大猫的无限游戏
大猫的无限游戏
Stack Overflow Blog
Stack Overflow 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
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调整生成文件的大小。

更多

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

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