Wednesday, 6 May 2009

Slow Weblogic response - JSP and Servlet Reload

The top Weblogic tuning tip I've used over the last few years is the one below. This article deals with Weblogic 8 and 9.

You know the symptoms:

JEE Application works okay on Unit Integration and Test servers.
But once you're into Performance and Stress Testing - it's totally choked up - pages are returned so slowly - Project Manager is asking for a code review to find the blockers - etc.


The first thing to do on a slow JEE application is to take a thread dump, see more on that here

Now, the thing to look for in the Thread Dump, is multiple threads doing this:


weblogic.servlet.jsp.JspStub.checkForReload(JspStub.java:144)


or this:


waiting for monitor entry [c4f7f000..c4f7fc28]
at weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:771)




This is not a stuck thread within your code – but this is a weblogic.xml setting for checking each time if your servlet class or JSP has been changed.

As documented here:

http://e-docs.bea.com/wls/docs92/webapp/weblogic_xml.html#wp1038491

Sets the interval, in seconds, at which WebLogic Server checks to see if JSP files have changed and need recompiling. Dependencies are also checked and recursively reloaded if changed.

If set to 0, pages are checked on every request. If set to -1, page checking and recompiling is disabled.

Most users set this to -1 to disable in Production unless they're altering jsps on the fly (which is not normal practice on a production system).


The correct syntax for this is:

<weblogic-web-app>
<jsp-descriptor>
<jsp-param>
<param-name>pageCheckSeconds</param-name>
<param-value>-1</param-value>

</jsp-param>
</jsp-descriptor>

The similar value for servlets is set using the servlet-reload-check-secs within the tags below.

<container-descriptor>
<servlet-reload-check-secs>-1</servlet-reload-check-secs>
</container-descriptor>
</weblogic-web-app>


On non-production environments, you can set this to a reasonable value such as 600 (in seconds, which is 10 minutes) to allow for changed JSPs you drop in/FTP to the deployed environment, and want those to reflect sooner.

The other thing we must do on a production system is to precompile the JSPs as part of the build, and before deploying to Live.

Else, even the first time JSP compilation is quite slow and this must be avoided on the Production system.


For the same solution on Weblogic 10, look at an updated article.

5 comments:

  1. Hi Jose,
    I want to know whether in weblogic 9.2 the jsps will be precompiled by default while deploying the webapp or we need to enable it in weblogic.xml?
    Also clarify if jsps are precompiled, the very first response of the first request for a page will not be slow?

    -Thanks

    ReplyDelete
  2. Hi Sudhu,

    In WL 9.2, JSP precompile has to be enabled in your weblogic.xml
    It is not set true by default.

    If you precompile the JSPs, the first request will be faster than if you had not precompiled them.
    If your first request is still slow, it can depend on the volume of processing the JSP is doing - including any external gadgets or screens being fetched etc.

    ReplyDelete
  3. Hi Jose,
    Thanks for the info

    ReplyDelete
  4. Nice example for Jsp and servlet.Great collection of question, useful for both beginners and experience level Java programmer. Good job and carry on also I've passed last year in exploring max and Jitter,
    and I've worked a lot on FFT and use of Jitter to handle FFT data. But I didn't dive to deeply in Jitter, because I'm not really interested in images. What I'd like to do is to have the possibility to make some operations on matrix based on Symmetry applications of Group Theory,
    In a way to modify the spectral informations held in the matrix. Someone could argue if this could be done in Max, or could be better to work on it learning JAva and programming specific Externals? For that I am trying to go for 6 week training http://www.wiziq.com/course/12145-the-6-week-complete-java-primer-with-training-certificate wonder this course
    will help me out
    Thanks.

    ReplyDelete
  5. hello Sudhu ,

    In my environment

    1.Every time manged server down ( i checkd logs it shows weblogic.kernal.defaulf.selftuning and some times BEA-000000 code will displayed in error code only)

    2.Some times Application Slow(weblogic)

    how can i resolve the issues ?what is the procedure ?
    could you please help out?

    What situations application slow?what should i check?>

    ReplyDelete

How to connect Raspberry Pi Pico to a external temperature sensor(DHT11 or DHT22)

How to connect Raspberry Pi to DHT 11 / DHT 22   Connect your DHT11 sensor to the Pico accordingly -   Left pin (Signal) - GPIO Pin 22 (or a...