Support » Fixing WordPress » Persistent Database Connections?

  • Hello,

    We’re experiencing some peformance with our WordPress install that seems a bit subpar. The installation itself is running on Azure as an application with the MySQL database hosted on ClearDB. We have a the plan which allows for 30 concurrent connections, which I was under the impression from ClearDB ought to handle the load we have (their example calculation suggested 14 connections could support 100K hits over 2 hours, which I believe is below our traffic). However, we seem to run into problems related to either free connections, slow queries, or a combination of the two. There will be times which our site is unavailable, and checking ClearDB, it seems like this happens because there are no available connection slots.

    I’m currently looking at both database performance (index maintenance, and general row cleanup, I’m more of a SQL Server guy though) and connection options. A lot of the searching on the web seemed to suggest that our deployment would benefit from the use of persistent connections, to the point Microsoft even developed a plugin to adjust settings accordingly. However, all those articles seem to center around 2014, and it’s not clear to me that the guidance in them is still correct. Also, the methods for enabling persistent connections, I’m not clear if they are still valid. I’ve seen 2 options, one a modification to wp-config.php and the other a modification to wp-db.php. The structure of our files is somewhat implying to me that perhaps those are no longer the correct ways to enable it. So I’m looking for if anyone has any idea if using persistent connections is possible, and if the methods I’ve seen are still valild. Methods I’ve seen:

    prepending p: to the host in the mysqli function (seems a bit of a hack)
    using the Microsoft plugin (assume it changes wp-config etc, unclear what actually happens)
    swap around @mysql_pconnect and @mysql_connect (deprecated according to the docs)
    I thought there was at least one other method in wp-config, but I can't seem to find it now. 

    It’s also not clear to me that this is a good idea, as I read in a very old post (~2010) that there were issues with connection persistence, but given that Microsoft developed a plugin for this, I’m assuming those concerns were no longer a problem when they did it.

    tldr; With an Azure+ClearDB deployment, is it terrible to enable persistent connections. If not, what is the mechanism to do so/does the Microsoft plugin still work?

    Thank you!

    • This topic was modified 6 months, 2 weeks ago by  chiefmas.
  • The topic ‘Persistent Database Connections?’ is closed to new replies.