> Linux教程 > 系统运维 >

Linux VPS常见性能测试

拿到vps之后要看下它的性能,这样才能更好的使用。

查看内核版本:

uname -a

Linux abc.com 2.6.18-238.9.1.el5xen #1 SMP Tue Apr 12 19:32:47 EDT 2011 i686 i686 i386 GNU/Linux

 

查看CPU信息:

cat /proc/cpuinfo

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 45
model name	: Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
stepping	: 7
cpu MHz		: 2000.000
cache size	: 15360 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu de tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up nonstop_tsc pni ssse3 sse4_1 sse4_2 popcnt [8]
bogomips	: 5003.29

主要看是什么型号的CPU,主频多少,有几核。

查看内存:

free -m

             total       used       free     shared    buffers     cached
Mem:           128        118          9          0          5         50
-/+ buffers/cache:         62         65
Swap:         1023          0       1023

 

查看inode:

df -i

Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1            1179648   52928 1126720    5% /
tmpfs                  16406       1   16405    1% /dev/shm

 

查看分区和硬盘使用情况:

df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             8.9G  1.5G  7.0G  18% /
tmpfs                  65M     0   65M   0% /dev/shm

 

硬盘IO性能:

方法一

dd if=/dev/zero of=test bs=64k count=4k oflag=dsync

4096+0 records in
4096+0 records out
268435456 bytes (268 MB) copied, 9.82702 seconds, 27.3 MB/s

网上说一般要大于10M的基本可以使用。

方法二

hdparm -Tt /dev/sda1

/dev/sda1:
 Timing cached reads:   21896 MB in  1.99 seconds = 11006.64 MB/sec
 Timing buffered disk reads:  156 MB in  3.01 seconds =  51.84 MB/sec

hdparm命令用于测试硬盘cache和硬盘device的读取时间。可看到这次disk的读取速度是51.84MB每秒。

方法三
安装ioping。

ioping -c 10 .

4096 bytes from . (ext3 /dev/root): request=1 time=0.4 ms
4096 bytes from . (ext3 /dev/root): request=2 time=0.4 ms
4096 bytes from . (ext3 /dev/root): request=3 time=0.5 ms
4096 bytes from . (ext3 /dev/root): request=4 time=0.5 ms
4096 bytes from . (ext3 /dev/root): request=5 time=0.5 ms
4096 bytes from . (ext3 /dev/root): request=6 time=0.4 ms
4096 bytes from . (ext3 /dev/root): request=7 time=0.4 ms
4096 bytes from . (ext3 /dev/root): request=8 time=0.4 ms
4096 bytes from . (ext3 /dev/root): request=9 time=0.3 ms
4096 bytes from . (ext3 /dev/root): request=10 time=0.7 ms

--- . (ext3 /dev/root) ioping statistics ---
10 requests completed in 9037.4 ms, 2265 iops, 8.8 mb/s
min/avg/max/mdev = 0.3/0.4/0.7/0.1 ms

 

网口速度测试:

wget cachefly.cachefly.net/100mb.test -O /dev/null

--2013-01-06 11:19:24--  http://cachefly.cachefly.net/100mb.test
Resolving cachefly.cachefly.net... 205.234.175.175
Connecting to cachefly.cachefly.net|205.234.175.175|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: `/dev/null'

100%[============================================>] 104,857,600 12.1M/s   in 8.2s    

2013-01-06 11:19:32 (12.2 MB/s) - `/dev/null' saved [104857600/104857600]

1M/s左右的是10M口,10M/s左右的是100M口,60M/s左右的是1000M口。

(责任编辑:IT)