Hii
I am doing some experimentation work on the splice ( ) system call. My hardware does not support Scatter-Gather DMA. 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 read( )/sendto( ) system calls i.e.
read( ) -> to read contents of the file and
sendto( )-> to send the read contents to the connected socket (client side).
2). The other application uses the 'splice mechanism' for sending the data. i.e.
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)
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 splice( ) over read( )/sendto( ).
I am wondering if splice( ) 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
other bottlenecks?
have you ruled out all the other possible bottlenecks, i.e. bus speed, network protocol/card/driver, the system on the other end? if the machine does nothing else, it is easy to saturate an interface. it gets harder, if there are other jobs like running a database or cgi scripts. do you notice differences in cpu load or latency? which throughput do you get and over which type of media?