eroullit / net-toolbox

Playground for experimental code for the netsniff-ng project
www.netsniff-ng.org
GNU General Public License v2.0
2 stars 1 forks source link

Implement scatter/gather I/O routines #14

Open eroullit opened 13 years ago

eroullit commented 13 years ago

On some test infrastructure, netsniff-ng is used to write captured frames on a FIFO instead of using a file system.

In capture mode, the function pcap_write() is called for each packet. In it there are 2 write() syscalls. Whereas on a file system write() quickly accesses a mmap'ed buffer, the operation on a FIFO takes much longer which lead to a bottleneck.

To solve this bottleneck, using scatter/gather I/O seems to be best candidate. The packet processing function would prepare a set of I/O vectors. When all vectors are ready or before polling, a writev() would be triggered to write all data on the file descriptor in one syscall.

This should also improve I/O performance on classic file system.

All development related to this issue will be done in the feature branch called _scatter_gatherio