memtester内存压测工具

avatar 2020年6月16日18:05:12 评论 2,384 次浏览

系统安装好了,测试一下系统的稳定性,这里压测内存测试一下,选择的工具是memtester,下面看看memtester的安装方法:

[root@wulaoer ~]# wget http://pyropus.ca/software/memtester/old-versions/memtester-4.3.0.tar.gz
[root@wulaoer ~]# tar -zxf memtester-4.3.0.tar.gz 
[root@wulaoer memtester-4.3.0]# yum -y install gcc
[root@wulaoer memtester-4.3.0]# make && make install
./compile memtester.c
./compile tests.c
cat auto-ccld.sh make-load.sh > make-load
chmod 755 make-load
( cat warn-auto.sh; ./make-load "`cat systype`" ) > load
chmod 755 load
./extra-libs.sh "`cat systype`" >extra-libs
./load memtester tests.o `cat extra-libs`
mkdir -m 755 -p /usr/local/{bin,man/man8}
install -m 755 memtester /usr/local/bin/
gzip -c memtester.8 >memtester.8.gz ; install -m 644 memtester.8.gz /usr/local/man/man8/
[root@wulaoer memtester-4.3.0]# memtester 20M 1
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 20MB (20971520 bytes)
got  20MB (20971520 bytes), trying mlock ...locked.
Loop 1/1:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Done.

压测方法:

没压测之前内存的使用情况

[root@wulaoer ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           1.8G        207M        1.3G        9.0M        256M        1.4G
Swap:            0B          0B          0B

压测1G内存数据,然后在看看内存的使用情况

[root@wulaoer memtester-4.3.0]# memtester 1G 1
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 1024MB (1073741824 bytes)
got  1024MB (1073741824 bytes), trying mlock ...locked.
Loop 1/1:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Done.

也可以选择在后台压测,并把压测的结果写到一个文件里。压测1次,如果多次在2G后面加次数。

[root@wulaoer ~]# nohup memtester 2G 1 > mem2.log&

在压测的过程中,看一下内存使用情况,原本使用的207M,现在已经增加了1G的使用量。

[root@wulaoer ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           1.8G        1.2G        328M         12M        266M        445M
Swap:            0B          0B          0B

这里注意,memtester主要是测试硬件内存的性能,不考虑系统的问题,压测的过程中还是要考虑系统的因素。

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: