Friday, July 06, 2001, 10:16:05 AM, [EMAIL PROTECTED] wrote:

PD> There's another reason for this and it has to do with the 
java.security.SecureRandom class.
>>From what I can tell, tomcat uses this class to generate a seed value for the
PD> session ID.  The first request for a SecureRandom value (eg. new 
SecureRandom().nextLong()) can take many, many seconds to complete.  After the
PD> first usage however, it returns immediately.  I'm not sure what goes on when
PD> SecureRandom initializes but that seems to be where the slow down occurs.

Yes, good point. I've just been looking at that, too. It reminds me of the time
required to create a secure socket factory when using JSSE. After that
time is initially spent, any other new sockets are created quickly.

For development, I change to using randomClass="java.util.Random"

..and have noticed that the attribute randomFile="/dev/urandom" is irrelevant
 on win '98 (I assume this file contains a seed for the random generation?)

Also, there seems to be a lot elsewise going on under the hood. When accessing
a jsp, Tomcat seems to me (at this point) to be compiling servlets in the
webapp. Can anybody elaborate on that?

PD> As a work around, you could create a low priority thread that instantiates a
PD> SecureRandom calls nextLong() then exits, and have this thread get launched by
PD> the init() method of a servlet that gets preloaded.  This solution worked for me.

PD> Regards,
PD> Pete.

PD> Thus spake "pedro salazar" <[EMAIL PROTECTED]> on Fri, 6 Jul 2001 
10:01:37 +0100:

PS>> Greetings,
PS>> 
PS>> why is that my servlet when the first time is invoked, it takes about 30
PS>> seconds or more to start when the servlets that came in tomcat are
PS>> instantaneous? After the servlet container instantiated and initialized my
PS>> servlet, all the following requests are very fast. Is there any advice for
PS>> what we should do and don't do in init() method? I just initialize some
PS>> properties and a connection pool....
PS>> Well is it possible that my servlet container at any time my may shutdown my
PS>> servlet to release memory, and another time it will be requested to start
PS>> again and take another time too long to start, correct?
PS>> 
PS>> How can I benchmark the time of instantiation of my servlet and the time of
PS>> my init method?
PS>> 
PS>> System configuration:
PS>> -Tomcat 3.2.1
PS>> -JDK 1.3
PS>> -Linux RedHat 6.2 [kernel 2.2.18]
PS>> -PII400Mhz 256Mbytes
PS>> 
PS>> thanks.
PS>> --
PS>> <psalazar/>
PS>> 
PS>> 


Reply via email to