ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

First Hit takes more time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • First Hit takes more time

    Hi all,

    I have a java application that is bundled as a single Jar file in AS400 IFS folder. I submit it to QBATCH2 and it will invoke a few web services for RPG program requests.

    The problem here is only the first one or two requests (after the application is submitted to batch) are consuming long time (around 2 - 3 minutes) which is a huge delay for the users. Later hits are completed within seconds. We also noted that the processor usage of this appln is more during the first hit.

    Is it because that the jar is getting extracted only after the first request is received thereby taking more time? If so, is there any option to get the jar extracted even before any request comes to the program?


    Thanks,
    Neo

  • #2
    Re: First Hit takes more time

    Originally posted by neo85 View Post
    Hi all,

    I have a java application that is bundled as a single Jar file in AS400 IFS folder. I submit it to QBATCH2 and it will invoke a few web services for RPG program requests.

    The problem here is only the first one or two requests (after the application is submitted to batch) are consuming long time (around 2 - 3 minutes) which is a huge delay for the users. Later hits are completed within seconds. We also noted that the processor usage of this appln is more during the first hit.

    Is it because that the jar is getting extracted only after the first request is received thereby taking more time? If so, is there any option to get the jar extracted even before any request comes to the program?


    Thanks,
    Neo
    the biggest hit you are getting is the JVM starting. after the JVM is loaded the subsequent calls are using the already running JVM...
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: First Hit takes more time

      Thanks for the reply Tom,

      isnt it possible to get that JVM started at once when i submit the applicaiton rather than doing it at the first request?

      Neo

      Comment


      • #4
        Re: First Hit takes more time

        Originally posted by neo85 View Post
        Thanks for the reply Tom,

        isnt it possible to get that JVM started at once when i submit the applicaiton rather than doing it at the first request?

        Neo
        the JVM is only started on the first "call" to a java method.
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: First Hit takes more time

          Okay

          Thanks again for your time..
          Neo

          Comment


          • #6
            Re: First Hit takes more time

            I had the same problem on an application I wrote. It was using iText to generate a PDF report and the first call of the day was v.slow. The solution was to pre-start the batch jobs and have them call a bit of Java just to kick off the JVM. These jobs are then used to service requests for the PDF report.
            Ben

            Comment


            • #7
              Re: First Hit takes more time

              Hello

              This is a common problem with Java webservices.

              The best way around it is to call the webservice yourself, to initialise it, so that the first user doesn't have to wait. The first call will still take long, but it won't keep any users waiting.

              Comment


              • #8
                Re: First Hit takes more time

                Isn't that what I said a week ago?
                Ben

                Comment


                • #9
                  Re: First Hit takes more time

                  The first indexpage on our intranet calls to our todaylist.
                  Everyone in the company has the intranet webbrouwser in the Window startup folder.
                  The first person who boots their computer, has to wait about 5 sec. before the todaylist fully loads.

                  All the others that day load within 1 sec. that's 4 seconds faster booting , oh well...

                  Comment


                  • #10
                    Re: First Hit takes more time

                    I wenty by BenThurley and Flodge.

                    Thanks all, once again.

                    Comment

                    Working...
                    X