4 Replies Latest reply on Sep 24, 2013 9:21 AM by Radoslav Husar

    MaxClients and maxThreads

    Mohan Radhakrishnan Newbie

      Hi,

              I am following the instructions in

      https://access.redhat.com/site/articles/15786 to tune MaxClients in

      httpd.conf and maxThreads in JBoss Tomcat.

       

       

      " The recommended value of maxThreads is 200 per CPU, so here we assume

      the server is a single core machine. If it had

        been quad core we could push that value to 800 or more depending on RAM

      and other machine specs. The total threads

        is an aggregate value. If Apache and JBOSS are on the same server, and

      that server has four cores, then you would halve

        the maxThreads and MaxClients to 400 each."

       

       

      I have this question. Does this mean that maxThreads and MaxClients should

      both be equal to each other  ?

       

       

      My configuration is this.

      Machine 1 - JBoss and Apache(2 cores)

      Machine 2 - JBoss(2 cores)

       

       

      So even though Machine 2 can use about 400 threads(200 x 2 ) it is limited

      by MaxClients in Machine 1 which should be only 200. Is that correct ? It

      is a bottleneck.

       

       

      Thanks,

      Mohan

        • 1. Re: MaxClients and maxThreads
          Radoslav Husar Master

          Look here for what it means

          http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients

           

          So yes, if I am not mistaken, the concurrency level on both ends should be the same to accommodate such load. The actual configuration depends on whether you are using worker or prefork MPM. Read the section named "Advanced worker-mpm Configuration" where the details are explained.

          • 2. Re: MaxClients and maxThreads
            erasmo2 marciano2 Master

            HI

             

            You could use apache in mode worker e not prefork if you have many concurrent connections.


            If you have to do a check apache run this command


                      httpd -V


            You will find information on Apache

            • 3. Re: MaxClients and maxThreads
              Mohan Radhakrishnan Newbie

              Replying to both.

               

              I am switching from prefork to worker.

               

              The link that I posted is useful but I have two questions.

               

              1. The number of threads for a core is 200 irrespective of the number of hardware threads or the core architecture. How ? Is this a general measure ?

               

              2.  Longer question that might require a separate thread ? What other RHEL OS parameters need to be tuned to support this type of load.

               

              This is a JBoss tuning tip. I am cautious because a supporting OS parameter should not cause failure. I am going to adopt a capacity planning technique using concurrent users, think time analysis etc. but at this time the tuning should include OS parameters also. Any suggestions ?

               

              This may be an indication that there is a need to increase the number of file descriptors on the machine. On linux the command 'ulimit -n' can be used to check the total number of file descriptors. To bump up the total number for file descriptors user and system, follow these steps:

              Edit /etc/security/limits.conf and add the lines: * soft nofile 1024 * hard nofile 65535

              Edit /etc/pam.d/login, adding the line: session required /lib/security/pam_limits.so

              The system file descriptor limit can be increased by setting "fs.file-max" in the file "/etc/sysctl.conf". To set the limit to 65535 use echo "fs.file-max = 65535" >> /etc/sysctl.conf

              Increase default socket send/receive buffer

               

               

               

               

               

               

              sysctl -w net.core.rmem_default=262144

              (default socket receive buffer)

               

               

              sysctl -w net.core.wmem_default=262144

              (default socket send buffer)

               

               

              sysctl -w net.core.rmem_max=262144

              (max socket receive buffer)

              sysctl -w net.core.wmem_max=262144

              (max socket send buffer size)

              • 4. Re: MaxClients and maxThreads
                Radoslav Husar Master

                I am switching from prefork to worker.

                You should also make sure that the modules you are using are compatible with worker (i.e. thread safe).

                 

                1. The number of threads for a core is 200 irrespective of the number of hardware threads or the core architecture. How ? Is this a general measure ?

                There is really no relationship in "how many you can have" it's only about how many threads will still run fast on your core architecture (and this is such a wide topic we could go on and on aobut it). Ideally, use benchmarks to find what configuration works the best.

                 

                2.  Longer question that might require a separate thread ? What other RHEL OS parameters need to be tuned to support this type of load.

                +1 for a new thread instead.