* question about splice performance
@ 2008-05-25 15:12 Francis Moreau
2008-05-25 15:40 ` Jan Engelhardt
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Francis Moreau @ 2008-05-25 15:12 UTC (permalink / raw)
To: linux-kernel; +Cc: jens.axboe
Hi,
I did a really basic benchmark and was suprise about the results.
$ echo 3 > /proc/sys/vm/drop_caches
$ time splice-cp vmlinux /tmp/vmlinux
real 0m10.158s
user 0m0.002s
sys 0m0.401s
$ echo 3 > /proc/sys/vm/drop_caches
$ time cp vmlinux /tmp/vmlinux
real 0m10.590s
user 0m0.017s
sys 0m0.459s
I was expecting splice-cp case to be faster.
Could someone enlight me ?
Thanks
--
Francis
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: question about splice performance
2008-05-25 15:12 question about splice performance Francis Moreau
@ 2008-05-25 15:40 ` Jan Engelhardt
2008-05-25 17:22 ` Sitsofe Wheeler
2008-05-25 20:47 ` Jeff Garzik
2 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2008-05-25 15:40 UTC (permalink / raw)
To: Francis Moreau; +Cc: linux-kernel, jens.axboe
On Sunday 2008-05-25 17:12, Francis Moreau wrote:
>Hi,
>
>I did a really basic benchmark and was suprise about the results.
>
>$ echo 3 > /proc/sys/vm/drop_caches
>$ time splice-cp vmlinux /tmp/vmlinux
>
>real 0m10.158s
>user 0m0.002s
>sys 0m0.401s
>
>$ echo 3 > /proc/sys/vm/drop_caches
>$ time cp vmlinux /tmp/vmlinux
>
>real 0m10.590s
>user 0m0.017s
>sys 0m0.459s
>
>
>I was expecting splice-cp case to be faster.
>
>Could someone enlight me ?
Slow disk outweighs memory copying overhead. And 300 MB is quickly
transferred in idle systems.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: question about splice performance
2008-05-25 15:12 question about splice performance Francis Moreau
2008-05-25 15:40 ` Jan Engelhardt
@ 2008-05-25 17:22 ` Sitsofe Wheeler
2008-05-25 20:47 ` Jeff Garzik
2 siblings, 0 replies; 6+ messages in thread
From: Sitsofe Wheeler @ 2008-05-25 17:22 UTC (permalink / raw)
To: linux-kernel
<posted & mailed>
Francis Moreau wrote:
> Hi,
>
> I did a really basic benchmark and was suprise about the results.
>
> $ echo 3 > /proc/sys/vm/drop_caches
> $ time splice-cp vmlinux /tmp/vmlinux
Are vmlinux and /tmp both RAM filesystems? If not you may want to try
using /dev/shm to rule out disk speed...
--
Sitsofe | http://sucs.org/~sits/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: question about splice performance
2008-05-25 15:12 question about splice performance Francis Moreau
2008-05-25 15:40 ` Jan Engelhardt
2008-05-25 17:22 ` Sitsofe Wheeler
@ 2008-05-25 20:47 ` Jeff Garzik
2008-05-26 8:57 ` Francis Moreau
2 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2008-05-25 20:47 UTC (permalink / raw)
To: Francis Moreau; +Cc: linux-kernel, jens.axboe
Francis Moreau wrote:
> Hi,
>
> I did a really basic benchmark and was suprise about the results.
>
> $ echo 3 > /proc/sys/vm/drop_caches
> $ time splice-cp vmlinux /tmp/vmlinux
>
> real 0m10.158s
> user 0m0.002s
> sys 0m0.401s
>
> $ echo 3 > /proc/sys/vm/drop_caches
> $ time cp vmlinux /tmp/vmlinux
>
> real 0m10.590s
> user 0m0.017s
> sys 0m0.459s
>
>
> I was expecting splice-cp case to be faster.
>
> Could someone enlight me ?
If you drop caches you are not measuring splice speed.
Use ramfs for your tests (guarantees data is in cache) instead.
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: question about splice performance
2008-05-25 20:47 ` Jeff Garzik
@ 2008-05-26 8:57 ` Francis Moreau
2008-05-26 9:06 ` Bernd Petrovitsch
0 siblings, 1 reply; 6+ messages in thread
From: Francis Moreau @ 2008-05-26 8:57 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-kernel, jens.axboe
Hello,
On Sun, May 25, 2008 at 10:47 PM, Jeff Garzik <jeff@garzik.org> wrote:
>
> If you drop caches you are not measuring splice speed.
>
> Use ramfs for your tests (guarantees data is in cache) instead.
>
So it seems that the gain when using splice to copy a file into another file
is very limited. Maybe that's the reason why cp is still using read/write...
Also splice-cp uses 2 calls to splice syscall in a loop. So it end up doing a
lot of syscalls. Maybe using sendfile instead of is better.
Also2, since splice is a generalized pipe, it might be better to create to
processes, one writing to the pipe and the other one reading to have better
workflow.
That said I also see some use cases where splice could be more useful,
specially when one of the file descriptor is actually a device: one the write
side of the pipes a device could write some data while on the other side of
the pipe a process can empty the pipe by writing the data to a file.
Are there any plans to improve splice interface to be used by drivers ?
Thanks.
--
Francis
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: question about splice performance
2008-05-26 8:57 ` Francis Moreau
@ 2008-05-26 9:06 ` Bernd Petrovitsch
0 siblings, 0 replies; 6+ messages in thread
From: Bernd Petrovitsch @ 2008-05-26 9:06 UTC (permalink / raw)
To: Francis Moreau; +Cc: Jeff Garzik, linux-kernel, jens.axboe
Hi!
On Mon, 2008-05-26 at 10:57 +0200, Francis Moreau wrote:
> On Sun, May 25, 2008 at 10:47 PM, Jeff Garzik <jeff@garzik.org> wrote:
> >
> > If you drop caches you are not measuring splice speed.
> >
> > Use ramfs for your tests (guarantees data is in cache) instead.
>
> So it seems that the gain when using splice to copy a file into another file
> is very limited. Maybe that's the reason why cp is still using read/write...
To point it out one more time: If you copy from one file on a physical
harddisk (or more or less similar hardware) to another (with cold
caches), the bottleneck is most probably the harddisk.
splice() simply reduces the amount of copied data in the RAM - and that
is practically irrelevant if you read and write to and from harddisks.
So if you want to measure the savings of using splice() (instad of
read()/write(), etc.): Copy to and from RAM disks (and thus rule out the
slow hardware).
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-05-26 9:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-25 15:12 question about splice performance Francis Moreau
2008-05-25 15:40 ` Jan Engelhardt
2008-05-25 17:22 ` Sitsofe Wheeler
2008-05-25 20:47 ` Jeff Garzik
2008-05-26 8:57 ` Francis Moreau
2008-05-26 9:06 ` Bernd Petrovitsch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.