Support » Plugin: Twitter Blackbird Pie » [Plugin: Twitter Blackbird Pie] Plugin creates HUGE amount of unnecessary overhead

  • We’re using this plugin on a high traffic community site, and for the past few days our server has been crashing several times a day, locking up the CPU and maxing out the memory each time.

    We’ve been racking our brains trying to find the cause and finally discovered over 3K queries being run on each page load. Over 2K of these were querying user meta data.

    It turns out this plugin is returning all registered users on the site, looping through them and retrieving the meta data for each using a separate query for each and storing this on every page load, simply to check and see if there’s a stored twitter handle available for the post author of the current post in the loop.

    While this might be no big deal on a site with less than 10 users (it’s still 9 more queries than necessary,) it turned out to be a total showstopper for us, with over 2K registered users to loop through.

    For the time being we’ve simply commented out the loop that builds this “cache,” which seems to only prevent the &related= parameter from being added to the twitter action links that are added to the plugin output, and we have it as a very low priority to optimize this process. If we do get around to cleaning the code, we’ll be sure to send the code over to the plugin authors for review.

    In the meantime if the plugin authors would like to have a look at this very serious bug, it’d be great to be able to restore full functionality of the plugin with no more than a plugin update on our part.

    Thanks for your attention and remember, when writing a plugin, get_num_queries() is your friend!

Viewing 3 replies - 1 through 3 (of 3 total)
  • In case anybody else has this issue or the plugin author wishes to repair this lurking resource hog in the plugin source, here’s how we fixed the issue to maintain the same functionality in the plugin, while limiting overhead to one extra query per page load, instead of one extra query per registered user on each page load, (which in our case is over 2K.)

    in blackbird-pie.php,

    1- commented out lines 86-108

    2- changed lines 314-320 from original code to the code below:

    $favorite_url = esc_url( “{$id}” );
    $handle = get_user_meta( $post->post_author, ‘twitter’, true );
    // If we have a Twitter handle for this post author then we can mark them as ‘related’ to this tweet
    if ( $handle and trim($handle) != ” ) {
    $retweet_url .= “&related=” . $handle;
    $reply_url .= “&related=” . $handle;
    $favorite_url .= “&related=” . $handle;

    Plugin Author bradvin


    hi beezeee

    thanks for all you help on this. I have updated the plugin according to your changes and credited you in the code comments



    Glad I could help Brad and thanks for updating the plugin and adding a credit!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Twitter Blackbird Pie] Plugin creates HUGE amount of unnecessary overhead’ is closed to new replies.