• Hello,

    I’m encountering a “Error establishing database connection” error every now and then, mainly while working in the admin side of the website. I’ve got in contact with our hosting provider and they’ve found out that sometimes there are too many database connections open. They’ve capped it at 15.

    I’m wondering if there’s a plugin or a code snippet I could use to log exactly what file/plugin is opening and closing database connections, so I can see where the problem lies.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Yui

    (@fierevere)

    永子

    Its compherensive and advanced tool
    https://ww.wp.xz.cn/plugins/query-monitor/
    also it is not recommended to use on production sites.

    15 connections limit is too low, you can mitigate bottleneck with object caching , like with this plugin https://ww.wp.xz.cn/plugins/sqlite-object-cache/ if your webhost cannot offer you memcached or redis.

    Thread Starter kvdleijnijdam

    (@kvdleijnijdam)

    Thanks, I’ll give the Object Cache plugin a try, see if that helps.

    Also, why wouldn’t you recommend query monitor on production sites?

    Moderator Yui

    (@fierevere)

    永子

    see the plugin description and readme, it impacts performance and should be disabled when you will get debug info

    Thread Starter kvdleijnijdam

    (@kvdleijnijdam)

    Hello,

    Last week I installed the Object Cache plugin and that seems to have solved most of the problems. We did however still encounter the error 1 or 2 times when people placed an order, so I’m still wondering if it’s possible to log when a database connection is opened and closed. Isn’t there some hook I can use for this?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Logging open database connections’ is closed to new replies.