[SNMP4J] SNMP4J V3 perfromance
Frank Fock
fock at agentpp.com
Wed Oct 19 21:04:00 CEST 2005
Scott,
You are sending SNMP requests while you are handling a trap event.
While your are waiting for the response of your request, you are not able
to handle any traps. I recommend therefore either sending an async request
or using the MultiThreadedMessageDispatcherImpl as message disptacher.
Best regards,
Frank
Scott VanWart wrote:
>Frank,
>
>Is this the correct way to set the UDP Buffer size? And what number is
>reasonable to handle roughly 600-1000 events per second? Should it be
>400 X 1000 ?
>
>When you say decouple trap handling, I am not certain what you mean?
>
>Something like this?
>
>MessageDispatcher md = e.getMessageDispatcher();
>
>md.returnResponsePdu(e.getMessageProcessingModel(),e.getSecurityModel(),
>e.getSecurityName(), e.getSecurityLevel(), command,
>e.getMaxSizeResponsePDU(), e.getStateReference(), null);
>
>
>Thanks!
>Scott
>
>-----Original Message-----
>From: Frank Fock [mailto:fock at agentpp.com]
>Sent: Wednesday, October 19, 2005 3:38 PM
>To: Scott VanWart
>Cc: snmp4j at agentpp.org
>Subject: Re: [SNMP4J] SNMP4J V3 perfromance
>
>Hi Scott,
>
>You may check your UDP buffer size and you should probably decouple
>trap handling with sending out a synchronous request.
>
>Best regards,
>Frank
>
>Scott VanWart wrote:
>
>
>
>>Hey Guys,
>>
>>
>>
>>I am having problems with performance using SNMP4J. I have verified
>>
>>
>that
>
>
>>the device I am working with it sending more than 1 trap (inform) per
>>second, but all I seem to be able to receive is one event per second.
>>Here is my code, does anything jump out? Is there something I need to
>>set? Thanks!
>>
>>
>>
>>Thanks!
>>
>>Scott
>>
>>
>>
>>
>>
>>try
>>
>>{
>>
>>command = e.getPDU();
>>
>> Address source = e.getPeerAddress();
>>
>> e.setProcessed(true);
>>
>>
>>
>> if (e.getMessageProcessingModel() ==
>>MessageProcessingModel.MPv3)
>>
>> {
>>
>> // send response.
>>
>> UserTarget target = new UserTarget();
>>
>> target.setAddress(source);
>>
>> target.setVersion(SnmpConstants.version3);
>>
>> target.setSecurityName(new OctetString(user));
>>
>>
>>target.setSecurityLevel(SecurityLevel.AUTH_PRIV);
>>
>>
>>
>> snmp.getBulk(command, target);
>>
>> }
>>
>>
>>
>> VariableBinding varBinding;
>>
>> Variable var;
>>
>>
>>
>> // discover how many variables exist
>>
>> int length = command.size();
>>
>>
>>
>> // loop through variables and put them ALL into payload.
>>
>> for(int i = 0; i < length; i++)
>>
>> {
>>
>> varBinding = command.get(i);
>>
>> var = varBinding.getVariable();
>>
>> payload += var.toString() + "\t";
>>
>> }
>>
>>
>>
>> // Get source address of Trap.
>>
>> String test = source.toString();
>>
>> int colon = test.indexOf('/');
>>
>> src = test.substring(0, colon);
>>
>>
>>
>> }
>>
>>catch (Exception pe)
>>
>> {
>>
>> logger.error("Could not decrypt SNMP data:",
>>pe);
>>
>> }
>>
>>
>>
>>
>>
>>_______________________________________________
>>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