4 Replies Latest reply: Jul 11, 2012 9:26 PM by Kalyan Pasupuleti-Oracle RSS

    Web application servlet access delay

    753755
      Hi,

      I have a web application with a simple servlet HelloServlet which just does a 20 seconds sleep. My ajax based web application invokes the servlet asynchronously multiple times. The POST requests are dispatched concurrently but from the access.log I can see that the servlet threads do not all run concurrently and there is a delay. If I run this frequently the thread pool tunes itself, increases the pool size and and the throughput increases. But even so it never gets to a point where if I send 20 request, all 20 requests are processed immediately.

      e.g. - after running running it a few times (i.e. self-tuning took place) - 6 requests processed at 10:43:18, another 6 at 10:43:43, another 6 at 10:44:08, etc.

      127.0.0.1 - - [06/Jul/2012:10:43:18 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:18 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:18 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:18 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:18 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:18 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:43 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:43 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:43 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:43 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 99
      127.0.0.1 - - [06/Jul/2012:10:43:43 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:43:43 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:44:08 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:44:08 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:44:08 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:44:08 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:44:08 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100
      127.0.0.1 - - [06/Jul/2012:10:44:08 +0100] "POST /lucas/HelloServlet HTTP/1.1" 200 100

      Would you know if this is how the self-tuning thread pool is supposed to work? I.e. maybe it doesn't make sense for my application to send so many concurrent POST requests and instead I should be sending everything in a single POST.

      Thanks
      Lucas
        • 1. Re: Web application servlet access delay
          Kalyan Pasupuleti-Oracle
          Hi Lucas,

          Default workmanager comes into this picture.

          as it is using default workmanager then your app is included with in self tuned one now.

          For more details please check workmanager docs.

          http://docs.oracle.com/cd/E11035_01/wls100/config_wls/self_tuned.html


          Regards,
          Kal.
          • 2. Re: Web application servlet access delay
            753755
            Hi Kal,

            Many thanks for your reply. I created a separate work manager for my web app, with a fair share request class, response time request class, min thread constraints and even tried switching to the old weblogic 8.1 thread model without self-tuned threads but never got them to process the requests all at once. In my case, do you think it should be enough to set the min thread constraint and a response time request class?

            Thanks
            Lucas
            • 3. Re: Web application servlet access delay
              PHCharbonneau
              Hi Lulks,

              In order to assess this, you need to look at the Thread matrix from Weblogic itself and not just the access.log. The process of converting the incoming Socket connection (via muxer) and assignment to a WL kernel Thread is very fast so I don't expect any delay here.
              In order to have exactly 20 threads executing your Servlet, the Socket muxer needs to receive all these requests at the same time.
              Chances are that the client test (load test) is unable to generate the 20 concurrent requests fast enough to perfectly simulate 20 concurrent requests, requiring 20 concurrent Threads. Can you please elaborate how you are generating your load test requests, tool you use etc.

              Please also look at the socket connections established with your Weblogic server via netstat etc. and let me know what you see e.g. how many sockets are established from the client with WL listener address/port when you fire your 20 requests, you should see exactly 20 sockets (TCP IP connections) . Sockte vs. Thread is 1on1 model for incoming synchronous HTTP requests.

              The workmanager is used to cap the #Threads & backlog queue for targetted applications. Default workmanager is designed to expand vs. incoming request. I don't suspect problem with Workmanager at this point unless you setup some Threads constraint below 20.
              i also recommend that you generate a Thread Dump to assess the overall health of your JVM & Threads prior to your load test. You can also do the same during your test so we can rule out any other issue causing unexpected contention.

              Thanks.
              P-H
              http://javaeesupportpatterns.blogspot.com
              • 4. Re: Web application servlet access delay
                Kalyan Pasupuleti-Oracle
                Hi Lucas,

                Not required for implementing min constrains and Max constrains just create a very simple workmanager and specify with in your weblogic.xml file check with below link

                http://docs.oracle.com/cd/E15051_01/wls/docs103/webapp/weblogic_xml.html#wp1063118


                let me know if you need any further assistance.

                Regards,
                Kal