1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Too many connections?

Discussion in 'XenForo Questions and Support' started by jauburn, Dec 12, 2013.

  1. jauburn

    jauburn Well-Known Member

    I saw about five of these in my server error logs:

    Too many connections 47 minutes ago - library/Zend/Db/Adapter/Mysqli.php:333
    Any idea of what causes this?

    Thanks.
     
  2. Slavik

    Slavik XenForo Moderator Staff Member

    You need to increase your mysql max_connections setting.
     
    jauburn likes this.
  3. jauburn

    jauburn Well-Known Member

    I did that--or I had the host do that. Here's what the host said, though. I'll pass this along and ask whether you think there's validity to it because it deals mostly with xenforo:

    In terms of MySQL, you have a couple issues. First off, your server is reaching the maximum connection limit. This is caused by code in your site where connections are opened to the MySQL server but never properly closed. This will cause your MySQL server to reject any further connections once it reaches this limit until slots open up. As a result, you'll see errors, slowness, etc.

    The way to correct this is to fix your site code so that any time a connection to MySQL is opened, it is closed properly. The next thing I notice is that you have a lot of "JOIN" queries that take place without the use of indexing. This causes fragmentation, slowness and other issues with databases. It would be advisable, and best practice, to audit your site code and fix it so that any time a JOIN is performed, it is done with indexing. ....

    The code fixes are definitely going to be the most helpful in terms of performance, so I would suggest implementing those as soon as possible. Please let me know if you have any further questions, and how you wish to proceed.

    Are these "code fixes" something that xenforo can do?
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    The software closes connections properly. The JOIN requests are also perfectly fine, an index isn't necessary or advisable in every instance.
     
  5. Slavik

    Slavik XenForo Moderator Staff Member

    XenForo already does anything your host is suggesting.

    Some joins are done without index, but as Jeremy pointed out, not all joins require indexes.
     
  6. jauburn

    jauburn Well-Known Member

    Yeah, I suspected I got some mumbo jumbo from the host, but it was very specific mumbo jumbo, so I wonder what he was seeing?
     
  7. Mike

    Mike XenForo Developer Staff Member

    You could disable "Enable Delayed Insert SQL Queries" - this causes long connections, though it should generally only be a couple. It's probably what he saw but didn't realize that they're actually internal to MySQL's implementation.

    The join comment is random, especially without an example. (Obviously note that add-ons can add bad queries, bad joins, etc -- this is often where heavy queries appear from.)
     
  8. jauburn

    jauburn Well-Known Member

    Thanks.

    I have quite a long list of add-ons now. How in the world could I figure out which one(s) are the culprit:

    Installed Add-ons
    Ad Manager
    1.0 Beta 3
    Bb Codes & Buttons Manager
    2.3.4
    Bookmarks
    1.2.1
    Browser Detection (Mobile/MSIE)
    1.2
    CTA Featured Threads
    1.0.0
    Disable Invisible Status by Waindigo
    1.0.0
    Donation Manager
    1.1.5
    Find Unanswered Threads
    1.0.4
    ForumRunner for XenForo
    1.1.4
    Nodes As Tabs
    1.2.2
    PhotoPost Integration
    1.0
    Post As User by Waindigo
    1.0.4
    Post Message Regex Replacer
    1.0.0
    QuoteME !
    1.8.1
    Remove Trophy
    1.2
    Sitemap for XenForo
    1.3.2
    Smilie Importer by Waindigo
    1.0.2
    TinyMCE Quattro
    1.7.0.3
    Username change
    1.2.0
    XenForo Resource Manager
    1.1.0
    [8wayRun.Com] XenAtendo (Events)
    1.5.0
    [BBM] BbCode Multimedia - Html5media
    1.1.0
    [bd] Widget Framework
    2.4.3
    [Extra License] New User Conversation
    1.1.0
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    Disable them all and re-enable them one at a time, performing checks and tests with each one active.
     
  10. jauburn

    jauburn Well-Known Member

    Well, I wouldn't even know how to begin performing such checks and tests.
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Clear the server error log.
    Disable all add-ons.
    Enable one add-on and use the forum normally.
    Check for errors.
    If no errors, enable the next add-on and repeat.
     

Share This Page