WordPress.org

Ready to get started?Download WordPress

Forums

Too many open requests from the database in WP 2.5 (4 posts)

  1. sabinou
    Member
    Posted 6 years ago #

    Hello,

    I noticed that my WP 2.5, compared to WP 2.3, has a very very huge database usage.

    In average, a "mysqladmin processlist" will return 85 open threads with my database, and that was much less with WP 2.3

    That may not look important, but with my blog hitting 30k unique users per day, I am already using half the resources allowed from my sql server, and some plugins can't work anymore.

    For instance any of the "archives" plugins I tested (like KGarchives for instance, from katesgasys.com), when they're of the kind that tries to make a list of every blog note ever published in a single page (in my case, that's a bit more than 700 blog notes, dispatched between a dozen categories), fails to work, and loads forever without opening anything.
    And yet, they perfectly worked with wordpress 2.3.
    A simple test, a dump of the database on a private test blog where nobody connects to, has shown that these plugins work... as long as nobody is connecting to the database except me ;)

    That may not be an issue for small blogs, but for big ones, that's a real problem, i'll be forced to downgrade soon.

    Honestly I don't think that could be solved easily on my side, so at least, I can report it here :) - and of course, if you have had that problem too and have come up with a patch, i'll be interested :D

    Cheers,
    Sabinou

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    While I cannot help you with specifics for your problem, I'd highly recommend running a whole-page caching plugin with that many hits per day. WP-Super-Cache works very well.

  3. sabinou
    Member
    Posted 6 years ago #

    Yes, as soon as I can get to customize a bit the ugly default archives template (my only solution left), this was indeed my next move, to get caching to work.

    But well, with high hopes for 2.6 to be lighter, the only contribution I could make was a report, at least :)

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Have you tried dumping the SQL queries being made? You can do that like this:

    Put this in wp-config.php:
    define('SAVEQUERIES', true);

    Put this in your theme's footer.php:

    <?php if ( current_user_can('manage_options') ) {
    echo "<!--\n";
    var_dump($wpdb->queries);
    echo "\n-->";
    } ?>

    Now, the SQL queries that it makes will be saved, and the results will be visible on any page when you are logged in as an administrator. Just view source of the page and look at the end.

    The query information will be a big array of lots of stuff. Each row will have:
    1. The SQL of the query.
    2. How long it took to run (milliseconds).
    3. What internal function called the query.

    This is useful for analyzing database bottlenecks.

    Remove that code after you're done, because saving queries does add a fair bit of time to page generation.

Topic Closed

This topic has been closed to new replies.

About this Topic