• Hi everyone,

    I have an issue with my website. I have a WordPress multisite network installed. I have over 200 blogs created. My website has issues with the MySQL database. It often reaches the max connexion limit. The database crashes and thus charged the server.

    My developer thinks that normalizing the MySQL database and setting 1 database user per blog will solve the issue. I only found a couple of topics regarding normalization and I wasn’t convinced this would make things better.

    What do you think?
    What is your experience with this?

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • IMO, shouldnt be needed. What is your max connections set to? Why is WP making so many connections to mysql? Does your site get that much traffic or possibly a plugin gone wild?

    We have a fairly large WP multisite installation. We have multiple WP servers with a big mysql database. We serve about 1 million page hits per day. Our server has max_connections at 500, but right now I queried the database and only see 10 connections being used.

    Thread Starter highschool2005

    (@highschool2005)

    I definitely don’t get that much trafic. I only have about 400 pages viewed per day.
    Our max connexion is set by default to 50.

    So it is more related to an issue with the PHP code you think?

    We have an affiliate programme so everytime someone uses the affiliate link, wordpress has to look for who the sponsor is but I’m pretty sure this wouldn’t cause any issue.

    I’ve finally been able to increase my RAM to 4GB, edit WHM and wp-config to take this into account. We have less issues.

    But still… I was just going to log into phpmyadmin and it won’t load for some weird reason. I get the 504 error : gateway timed out.

    This is so weird…

    Thread Starter highschool2005

    (@highschool2005)

    How about having 1 database user per blog? Have you ever heard of this fix?
    My developer says it’s a common issue with WordPress Multisite when there are many blogs.

    The 504 error from phpmyadmin tells me that you have a configuration problem that has nothing to do with WP. My guess is either a problem with the database configuration or (more likely) a configuration with your web server.

    I use this script to print out web server information. Create a file and put somewhere on the webserver then call it from your browser:

    <?php
    echo phpinfo();
    ?>

    My guess is that your php memory_limit is too low. There are plugins that check for some of the php config, but I do not remember them off hand right now.

    This is the plugin I use to do database debugging, Query Monitor: https://wordpress.org/plugins/query-monitor/

    If you turn it on it will display a lot of information. Some of the information contains memory usage… that will tell you if your php memory_limit setting is too low or not.

    Have you looked at your website logs to see if you’re getting much traffic, outside of what you see in your analytics account? e.g. spammer and hacker bots can frequently hit WordPress scripts like wp-login.php, wp-comments-post.php, wp-signup.php, xmlrpc.php and that can drive up both MySQL connections and memory use.

    If you do find that it’s bots, here’s some possible mitigation:

    • install a login limit plugin (you should anyway!)
    • block access to xmlrpc.php unless you need it, e.g. for the Android / iPhone apps
    • replace WordPress comments with a 3rd party off-site service, e.g. Disqus, LiveFyre
    • block wp-signup.php if you’re managing logins some other way, e.g. e-commerce shop signups, Gravity Forms User Registration

    By block, I mean disallow access to those scripts from NginX .conf or Apache .htaccess.

    As to reworking the WordPress data model, don’t. Just make sure you have an object cache — memcached, APC, redis, etc. Absolutely essential for any non-trivial WordPress website.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Not even Multisite needs a php memory over 128M. If that’s the case, you have insane plugins.

    My website has issues with the MySQL database. It often reaches the max connexion limit. The database crashes and thus charged the server.

    What’s the max connection for MySQL? Is it really 50? Becuase if so, yeaaaah that’d die on Multisite.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Database normalization to speed up multisite’ is closed to new replies.