1

Linux.

Is there a performance loss from using a tap device vs a hardware one like eth0 ?

The goal is to create a user space tcp/ip stack and avoid the kernel as much as possible.

I would like to be sure that developping on top of a tap device is the right thing to do.

Thanks

Larry
  • 145
  • 1
  • 8

2 Answers2

2

Yes, there is. Using a tap device causes context switches between the client process and the process that holds the tap device. It also causes additional copies, as data needs to be copied from the client process into the kernel, and then from the kernel into the tap holder.

However, Linux is pretty good at context switching, and in-cache copies are fairly cheap, so the overhead might be small enough. I would recommend that you implement your stack in user-space, using tap, and then perform some benchmarking and profiling to decide whether it is worth the effort to move your code into the kernel.

jch
  • 470
  • 2
  • 8
  • user-space tcp stack is exactly what I want to achieve. So you confirm I will need a tap device to make this happen ? And that it cannot be as fast as a hardware interface ? I am willing to deal with layer 2. – Larry Dec 20 '14 at 12:00
1

I'm posting this as an answer due to insufficient commenting permissions.

From my experience VPN over tcp - tap was abysmal at best over wireless connections due to the the nature of TCP. When switching to UDP no more connection timeouts occurred - even better with tun device. I would suggest you test under poor network connections both TCP and UDP and tap/tun.

MemCtrl
  • 118
  • 2
  • 10