Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

Why is servlet slow on first access?

Thread view: 
Marcus Leon - 24 May 2005 21:20 GMT
We're running on Weblogic.  The first request always takes a few
seconds longer than all following requests.  Does anyone know why?

We pre-compile our JSPs so it's not JSP compilation time.

These servlets do data access - does it have something to do with the
DB caching data for subsequent requests?

Or is it due to the classloader having to load some classes for the
first time?

Thanks
enrique - 24 May 2005 22:14 GMT
Possibly the database connection being re-used in subsequent requests,
if you have that feature enabled.
Wibble - 25 May 2005 02:08 GMT
Class loaders, JIT compiler, jar files reads, xml configuration
files to parse, db connections, session replication.

> We're running on Weblogic.  The first request always takes a few
> seconds longer than all following requests.  Does anyone know why?
[quoted text clipped - 8 lines]
>
> Thanks
Antti S. Brax - 25 May 2005 06:49 GMT
marcus.leon@gmail.com wrote in comp.lang.java.programmer:
> We're running on Weblogic.  The first request always takes a few
> seconds longer than all following requests.  Does anyone know why?

    If your servlets are loaded when the first request arrives
    instead of being loaded during startup then this behaviour
    is quite normal.

Signature

Antti S. Brax                  Rullalautailu pitää lapset poissa ladulta
http://www.iki.fi/asb/         http://www.cs.helsinki.fi/u/abrax/hlb/

              [1385 messages expunged from folder "Spam"]

Ross Bamford - 25 May 2005 11:17 GMT
> We're running on Weblogic.  The first request always takes a few
> seconds longer than all following requests.  Does anyone know why?
[quoted text clipped - 8 lines]
>
> Thanks

You might find loading the servlets on startup rather than first use (as
is the default I believe). In web.xml:

<servlet>
 <!-- etc -->
 <load-on-startup>1</load-on-startup>
</servlet>

The number determines the order to load in where you have multiple
servlets.

Signature

  [Ross A. Bamford]     [ross AT the.website.domain]
Roscopeco Open Tech ++ Open Source + Java + Apache + CMF
http://www.roscopec0.f9.co.uk/ + info@the.website.domain



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.