Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 60569 invoked by uid 500); 6 Jul 2001 10:12:16 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 60531 invoked from network); 6 Jul 2001 10:12:13 -0000 Received: from unknown (HELO server01.hh.uptime-isc.de) (217.6.61.26) by h31.sny.collab.net with SMTP; 6 Jul 2001 10:12:13 -0000 Received: by server01.hh.uptime-isc.de with Internet Mail Service (5.5.2650.21) id <3D6HMBM0>; Fri, 6 Jul 2001 12:12:17 +0200 Message-ID: From: Ralph Einfeldt To: "'tomcat-user@jakarta.apache.org'" Subject: AW: creating a instance of a servlet: takes too long!! Date: Fri, 6 Jul 2001 12:12:15 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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 =3D System.currentTimeMillis(); log(mStart +=20 ":" + getClass().getName() + ":" + hashCode() + ": started"); long mEnd =3D System.currentTimeMillis(); log(mEnd +=20 ":" + getClass().getName() + ":" + hashCode() +": finished after = " + (mEnd - mStart) + " ms"); > -----Urspr=FCngliche 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!! >=20 >=20 > Greetings, >=20 > why is that my servlet when the first time is invoked, it=20 > takes about 30 > seconds or more to start when the servlets that came in tomcat are > instantaneous? After the servlet container instantiated and=20 > initialized my > servlet, all the following requests are very fast. Is there=20 > any advice for > what we should do and don't do in init() method? I just=20 > initialize some > properties and a connection pool.... > Well is it possible that my servlet container at any time my=20 > may shutdown my > servlet to release memory, and another time it will be=20 > requested to start > again and take another time too long to start, correct? >=20 > How can I benchmark the time of instantiation of my servlet=20 > and the time of > my init method? >=20 > System configuration: > -Tomcat 3.2.1 > -JDK 1.3 > -Linux RedHat 6.2 [kernel 2.2.18] > -PII400Mhz 256Mbytes >=20 > thanks. > -- > >=20 >=20 >=20 >=20