Skip to content

feat: introduced multi_bulk_walk_cmd - #216

Open
gmaiyani-crest wants to merge 3 commits into
lextudio:mainfrom
gmaiyani-crest:feat/multi-bulk-walk-cmd
Open

feat: introduced multi_bulk_walk_cmd#216
gmaiyani-crest wants to merge 3 commits into
lextudio:mainfrom
gmaiyani-crest:feat/multi-bulk-walk-cmd

Conversation

@gmaiyani-crest

@gmaiyani-crest gmaiyani-crest commented Nov 6, 2025

Copy link
Copy Markdown

Add multi_bulk_walk_cmd for Multi-Varbind SNMP Walking

Summary

Introduces multi_bulk_walk_cmd to walk multiple OID trees simultaneously with lexicographic mode control per varbind.

Why?

  • bulk_walk_cmd supports only a single varbind at a time and already includes lexicographic mode handling.
    However, to achieve the same behavior for multiple varbinds (from different OID subtrees), each varbind must be walked separately in sequence.
  • This leads to multiple SNMP calls and increased total runtime, especially when a maxRows limit or call count constraint is applied on the system.
    The new multi_bulk_walk_cmd addresses this by allowing multiple varbinds to be walked in parallel within a single session, maintaining lexicographic consistency while significantly reducing network roundtrips and improving overall efficiency.

Key Changes

  • Added multi_bulk_walk_cmd function for parallel walking of multiple OID subtrees
  • Implemented lexicographic mode control for each varbind
  • Restored etingof's bulkCmd multi-varbind with lexicographic capability with modern async/await patterns
  • Maintained full backward compatibility with single-varbind bulk_walk_cmd usage
  • Implemented precise maxRows handling that counts actual OIDs (not iterations) with automatic truncation
  • Added per-varbind completion tracking for independent state management

Performance

  • With comparing Etingof’s bulkCmd (using varbinds=[ObjectType(ObjectIdentity("1.3.6")), ObjectType(ObjectIdentity("1.3.6"))], lexicographicMode=False, max_repetitions=70), we observed a total of 41,710 OIDs retrieved over 20,855 SNMP calls.
  • Using the same configuration and restoring identical lexicographic behavior with the new multi_bulk_walk_cmd, the results were 41,708 OIDs retrieved with only 791 SNMP calls.
  • The overall execution time improved by approximately 5–7 seconds faster under the same test conditions.
  • When attempting to parallelize bulk_walk_cmd externally (i.e., running processes per OID subtree to simulate concurrency), The overall call count and runtime both increased when max_repetitions was large.
  • for example, when multiple OIDs had only a few sub-OIDs, or when max_repetitions was comparable to the total subtree size. In such cases, the total execution time was observed to be 60–70% higher compared to multi_bulk_walk_cmd. When running on limited resources, this effect becomes more noticeable, adding extra latency and SNMP calls.

…that extends bulk_walk_cmd to support walking multiple OID trees simultaneously in a single SNMP session, providing functionality similar to the old pysnmp bulkCmd while maintaining walk-style iteration convenience.

Implemented per-varbind lexicographic control and independent state tracking
Maintained full backward compatibility with single-varbind bulk_walk_cmd usage
@CLAassistant

CLAassistant commented Nov 6, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority:low Low priority items.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants