2 Replies Latest reply on Mar 21, 2011 9:54 AM by asiandub

    Threading issue on AS 6

    asiandub

      I'm currently facing a problem with my web application which I'd like to discuss here:

       

      The application (JEE 6 / JSF) is deployed on a single AS and performs pretty well overall (knock on wood ;-))

       

      The problem however starts when certain user actions are executed (excel exports of huge report) - the report generation itself takes about 5-10 minutes, which is quite okay for us. Definitely not okay is the fact that the system load goes up to 100% an the application becomes totally inresponsive while the export runs. :-(

       

      I'm looking for a way to priorize the heavy load tasks and to guarantee that the system stays usable while the export runs.

       

      Simply getting a handle to the current thread and setting its priority to Thread.MIN_PRIORITY feels a bit short sighted, because I assume that after a while all threads in JBoss' thread pool are downgraded. But I can be wrong - so I'd be glad if someone could push me in the right direction...

       

      Cheers,

      Jan

        • 1. Threading issue on AS 6
          asiandub

          update: what we implemented as a quick workaround:

           

          - set priority of current thread to minimum

          - perform heavy work

          - set priority of current thread back to normal (in a finally block)

           

          works pretty much as expected - but feels like a quick and dirty hack...

           

          any better suggestions?

           

          cheers,

          Jan

          1 of 1 people found this helpful
          • 2. Re: Threading issue on AS 6
            asiandub

            it seems like not too many people are having issues with threads ;-)

             

            Anyhow, should someone be confronted with a similiar situation, here's my conclusion:

             

            - the described way works pretty good and stable, even under production load (internal application, max 10 parallel users)

            - re-adjusting the priority after "heavy work" is finished is certainly good style, but probably not required, as the default keep-alive time of a thread (see default configuration below) is one minute. So my doubt that all threads will be downgraded after a while is false - no thread will be kept alive and idle longer than one minute...

             

            <mbean code="org.jboss.util.threadpool.BasicThreadPool"

            name="jboss.system:service=ThreadPool">

            <attribute name="Name">JBoss System Threads</attribute>

            <attribute name="ThreadGroupName">System Threads</attribute>

            <attribute name="KeepAliveTime">60000</attribute>

            <attribute name="MaximumPoolSize">10</attribute>

            <attribute name="MaximumQueueSize">1000</attribute>

            <attribute name="BlockingMode">run</attribute>

            </mbean>

             

            - in case that finer adjustments are required: the jmx console allows to dump all current threads, this should give a good overview of what's going on at the moment.

             

            Hope it helps others :-)

             

            cheers,

            Jan