linux异步io高速写数据,Linux异步IO与libaio性能问题

I am looking for advice on how to get efficient and high performance asynchronous IO working for my application that runs on Ubuntu Linux 14.04.

My app processes transactions and creates a file on disk/flash. As the app is progressing through transactions additional blocks are created that must be appended to the file on disk/flash. The app needs also to frequently read blocks of this file as it is processing new transactions. Each transaction might need to read a different block from this file in addition to also creating a new block that has to be appended to this file. There is an incoming queue of transactions and the app can continue to process transactions from the queue to create a deep enough pipeline of IO ops to hide the latency of read accesses or write completions on disk or flash. For a read of a block (which was put in the write queue by a previous transaction) that has not yet been written to disk/flash, the app will stall until the corresponding write completes.

I have an important performance objective – the app should incur the lowest possible latency to issue the IO operation. My app takes approximately 10 microseconds to process each transaction and be ready to issue a write to or a read from the file on disk/flash. The additional latency to issue an asynchronous read or write should be as small as possible so that the app can complete processing each transaction at a rate as close to 10 usecs per transaction as possible, when only a file write is needed.

We are experimenting with an implementation that uses io_submit to issue write and read requests. I would appreciate any suggestions or feedback on the best approach for our requirement. Is io_submit going to give us the best performance to meet our objective? What should I expect for the latency of each write io_submit and the latency of each read io_submit?

Using our experimental code (running on a 2.3 GHz Haswell Macbook Pro, Ubuntu Linux 14.04), we are measuring about 50 usecs for a write io_submit when extending the output file. This is too long and we aren't even close to our performance requirements. Any guidance to help me launch a write request with the least latency will be greatly appreciated.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux系统中,有多个工具可以用于测试IO性能,以下是其中一些常用的工具: 1. **dd命令**:`dd`是一个常用的Linux命令,可以用于复制文件和块设备,也可以用于测试IO性能。可以使用`dd`命令来生成一个特定大小的文件,同时记录复制过程的时间,计算出数据传输的速度。例如,`dd if=/dev/zero of=testfile bs=1M count=1000 conv=fdatasync`将创建一个名为testfile的1GB文件,并记录数据传输速度。在使用`dd`时,请注意选择正确的块大小以获得最佳性能。 2. **fio工具**:`fio`是一个用于测试磁盘性能的工具,可以模拟不同的IO负载和场景。它可以测试各种IO引擎和文件系统,并生成详细的报告。`fio`支持多线程、异步IO和随机IO等,可以根据需要进行配置。例如,`fio --name=randwrite --ioengine=libaio --rw=randwrite --bs=4k --numjobs=8 --size=2G --runtime=300 --time_based`将测试8个进程在2GB的文件上进行随机入,每个进程使用4KB块大小,运行时间为300秒。 3. **bonnie++工具**:`bonnie++`是一个基于文件系统的基准测试工具,可测试文件的创建、删除、读取和入等操作的性能。`bonnie++`支持多线程和随机IO等,并可以生成详细的报告。例如,`bonnie++ -d /path/to/test/dir -s 2048 -r 1024`将在指定目录中测试2GB文件的创建、读取和入,使用1KB块大小进行随机读,同时记录操作的时间并计算数据传输速度。 4. **iozone工具**:`iozone`是另一个常用的基准测试工具,可测试文件和文件系统的IO性能。它可以测试顺序读取、顺序入、随机读取、随机入等操作,并支持多线程和异步IO等。例如,`iozone -a -i 0 -i 1 -i 2 -s 1G -r 4k -t 32`将测试1GB文件的顺序读和随机读,每次读使用4KB块大小,并使用32个线程进行测试。 以上这些工具都可以用于测试IO性能,但在使用它们时需要了解自己的测试需求和测试环境,选择合适的工具和参数进行测试。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值