1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Max Request Workers (MaxClients)

Discussion in 'Apache' started by qwikad.com, Oct 3, 2015.

  1. #1
    By default it's set to 150. I bumped it up somewhat recently. I was just wondering if there's a golden rule when it comes to setting a Max Request Workers number. Is there a formula of some sort there?
     
    qwikad.com, Oct 3, 2015 IP
  2. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #2
    I was going to reply yesterday, then did not. But as nobody else has...

    Your MaxRequestWorkers should be based on need and available resources (RAM).

    A more important setting, I think, is the KeepAliveTimeout. If you have KeepAlive enabled, it should have a short timeout, not more than 2 or 3 seconds I say. I have seen cases where people have the KeepAlive set at 15 seconds or whatever and the Apache process is tied to that IP for 15 seconds, requiring more processes to be started to serve other visitors and it exhausts RAM and causes crashes.

    http://2bits.com/articles/tuning-the-apache-maxclients-parameter.html

    http://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers
    http://httpd.apache.org/docs/2.4/mod/core.html#keepalivetimeout
     
    billzo, Oct 4, 2015 IP
    qwikad.com likes this.
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #3
    KeepAliveTimeout is off in my case. Throughout the day I get an error message (once or twice a day) "can't connect to the DB due to too many requests" for one of my sites. The interesting thing is sometimes I get that error message on one computer but not on the others (I use 3 computers for work). So I was wondering what the cause might be. Naturally I thought of the Max Request Workers setting. But maybe it's something entirely different?
     
    qwikad.com, Oct 5, 2015 IP
  4. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #4
    KeepAlive can be helpful.

    http://httpd.apache.org/docs/2.2/mod/core.html#keepalive

    Your error message sounds like a database issue, not a web server issue. You are using MySQL or MariaDB?

    https://dev.mysql.com/doc/refman/5.1/en/too-many-connections.html

     
    billzo, Oct 5, 2015 IP
    qwikad.com likes this.
  5. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #5
    Yes, it's a MySQL database.

    I just read in some manual for Apache that it's important to keep Server Limit and Max Request Workers at about the same amount. By default they are set at 256 and 150 respectfully. It appears that changing them to the same number (like 300 and 300) may help resolve the issue of "too many connections". Will try that to see if it does help.

    PS Really appreciate all the helpful links you posted there.
     
    qwikad.com, Oct 5, 2015 IP