11 Replies Latest reply on Sep 21, 2011 2:17 PM by ask4free

    AJP Connector currentThreadCount stays at maximum

    konami

      Hi Experts,

      I am not sure whether this has performance impact as the currentThreadCount for AJP connector never drops and stays at maximum. We use Apache in front of JBoss together with AJP connector and mod_proxy. The value I am checking is from Jboss web-console->System-> JBoss.web> ajp-{hostname}-8009. Here's corresponding configuration in server.xml file

      <Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
       emptySessionPath="true" enableLookups="false" redirectPort="8443"
       minSpareThreads="5" maxThreads="256" maxSpareThreads="20" connectionTimeout="20000"/>


      and Apache Configuration

      <IfModule prefork.c>
      StartServers 8
      MinSpareServers 5
      MaxSpareServers 20
      ServerLimit 256
      MaxClients 256
      MaxRequestsPerChild 4000
      </IfModule>


      And the server version and environment:
      Version: 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181418)
      Version Name: Trinity
      Built on: July 18 2008
      OS: Linux 2.6.18-92.1.10.el5xen (amd64)

        • 1. Re: AJP Connector currentThreadCount stays at maximum
          normann

          My setup has the same issue, which was introduced in the JBoss 4.2 series that upgraded from Tomcat 5.5 to Tomcat 6.

          I suspect this has to do with the fact that Tomcat 6 doesn't support the *SpareThreads attributes on the connectors any more. The documentation says that one must define an element (which defines a thread pool) and reference it in the connector.

          In my opinion, your case should be configured like this:

          <Executor name="default" minSpareThreads="5" maxThreads="256" />
          <Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
           emptySessionPath="true" enableLookups="false" redirectPort="8443"
           connectionTimeout="20000" executor="default" />


          It you use other connectors as well, they might want to reference the executor as well. It seems that it's not possible to set maxSpareThreads any more.

          I've tried fiddling with this in my own setup, but I end up in a situation where mod_jk ends up writing to closed Tomcat sockets which result in requests that lock until mod_jk times out. At this point, though, I don't have the time to look more into the matter.

          • 2. Re: AJP Connector currentThreadCount stays at maximum
            normann

            TIt seems that the forum lets me write HTML in the message. My previous message should have read:

            The documentation says that one must define an

            <Executor>


            element (which defines a thread pool) and reference it in the connector.

            • 3. Re: AJP Connector currentThreadCount stays at maximum
              piko

              Hi,
              same issue with Jboss 5.0.

              I try with your sample configuration, but it doesn't work: I see default value for maxThreads (200) for both connectors.

              Any idea?
              Thanks,
              piko

              This is my configuration:

               <!-- A HTTP/1.1 Connector on port 8080 -->
               <Executor name="active-executor" minSpareThreads="5" maxThreads="256" namePrefix="activeThread-" />
              
               <Connector executor="active-executor" protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" connectionTimeout="20000" redirectPort="8443"
              acceptCount="100" emptySessionPath="true"
               enableLookups="false" />
              
               <!-- A AJP 1.3 Connector on port 8009 -->
               <Connector executor="active-executor" protocol="AJP/1.3" port="8009" address="${jboss.bind.address}"
               redirectPort="8443" />
              






              • 4. Re: AJP Connector currentThreadCount stays at maximum
                peterj
                • 5. Re: AJP Connector currentThreadCount stays at maximum
                  sra78

                  In the executor, add 'maxIdleTime'. Below value will end idle threads after 10 minutes.

                  <Executor name="active-executor" minSpareThreads="5" maxThreads="256" namePrefix="activeThread-" maxIdleTime="60000"/>


                  • 6. Re: AJP Connector currentThreadCount stays at maximum

                    Hi,
                    Since Jboss 4.2.x uses Tomcat 6.0 connectors, you may have to try out the following.

                    In the AJP connectors node you can set like


                    <Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
                     emptySessionPath="true" enableLookups="false" redirectPort="8443" keepAliveTimeout="60000" maxThreads="200" connectionTimeout="60000" />
                    




                    See if this helps.



                    • 7. Re: AJP Connector currentThreadCount stays at maximum

                      Hi,
                      has anybody any input/solution on this thread?

                      I tried to implement the posted solution, without many effects.

                      thanks,
                      Matteo

                      • 8. Re: AJP Connector currentThreadCount stays at maximum
                        peterj

                        spezam, more details would help, especially since the referenced solution works for others.

                        • 9. Re: AJP Connector currentThreadCount stays at maximum

                          PeterJ,
                          sorry for the lack of information.

                          I actually managed to implement the solution with the following code:

                          <Executor name="active-executor" namePrefix="activeThread-" maxThreads="1000" minSpareThreads="30" maxIdleTime="60000" />
                          
                           <Connector executor="active-executor" port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
                           emptySessionPath="true" enableLookups="false" redirectPort="8443"
                           maxThreads="1000" keepAliveTimeout="60000" connectionTimeout="600000" />



                          what I can't understand now is why the "Current thread busy:" is always 0, even if I can see loads of calls with State 'S'




                          • 10. Re: AJP Connector currentThreadCount stays at maximum
                            konami

                            I think it is not reflected correctly anymore in the tomcat status when executor is used. You can check from jmx-console though.

                             

                            Go to /jmx-console and find for name={executor name},type=Executor on the page. activeCount should be the one we are looking for.

                            • 11. Re: AJP Connector currentThreadCount stays at maximum
                              ask4free

                              Konami, the value you are looking for in the AJP connector is currentThreadBusy . This parameter decreases when there are less threads being used, as you said the parameter currentThreadCount does never decrease, don't know why....