[SNMP4J] sharing snmp object or not sharing

Frank Fock fock at agentpp.com
Sat Sep 17 00:11:08 CEST 2005


Hi Sam,

Snmp is synchronized so it can be shared between threads.
By using an instance for each thread, you will triple the
number of threads running (you need to use different
transport mappings and Snmp classes for each thread then).
I doubt that you gain significantly performance by doing so,
but that might depend on your needs and a general answer
cannot be given for that.

Best regards,
Frank

Sam Chen wrote:

>Hi,
>   I currently have a multi-threaded program, and each
>thread is responsible for getting snmp information
>from one agent.  I read something about it is better
>to instantiate one snmp instance and share among all
>threads.   Does that mean synchronize the snmp object
>before doing the snmp.send() or it is syncrhonized
>internally so I don't need to syncrhonize the snmp
>object before doing the senmp.send().  Would it be
>resource-consuming if I instantiate one snmp object
>for each thread and would this speed up sending and
>receiving snmp information comparing to sharing single
>snmp object among all threads? 
>Thanks in advance.
>
>Sam  
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/snmp4j
>
>
>  
>


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





More information about the SNMP4J mailing list