[SNMP4J] need Snmp4J Experts help on Pooling of SnmpObjects

Frank Fock fock at agentpp.com
Sat Oct 8 13:49:13 CEST 2005


Hi Reena,

Please find my answers below:

reena grace wrote:

> 
>So the issues that i encounter are  as below:
>1) Can  I open a pool of snmp  session objects ,from which i pick up an object
>and load it with  target and pdu details ,use it for communication ,and then
>return  it to the pool .( simliar to the concept of   threadpool ) .?
>  
>
Yes, no problem, but you will have to decide which Snmp object has been 
chosen recently or
implement a load indicator (possibly the size of the pendingRequests 
collection).

> 
>2) If  so , what  will be the impact on Memory due to not closing the snmp 
>object.Do the Listening threads invoked create a performance degradation
>if we let them unclosed or stay in memory ( to re-use them again for 
>communication with  different agents).
>  
>
There will be at least one open socket and two threads (one for the Snmp 
object handling the timeouts
and at least one for the transport mapping). Using 100 Snmp objects will 
cause approximately a 200MB
memory footprint (default stack size). I guess that you will not gain 
any performance - the opposite
is more likely.

I would suggest using one Snmp session, and proably one or a few more 
transport mappings.
You could also increase the UDP buffer size on your machine (could be a 
kernel parameter) and
use the multi-threaded message dispatcher.

> 
>3) If creation of a pool of  Snmp objects is preferable causing no performance
>drawbacks ,then which of the following ways is better and efficient
>   a) Creating a pool of a limited number ( 15 to 20 ) of snmp objects and   
>   using them for communication with a large  n/w of 500 devices.
>  
>
I have been using a single Snmp object for more than 500 devices. With 
the right UDP buffer
size - no problem. I would not use more Snmp objects than you system has 
CPUs.
Otherwise you will loose performance because of task switching.

>   b) Creating a sufficiently large pool of objects( 300 to 400 ) so that i can fix 
>   a given object to a certain device in the LAN 
>  
>
Too much memory and resources used here. This will not work.

Best regards,
Frank

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com





More information about the SNMP4J mailing list