日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux内存压力,linux下的CPU、内存、IO、网络的压力测试

發(fā)布時間:2023/12/15 linux 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux内存压力,linux下的CPU、内存、IO、网络的压力测试 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一、對CPU進(jìn)行簡單測試:

1、通過bc命令計算特別函數(shù)

例:計算圓周率

echo "scale=5000; 4*a(1)" | bc -l -q

MATH?LIBRARY

If?bc?is?invoked?with?the?-l?option,?a?math?library?is?preloaded?and?the?default??scale??is??set??to??20.

The??math??functions??will??calculate?their?results?to?the?scale?set?at?the?time?of?their?call.??The?math

library?defines?the?following?functions:

s?(x)??The?sine?of?x,?x?is?in?radians.????正玄函數(shù)

c?(x)??The?cosine?of?x,?x?is?in?radians.??余玄函數(shù)

a?(x)??The?arctangent?of?x,?arctangent?returns?radians.?反正切函數(shù)

l?(x)??The?natural?logarithm?of?x.??log函數(shù)(以2為底)

e?(x)??The?exponential?function?of?raising?e?to?the?value?x.??e的指數(shù)函數(shù)

j?(n,x) The?bessel?function?of?integer?order?n?of?x.???貝塞爾函數(shù)

2、工具二:Super Pi for linuxSuper PI是利用CPU的浮點(diǎn)運(yùn)算能力來計算出π(圓周率),所以目前普遍被超頻玩家用做測試系統(tǒng)穩(wěn)定性和測試CPU計算完后特定位數(shù)圓周率所需的時間。http://www.super-computing.org/下載頁:ftp://pi.super-computing.org/wgetftp://pi.super-computing.org/Linux/super_pi.tar.gztar -xzvf super_pi.tar.gz./super_pi 2020為位數(shù)。表示要算2的多少次方位,如通常要算小數(shù)點(diǎn)后1M位。

二、對內(nèi)存進(jìn)行簡單測試:

用法:Usage: ./memtester [-p physaddrbase [-d device]] [B|K|M|G] [loops]例:memtester 1G 5

三、對IO進(jìn)行簡單測試:

1、利用dd來進(jìn)行測試:

time dd if=/dev/zero of=test bs=1M count=4096

用top和iostat查看wa%及寫硬盤速度

2、使用fio命令進(jìn)行測試:

FIO是測試IOPS的非常好的工具,用來對硬件進(jìn)行壓力測試和驗證,支持13種不同的I/O引擎,

包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。

說明:

filename=/dev/sdb1 測試文件名稱,通常選擇需要測試的盤的data目錄。

direct=1 測試過程繞過機(jī)器自帶的buffer。使測試結(jié)果更真實(shí)。

rw=randwrite 測試隨機(jī)寫的I/O

rw=randrw 測試隨機(jī)寫和讀的I/O

bs=16k 單次io的塊文件大小為16k

bsrange=512-2048 同上,提定數(shù)據(jù)塊的大小范圍

size=5g 本次的測試文件大小為5g,以每次4k的io進(jìn)行測試。

numjobs=30 本次的測試線程為30.

runtime=1000 測試時間為1000秒,如果不寫則一直將5g文件分4k每次寫完為止。

ioengine=psync io引擎使用pync方式

rwmixwrite=30 在混合讀寫的模式下,寫占30%

group_reporting 關(guān)于顯示結(jié)果的,匯總每個進(jìn)程的信息。

此外

lockmem=1g 只使用1g內(nèi)存進(jìn)行測試。

zero_buffers 用0初始化系統(tǒng)buffer。

nrfiles=8 每個進(jìn)程生成文件的數(shù)量。

隨機(jī)讀:

fio --filename=/dev/sdb1 --direct=1 --iodepth 1 --thread --rw=randread --ioengine=psync --bs=16k --size=200G --numjobs=10 --runtime=1000 --group_reporting --name=mytest

順序讀:

fio --filename=/dev/sdb1 --direct=1 --iodepth 1 --thread --rw=read --ioengine=psync --bs=16k --size=200G --numjobs=30 --runtime=1000 --group_reporting --name=mytest

隨機(jī)寫:

fio --filename=/dev/sdb1 --direct=1 --iodepth 1 --thread --rw=randwrite --ioengine=psync --bs=16k --size=200G --numjobs=30 --runtime=1000 --group_reporting --name=mytest

順序?qū)?#xff1a;

fio --filename=/dev/sdb1 --direct=1 --iodepth 1 --thread --rw=write --ioengine=psync --bs=16k --size=200G --numjobs=30 --runtime=1000 --group_reporting --name=mytest

混合隨機(jī)讀寫:

fio --filename=/dev/sdb1 --direct=1 --iodepth 1 --thread --rw=randrw --rwmixread=70 --ioengine=psync --bs=16k --size=200G --numjobs=30 --runtime=100 --group_reporting --name=mytest --ioscheduler=noop

原文:http://wushank.blog.51cto.com/3489095/1585927

總結(jié)

以上是生活随笔為你收集整理的Linux内存压力,linux下的CPU、内存、IO、网络的压力测试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。