LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   splice ( ) not giving performance gains over sendto( ) (https://www.linuxquestions.org/questions/linux-kernel-70/splice-not-giving-performance-gains-over-sendto-740726/)

aditya.pipersenia 07-17-2009 05:28 AM

splice ( ) not giving performance gains over sendto( )
 
Hii

I am doing some experimentation work on the splice ( ) system call. My hardware <b>does not support Scatter-Gather DMA</b>. I have 2 server applications for transmiiting data over the network using TCP. In both the applications a socket is opened, binded to a port and after listening on the port, accepts a connection from the client side. I connect to the server side from another linux box on the same network. Both open a /dev/zero file of the required size for sending over the network. Now, the difference between the two lies in the mechanism used for transmitting the file over the network.

1). One application uses a combination of <b>read( )/sendto( ) system calls </b>i.e.
<b>
read( ) -> to read contents of the file and
sendto( )-> to send the read contents to the connected socket (client side).
</b>
2). The other application uses the <b>'splice mechanism'</b> for sending the data. i.e.
<b>
splice( )-> the data from the file into a pipe and then another
splice( )-> to send the contents fo the pipe to the connected socket (client side)
</b>
Though i am not noticing any data loss in transmitting the file over the network, the times taken for both the applications are around the same. i.e. I am not observing any throughput gains when using <b>splice( ) over read( )/sendto( )</b>.

I am wondering if <b>splice( ) </b> gives performance gains only when the hardware supports Scatter-Gather DMA or there is some other problem. I would be grateful to anybody who can shed some light on the above observations.

Cheers

Aditya

PS: I had earlier posted a thread which discussed the problem of certain FLAGS in splice( ) giving an error when used with UDP .. those FLAGS seem to be working fine with TCP ..

cladisch 07-17-2009 07:48 AM

Quote:

I am not observing any throughput gains when using splice( ) over read( )/sendto( ).
splice() is intended to be used when the overhead of copying data between buffers decreases throughput.
In your application, this is not the case; probably because there is no pressure on the CPU, the caches and the memory bus. I'd guess that the network connection is the bottleneck.


All times are GMT -5. The time now is 02:21 PM.