有没有改善Linux管道的性能的方式?(Is there a way to improve perf

2019-08-01 00:18发布

我想管极高的速度将数据从一个应用程序到另一个使用64位的CentOS 6我已经做使用以下基准dd地发现,管道拖我,而不是算法在我的计划。 我的目标是实现某处大约1.5 GB / s的。

首先,如果没有管道:

dd if=/dev/zero of=/dev/null bs=8M count=1000
1000+0 records in
1000+0 records out
8388608000 bytes (8.4 GB) copied, 0.41925 s, 20.0 GB/s

接着,2个DD进程之间的管道:

dd if=/dev/zero bs=8M count=1000 | dd of=/dev/null bs=8M
1000+0 records in
1000+0 records out
8388608000 bytes (8.4 GB) copied, 9.39205 s, 893 MB/s

是否有任何调整,我可以让内核或其他任何东西,这将提高通过管道运行数据的表现呢? 我曾尝试命名管道的欢迎,并得到了类似的结果。

Answer 1:

你是否有更小的块试过吗?

当我尽我自己的工作站上,我注意到连续的改善降低了块大小时。 只有在10%的在我的测试领域,但仍然是一个进步。 您正在寻找100%。

事实证明测试。此外,非常小的块大小似乎这样的伎俩:

我试过了

dd if=/dev/zero bs=32k count=256000 | dd of=/dev/null bs=32k
256000+0 records in
256000+0 records out
256000+0 records in
256000+0 records out
8388608000 bytes (8.4 GB) copied8388608000 bytes (8.4 GB) copied, 1.67965 s, 5.0 GB/s
, 1.68052 s, 5.0 GB/s

并与原来的

dd if=/dev/zero bs=8M count=1000 | dd of=/dev/null bs=8M
1000+0 records in
1000+0 records out
1000+0 records in
1000+0 records out
8388608000 bytes (8.4 GB) copied8388608000 bytes (8.4 GB) copied, 6.25782 s, 1.3 GB/s
, 6.25203 s, 1.3 GB/s

5.0 / 1.3 = 3.8,从而是一个相当大的因素。



文章来源: Is there a way to improve performance of linux pipes?