您的位置:首页 > 其它

Iozone: NFS文件系统性能测试

2010-02-10 13:42 363 查看
使用IOZone测试,存在如下问题:

When I use the parameter -U, it failed.
The command is as follows:
/opt/ –azcR -U /mnt/foo –f /mnt/foo/testfile –b exceloutput.xls

"/mnt/foo" is a mounted directory, and “/opt/iozone/bin/iozone” is a local directory.

This command just executed once, and then prompts:
"umount: /mnt/foo: not mounted "

I found the "exceloutput.xls" just has one column measured data.
解决方法:
打开/etc/fstab 在其中追加如下:
192.168.21.201:/tmp /mnt/foo nfs defaults 0 0
关于这个文件的详细解释可参见:/etc/fstab文件解读:http://tagche.blog.51cto.com/649757/170699
这样做的好处是:
1)只需要 mount /mnt/foo即可,不需要 mount 192.168.21.201:/tmp /mnt/foo
2) 写进去后,重启机器,就自动挂载好了。当然你的nfs服务得启动。init5模式会正常启动,但init3不行,连network service都没启动。
3)注意如果fstab文件里面写的是/mnt/foo/,mount /mnt/foo会失败,但mount /mnt/foo/会成功。如果fstab写成/mnt/foo,两者均能成功。
这样的话,iozone umount完/mnt/foo,再重新mount /mnt/foo时就不会失败了。
最终的命令是这样的:
./iozone -az -g 4G -U /mnt/foo -f /mnt/foo/testfile -Rb /tmp/zhxue/URazbg4
注意:如果写成-U /mnt/foo/也会出错的:"umount: /mnt/foo: not mounted "
还是有问题,还没试下面的方法:
http://www.idcnews.net/html/edu/20080101/282828.html

I modify the source file, and recompile it using the command: make linux, and then use the following command to test.

In source file iozone.c , I modify the purge_buffer_cache

/************************************************************************/
/* Routine to purge the buffer cache by unmounting drive. */
/************************************************************************/
#ifdef HAVE_ANSIC_C
void
purge_buffer_cache()
#else
purge_buffer_cache()
#endif
{
char command[1024];
int ret,i;
strcpy(command,"umount ");
strcat(command, mountname);
/*
umount might fail if the device is still busy, so
retry unmounting several times with increasing delays
*/
for (i = 1; i < 10; ++i) {
ret = system(command);
if (ret == 0)
break;
sleep(i); /* seconds */
}

strcpy(command,"mount ");
strcat(command, mountname);

/*
mount might fail if the device is still busy, so
retry mounting several times with increasing delays
added by Zhenghua
*/
for (i = 1; i < 10; ++i) {
ret = system(command);
if (ret == 0)
break;
sleep(i); /* seconds */
}

}

In source file fileop.c, I modify the purge_buffer_cache

************************************************************************/
/* Routine to purge the buffer cache by unmounting drive. */
/************************************************************************/
void purge_buffer_cache()
{
if (!mountname)
return;

char cwd[PATH_MAX];
char command[1024];
int ret,i;

getcwd(cwd, sizeof(cwd));
chdir("/");
strcpy(command,"umount ");
strcat(command, mountname);
/*
umount might fail if the device is still busy, so
retry unmounting several times with increasing delays
*/
for (i = 1; i < 10; ++i) {
ret = system(command);
if (ret == 0)
break;
sleep(i); // seconds
}
strcpy(command,"mount ");
strcat(command, mountname);

/*
mount might fail if the device is still busy, so
retry mounting several times with increasing delays
added by zhenghua
*/
for (i = 1; i < 10; ++i) {
ret = system(command);
if (ret == 0)
break;
sleep(i); /* seconds */
}

chdir(cwd);
}

It turns out fine.

IOZone has accepted my modification, and join my contribution to the source code.终于为开源软件做了点贡献。
以前没注意到,当测试文件大小小于内存大小时,看不到磁盘的IO性能,因为充分利用了buffer和cache,所以性能极高。今天用下面命令重新测试了一下:
iozone -Rab /root/Desktop/testfs/Rb32 -n 16G -g 32G -y 64K -q 1M -i 0 -i 1
-n和-g控制自动模式(-a)下,待测文件的大小范围;
-y和-q控制自动模式下, record的大小范围;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: