tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Einfeldt <ralph.einfe...@uptime-isc.de>
Subject AW: creating a instance of a servlet: takes too long!!
Date Fri, 06 Jul 2001 10:12:15 GMT
The time it takes to start a servlet depend on following
factors:
  - if it is run for the first time or has been changed
    since it was run last it will be regenerated and
    recompiled. Depending on size and conplexity this can
    take some time.
  - if it is the second call after a compilation it will
    directly serve your response.
  - AFAIK if it has been finalized by the servlet container
    it will be reloaded and your init method will be called
    again

To measure the time in your init() method just log some
timestamps like:

  long mStart = System.currentTimeMillis();
  log(mStart + 
      ":" + getClass().getName() + ":" + hashCode() + ": started");
  <some code/>
  long mEnd = System.currentTimeMillis();
  log(mEnd + 
      ":" + getClass().getName() + ":" + hashCode() +": finished after " +
      (mEnd - mStart) + " ms");

> -----Urspr√ľngliche Nachricht-----
> Von: pedro salazar [mailto:pedro-b-salazar@ptinovacao.pt]
> Gesendet: Freitag, 6. Juli 2001 11:02
> An: tomcat-user@jakarta.apache.org
> Betreff: creating a instance of a servlet: takes too long!!
> 
> 
> Greetings,
> 
> why is that my servlet when the first time is invoked, it 
> takes about 30
> seconds or more to start when the servlets that came in tomcat are
> instantaneous? After the servlet container instantiated and 
> initialized my
> servlet, all the following requests are very fast. Is there 
> any advice for
> what we should do and don't do in init() method? I just 
> initialize some
> properties and a connection pool....
> Well is it possible that my servlet container at any time my 
> may shutdown my
> servlet to release memory, and another time it will be 
> requested to start
> again and take another time too long to start, correct?
> 
> How can I benchmark the time of instantiation of my servlet 
> and the time of
> my init method?
> 
> System configuration:
> -Tomcat 3.2.1
> -JDK 1.3
> -Linux RedHat 6.2 [kernel 2.2.18]
> -PII400Mhz 256Mbytes
> 
> thanks.
> --
> <psalazar/>
> 
> 
> 
> 

Mime
View raw message