[SNMP4J] initialize too slow

Zhan Yi zhanyi at vanlink.com.cn
Sat May 8 08:31:19 CEST 2004


Hi Frank,

      With more trace, I found that in Salt.java:
      SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
      sr.nextBytes(rnd);      <--- this line used 20 seconds

Regards
Zhan Yi

----- Original Message ----- 
From: "Frank Fock" <fock at agentpp.com>
To: "Zhan Yi" <zhanyi at vanlink.com.cn>
Cc: <snmp4j at agentpp.org>
Sent: Tuesday, May 04, 2004 5:48 AM
Subject: Re: [SNMP4J] initialize too slow


> Hi Zhan,
> 
> Have you run your test case several times?
> I assume that the 20 sec. are related with
> class loading from disk. I cannot reproduce
> any significant delay when disk IO is factored
> out.
> 
> If you do not want SNMPv3 support, you should
> subclass Snmp and do not use Snmp's default
> constructor. Instead only add SNMPv1 and v2c
> message processing protocols. Then SNMPv3 will
> not be initialized and used.
> 
> Hope this helps.
> 
> Best regards,
> Frank
> 
> Zhan Yi wrote:
> 
> >Hi, 
> >    Thanks for your efforts on this project.
> >
> >    I just tried snmp4j, find initialization is too slow. I tried the following code:
> >        Date start=new Date();
> >        System.out.println("starting new Snmp(): "+start);
> >        TransportMapping transport = new DefaultUdpTransportMapping();
> >        Snmp snmp = new Snmp(transport);
> >        Date finish=new Date();
> >        System.out.println("finished new Snmp(): "+finish);
> >        System.out.println("Time used: "+(finish.getTime()-start.getTime())/1000+" seconds");
> >    
> >    The result is:
> >        starting new Snmp(): Thu Apr 29 17:51:59 CST 2004
> >        finished new Snmp(): Thu Apr 29 17:52:19 CST 2004
> >        Time used: 20 seconds
> >
> >    20 seconds are too long for me when i was developping code. Digging into the code, I just comment out the following line: SecurityProtocols.getInstance().addDefaultProtocols() since I am not using v3 features for now. I think this may need improve.
> >
> >Regards
> >Zhan Yi
> >
> >  
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >SNMP4J mailing list
> >SNMP4J at agentpp.org
> >http://p15141779.pureserver.info/mailman/listinfo/snmp4j
> >  
> >
> 
> 
> 


More information about the SNMP4J mailing list