Support » Plugin: Simple Blog Stats » PHP memory usage & speed problems

  • Resolved AdamDobay

    (@adamdobay)


    Hi,

    We’ve been trying to track down PHP memory problems on our site, so I started looking at our plugins.

    According to Query Monitor normal page load on our site is 82 000KB and takes 1,72s — if I turn Simple Blog Stats off it drops down to 41K and 0,72s. I noticed this as Query Monitor was reporting that the query sbs_word_count_all()
    wp-content/plugins/simple-blog-stats/simple-blog-stats.php:294 was very slow.

    I was using SBS to display [sbs_posts], [sbs_approved], and [sbs_word_count_all] in the footer.

    I’d love to keep using this plugin but at the moment it seems it’s putting a lot of strain on the database.

    Can you let me know if this is normal and intended usage or a bug? I’m using the 20180508 version of the plugin.

    Many thanks,
    Adam

    • This topic was modified 1 year, 5 months ago by  AdamDobay.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hi Adam,

    Glad to help. This definitely sounds like a bug. I will investigate and try to resolve in the next plugin update. Thank you very much for reporting the issue.

    Regards,
    Jeff

    Hi Jeff,

    If it helps, I tried individually shutting off [sbs_posts], [sbs_approved], and [sbs_word_count_all] to see if they contribute on their own to the problem, but it seems even if one is used, the memory usage shoots right up.

    I’ve removed the plugin for now to keep our site from crashing, but please let me know if you’ve managed to fix it because I’d love to put it back.

    Thanks,
    Adam

    Plugin Author Jeff Starr

    (@specialk)

    Hi Adam,

    Thanks for the infos. Because this is the only report of excessive memory usage, can you let me know how much memory is available on your server, and also if possible which version of PHP you are using. That info would really be useful, thank you.

    Hi Jeff,

    My host tells me my VPS package has 10GB of RAM and the version of PHP in place is 5.5. (That memory sure sounds a lot but we have anywhere from 60 to 100K visitors a month, so we need to keep usage low not to overload the server, especially in peak times.)

    Plugin Author Jeff Starr

    (@specialk)

    Cool thanks. And from the description of the reported issue, it sounds like your site probably has a large number of posts and/or posts that contain a large number of words. Does that sound accurate?

    Exactly. As of last count we had 3583 posts, 66725 comments and 2,275,825 words.

    I’m wondering if there’s a simple way to have the plugin query this information once, cache it, and only update it once every day/week/month. That would solve the memory issue immediately.

    What I really need as a function is to have an easy stat shortcode so we don’t have to update our post count each time there’s a new post — and the rest of the stats basically just look neat. At the end of the day, none of these really need to be accurate by the second.

    Plugin Author Jeff Starr

    (@specialk)

    Yeah that makes sense then. And I agree, some sort of caching would be required to avoid memory issues when so many posts/words are involved. I will see what I can do to implement caching via transients, maybe as an option. I think it would be a good feature to add. Thanks again for taking the time for this, it really helps.

    Thank you for taking the time to look at this issue and on such short notice! You might be surprised but this is the smoothest exchange I’ve had with a WP plugin developer reporting a bug, so I’m very happy to help you with any input you need. 🙂

    Plugin Author Jeff Starr

    (@specialk)

    Lol I hear you, and thanks 🙂

    Also please keep an eye on this thread, as I will update it when the plugin is ready for sites with lots of posts and content.

    Cheers!

    Brilliant, thanks mate.

    And good luck with sorting this out!

    Plugin Author Jeff Starr

    (@specialk)

    Just to follow up with this. The plugin now uses transients (caching) to improve performance for shortcodes like [sbs_posts], [sbs_approved], [sbs_word_count_all], and others. New version should be available later today or tomorrow!

    Wow, cool! Looking forward to trying it. 🙂

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘PHP memory usage & speed problems’ is closed to new replies.