Hi there,
we’d like to use snmp4j to scale to 1000s (potentially 10000s) parallel SNMP sessions. Each sessions fetches a rather large number of (mainly repeater) OIDs - e.g. MIB-2 ifTable.
We’re already on JDK21, so virtual threads are available. We use them in our application to schedule SNMP polls and process results.
When it comes to snmp4j, I’m aware of two areas where threading is involved for our use case:
- TransportMapping (we use DefaultUdpTransportMapping)
- Timers (for retransmission / timeout handling in sessions)
Current assumption is, that also using virtual threads for transport mappings and timers further enhances scaling capabilities.
A quick test with Thread factories using virtual threads instead of platform threads (using SNMP4JSettings.setThreadFactory and SNMP4JSettings.setTimerFactory) led to some locking issues. On first sight it seems like all platform threads acting as carrier threads (Fork-Join pool) are exhausted due to blocking I/O operations in synchronized blocks.
Does this seem like a reasonable explanation for SNMPSession.get() / SNMPSession.walk() not returning in finite time?
Are there any plans to make snmp4j “virtual thread ready” by using ReentrantLock or the like instead of synchronized
locking?
thanks and best regards,
Stefan