Parallel GETNEXT

Perform SNMP v2c GETNEXT requests to iterate through whole MIB with concurrency of 4 maintaining single client session per thread/coroutine.

  • The efficiency of the network stack.
  • The efficiency of BER encoder and decoder.
  • The efficiency of the BER-to-Python data types mapping.
  • Granularity of the internal locks.
  • Ability to release GIL when runnning native code.

Look at the source code for details.

Notes

  • easysnmp doesn't supports async mode.
  • easysnmp causes almost constant SEGFAULTs, so we were forced to turn off appropriate test.

Run tests:

pytest benchmarks/test_v2c_p4_getnext.py

Results (lower is better)

============================= test session starts ==============================
platform linux -- Python 3.13.2, pytest-8.3.3, pluggy-1.5.0
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=50 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /workspaces/gufo_snmp
configfile: pyproject.toml
plugins: benchmark-5.1.0
collected 3 items

benchmarks/test_v2c_p4_getnext.py ...                                    [100%]


----------------------------------------------------------------------------------------- benchmark: 3 tests ----------------------------------------------------------------------------------------
Name (time in ms)               Min                   Max                  Mean             StdDev                Median                IQR            Outliers     OPS            Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_gufo_snmp_sync        345.9976 (1.0)        369.1155 (1.0)        357.0097 (1.0)       4.3024 (1.0)        357.3423 (1.0)       5.1624 (1.0)          16;2  2.8010 (1.0)          50           1
test_gufo_snmp_async       413.7641 (1.20)       519.0843 (1.41)       480.6624 (1.35)     21.4717 (4.99)       487.5226 (1.36)      8.5229 (1.65)          8;9  2.0805 (0.74)         50           1
test_pysnmp_async        5,549.9992 (16.04)    5,821.7834 (15.77)    5,670.1119 (15.88)    50.9505 (11.84)    5,668.7624 (15.86)    54.0314 (10.47)        12;3  0.1764 (0.06)         50           1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean
======================== 3 passed in 339.49s (0:05:39) =========================

Median chart Lower is better