Discussion:
[SNMP4J] initialize too slow
Zhan Yi
2004-04-30 01:03:47 UTC
Permalink
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
Frank Fock
2004-05-03 21:48:30 UTC
Permalink
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
Post by Zhan Yi
Hi,
Thanks for your efforts on this project.
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");
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
Zhan Yi
2004-05-08 06:31:19 UTC
Permalink
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
Post by Frank Fock
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
Post by Zhan Yi
Hi,
Thanks for your efforts on this project.
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");
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
Loading...