[SNMP4J] 1 sec to send a pdu with SnmpRequest

Jason Grant jasong at utiba.com
Wed Aug 1 06:42:55 CEST 2007


Hello,

The delay is not due to the bug you indicated, but rather the 1000ms 
socket timeout used in DefaultUdpTransportMapping.  I'd like avoid 
repeated create/close of Snmp in SnmpRequest, but unfortunately this 
class is not designed for subclassing - many of its fields and methods 
are not accessible by subclasses.  I'm currently investigating workarounds.

Jason.

Parhar, Ajeet S wrote:
> Hi Jason,
>
> I had this problem a little while back except that it appeared
> intermittently. Sometimes it's took a few milliseconds to send a UDP
> TRAP, but every now and again it took 1000ms plus a few milliseconds to
> send. The problem appeared over Windows XP and Linux.
>
> Some investigation and I discovered that if getting the socket resource
> from the OS kernel fails for whatever intermittent reason, then the
> error notification may not be provided for about 1000ms
> (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4667046)
>
> Frank Fock's response on my request to this e-mail list was:
>
> "Are you using a single Snmp instance with a single set of transport all
> the time? If not, that's the problem." 
>
> Which I wasn't because the code in org.snmp4j.tools.console.SnmpRequest
> doesn't... In particular the send message creates a new session object
> (via createSnmpSession()) per send.
>
> public PDU send() throws IOException {
>     Snmp snmp = createSnmpSession();
>     ....
>
> To solve the spurious 1000ms delay problem I created the session object
> once and bound it to a class variable (plus make some other minor
> changes to support the change).
>
> I imagine this is common question and it'd be nice if the answer was
> avaliable in a FAQ, or the mail list archives were more easily
> searchable.
>
> 	Regards,
>
> 	- Ajeet.
>
> -----Original Message-----
> From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
> Behalf Of Jason Grant
> Sent: Friday, 27 July 2007 5:03 PM
> To: snmp4j at agentpp.org
> Subject: [SNMP4J] 1 sec to send a pdu with SnmpRequest
>
> I've written my test routines to confirm proper operation of my agent by
> sending PDUs using org.snmp4j.tools.console.SnmpRequest.  Unfortunately,
> the send method of this class is taking over 1 second to transmit and
> receive a response, making table traversal very slow.  I have not
> profiled this class, nor the agent, which is based on TestAgent. 
>
> I'm a little concerned that the bottleneck may be in the agent itself,
> rather than the client.  Tips about how to reduce the latency would be
> appreciated, since if the sluggishness is in the agent, it may be a
> little slow to use in our production environment.
>
> Thanks,
>
> Jason.
>
> -----------------
> Utiba Pty Ltd
> This message has been scanned for viruses and dangerous content by Utiba
> mail server and is believed to be clean.
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>
> -----------------
> Utiba Pty Ltd 
> This message has been scanned for viruses and
> dangerous content by Utiba mail server and is 
> believed to be clean.
>
>   


-----------------
Utiba Pty Ltd 
This message has been scanned for viruses and
dangerous content by Utiba mail server and is 
believed to be clean.




More information about the SNMP4J mailing list