Benchmark/Performance question...

Feb 21, 2011 at 2:44 AM

Hi,

I have a question regarding the performance of Pcap.Net vs other capture libs (ie. SharpPcap or native Delphi magenta PCap) ?

Correct me please, but my understanding is:

SharpPCap = pInvoke = slower

Delphi = native dll = should be fast (like c/c++)

Pcap.NET is C++/.Net wrapper = faster than pInvoke, but how close to native ???

My question is...

I would like to setup 2x NICS..  Listening on both and forwarding packets from Card 1-> Card2    and Card2 -> Card 1   (i.e. Home made bridge that I can tamper data/rechecksum etc).

I have this working on SharpPCap and on Delphi.. The delphi one is significantly faster than the SharpPcap version..  They are both prototypes. I would like to stick with C# if I can get better performance.

What sort of rate could I successfully capture/send/etc in Pcap.Net ?  Can I handle a 24Mbit/s stream ? Will it capture without loss at 100Mbits/s ? (ie typical ethernet speeds.. I gather 1GBit/s would require a WinpCap card etc.)

Any info in this regard greatly appreciated.

Regards

Andrew

Feb 22, 2011 at 3:05 PM

Best is libpcap in linux environment. U can use GTK+ wwith Glade RAD tool (optional). No idea for windows OS

Coordinator
Feb 23, 2011 at 1:07 PM

In general, if very high performance (over a few hundredths of Mbit/s), I wouldn't suggest using Windows.

From what I know, Linux works much better in these scenarios (though maybe the new Windows systems, like Windows Server 2008, might work better.

 

I haven't done any real benchmark for Pcap.Net, but I believe that if you use it correctly, you can get to a few hundredths of Mbit/s. I'm pretty sure 24Mbit/s should pose no problem, unless the packets are very very small. I'm also quite sure that 100Mbit/s should work, though first you should check that io your system WinPcap manages to capture in that rate.

 

The reason there are no benchmark tests for Pcap.Net is that I couldn't find a good benchmark scenario that will represent the usage of Pcap.Net. If you can describe one, maybe I'll try and test it.

 

Boaz.

Feb 23, 2011 at 4:26 PM
Hi,

Thanks for the reply and detailed explanation.

Have you tried pcap.net on Linux/mono ? Would the unmanaged c+ work for libpcap ?

I have an idea for a simple benchmark.

Setup 2x network cards with no ip or gateway details.

Listen for all packets on card1 then send them on card2.

Listen for all packets on card2 then send them on card 1.

Then plug this test machine between 2 others and copy a file. See how many packets are lost for simple Internet download vs transferring file on LAN.


This would show how quickly it could capture/send and packet loss.

Just a thought.

Regards
Andrew

On 24/02/2011, at 1:07 AM, "brickner"<notifications@codeplex.com> wrote:

From: brickner

In general, if very high performance (over a few hundredths of Mbit/s), I wouldn't suggest using Windows.

From what I know, Linux works much better in these scenarios (though maybe the new Windows systems, like Windows Server 2008, might work better.

I haven't done any real benchmark for Pcap.Net, but I believe that if you use it correctly, you can get to a few hundredths of Mbit/s. I'm pretty sure 24Mbit/s should pose no problem, unless the packets are very very small. I'm also quite sure that 100Mbit/s should work, though first you should check that io your system WinPcap manages to capture in that rate.

The reason there are no benchmark tests for Pcap.Net is that I couldn't find a good benchmark scenario that will represent the usage of Pcap.Net. If you can describe one, maybe I'll try and test it.

Boaz.

Coordinator
Feb 26, 2011 at 8:02 AM

Hi CastleSoft,

 

I haven't tried Linux/Mono.
I believe this won't work because I use WinPcap API, I use a lot of the latest feature of .NET and I'm not sure how C++/CLI is supported...

 

Nice idea for a benchmark. It only tests very specific features of Pcap.Net but I guess they are important to measure independently.

Unfortunately, I actually don't have a machine with two network cards and I don't have 3 machines I can use.

I'm also not sure if I'll be able to do file transfer over such network, unless I use Pcap.Net to do that too because of Ethernet and IP issues.

There are also latency vs. throughput issues here that should be thought of.

 

If someone is willing to perform such a benchmark I'll be happy to review the code to see that Pcap.Net is used optimally.

 

Boaz.