Performance issues in sending packet

36 views
Skip to first unread message

Nida Afreen

unread,
Aug 7, 2024, 1:57:45 AM8/7/24
to PcapPlusPlus support
Hello,

I have messages going at 100ms. I am using sendPacket for sending and startCapture for capturing packets. I have noticed that there is performance lag in sendPacket call when startCapture is enabled. Please let me know how performance can be improved. Do let me know if you need any further details.

Thanks in advance,
Nida

PcapPlusPlus Support

unread,
Aug 11, 2024, 10:32:18 PM8/11/24
to Nida Afreen, PcapPlusPlus support
Hi Nida,

Thanks for reaching out and sorry for the delayed response.
Just making sure: is your program receiving and sending packets at the same time?
startCapture runs in a separate thread and sendPacket runs on the main thread so theoretically they shouldn't interfere with each, however, depending on your system and the OS, they might be running on the same CPU core and in that case the sendPacket will be slower because the startCapture runs in an endless loop to make sure it captures packets as soon as possible, and consumes most of the CPU resources.

I would advise you to check how many CPU cores your system has, the more it has, the better chance each thread will be assigned to a different core. However, the OS cannot guarantee that.

Another option is to run startCapture and sendPacket in two different processes, which might increase the chance they'll run on separate cores.

Please let me know if any of these suggestions work for you.

Thanks,
PcapPlusPlus maintainer


--
You received this message because you are subscribed to the Google Groups "PcapPlusPlus support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pcapplusplus-sup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pcapplusplus-support/0ccd417c-f555-4c58-9557-8147796e37f8n%40googlegroups.com.

Nida Afreen

unread,
Aug 12, 2024, 11:18:51 PM8/12/24
to PcapPlusPlus support
Hi,

Thanks for the suggestions.
The sending and receiving is happening simultaneously, but on different threads.
The system on which I am running the application consists of 8 cores with 64GB RAM. I think this should be good enough.
I also printed the core used for sending and receiving. It is randomly assigned and is different most of the times.

Currently, I have tried running reception thread in blocking and non-blocking mode provided by PCapPlusPlus APIs. Is there any other interrupt based mode which uses lesser CPU time?

Thanks,
Nida

Nida Afreen

unread,
Aug 27, 2024, 12:59:52 AM8/27/24
to PcapPlusPlus support
Hi,

Does the performance get impacted by any of the driver or adapter settings?

PcapPlusPlus Support

unread,
Aug 27, 2024, 3:28:35 AM8/27/24
to Nida Afreen, PcapPlusPlus support
Hi Nida,

To be honest, I'm not sure. It really depends on how libpcap works. I assume there might be driver or adapter settings that might increase performance, but I'm not sure which are them...

Thanks,
PcapPlusPlus maintainer


Nida Afreen

unread,
Sep 10, 2024, 3:00:29 AM9/10/24
to PcapPlusPlus support
Hi,

I have noticed that the performance is much better on x32-based processor when compared to x64-based processor. 
I have built the libraries for x64.
Do you have any idea about this?
Also, if you have any link where I can download the ready-made libraries for 32 bit and 64 bit OS, please feel free to share the links.

Thanks,
Nida Afreen
Reply all
Reply to author
Forward
0 new messages