pysnmp icon indicating copy to clipboard operation
pysnmp copied to clipboard

Pysnmp traps listener throughput

Open atolikin94 opened this issue 2 years ago • 3 comments
trafficstars

Hello! I'd like to understand what is the throughput of pysnmp traps receiver. I made a couple of experiments and figured out that empty callback without any logic is able to receive ~75 t/s on my machine (btw don't know is it machine dependent or not, since from what I saw it's not CPU or anything else bound), which is quite small number. Is it possible to increase this number somehow? And what if there are, e.g., 1000 traps, or 10000 traps sent by devices at the same time - is there a buffer to keep those traps? If yes, what if the size of this buffer has been exceeded?

atolikin94 avatar Dec 02 '22 17:12 atolikin94

PySNMP does not have a trap receiver, so you need to disclose more about your experiments, or that's just something wrong in your own code.

For your information, a simple trap receiver like this can easily handle 1,500-2,000 v1 trap message per second on my Mac mini M1 2020, and this sample is not even optimized (writing log entries to console and a file can slow it down significantly).

lextm avatar Dec 02 '22 23:12 lextm

Hi @lextm , thank you very much for such a quick response! Actually I took similar example, but removed all inefficient logic from the callback, and got ~75 v2 t/s. Do you have any ideas why there is such a big difference? Regarding a situation when a receiver gets more traps than it can process - will them be saved in some kind of a buffer, or will them be just dropped?

atolikin94 avatar Dec 05 '22 09:12 atolikin94

I cannot comment further on the performance differences, as I don't have access to that specific test machine of yours.

About the situation you raised, the UDP packet buffer and how to drop packets when the buffer is full is controlled by the operating system (Windows or Linux for example).

If you really want a high performance agent to be built, then a pure Python approach like PySNMP might deprive you from the best as Python itself is slow. An SNMP implementation in C/C++ or another programming language should be considered.

lextm avatar Jan 19 '23 17:01 lextm