• Resolved ladislav.soukup

    (@ladislavsoukupgmailcom)


    hello again šŸ™‚
    I found one performance issue with this plugin. There is huge CPU load on server with this plugin activated on big site (thousands of posts) with high traffic (with caching, but only for 10 minutes per page).
    I tried to find the main problem and it seems, that this plugin is asking the API at http://realfavicongenerator.net/api/versions?since=… every single page load (non cached). This kicked our webserver from about 35-40% CPU load to 90% šŸ™
    I didn’t have time to debug this problem properly, I just know, that the CPU load is likely caused by this plugin. On smaller sites (and our dev site), everything is perfect.
    Maybe, if you can look at the code and implement the check once per hour? maybe using cron job.
    If I will have a spare time next week, I can try to implement this change and test it on our production server under heavy load.

    For now, I generated favicons manually and inserted them to header. Still, you have the best favicon generator out there šŸ˜€

    https://ww.wp.xz.cn/plugins/favicon-by-realfavicongenerator/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author phbernard

    (@phbernard)

    Thank you very much for reporting this one. I was 100% confident the plugin was efficient, well, that’s not the case šŸ™

    What you observe is not supposed to happen. The plugin should look for updates once a day, not once per page load. The first easy and safe fix would be to move this action to the admin part. With this, whatever happens, only the admins will be impacted, not the regular visitors. Then, I need to find out why the action is called that many times.

    I can’t address this right now but obviously this is my top priority issue.

    Thread Starter ladislav.soukup

    (@ladislavsoukupgmailcom)

    FYI: I’m not 100% sure that the performance problem is caused by that API call… It just seems like that, but it may be something different… I will do some debug tests today and I will let you know if I can find the cause.

    Thread Starter ladislav.soukup

    (@ladislavsoukupgmailcom)

    hmmm… I was going deep to your code, and it seems like there is nothing wrong…

    Your plugin seems to just load, take the value of “fbrfg_html_code” using get_option() and just insert it via wp_head hook, right?

    Weird is, anytime I enable the plugin on my site, CPU usage goes up to 2x normal state or more, but as I’m looking to the code, there is no reason for that…

    I just run the test with your plugin and simulating 100 concurrent unique visitors to HP (without cache) and successfully take the website down šŸ™ The core problem for the server was MySQL connections… Don’t want to believe that this can be caused by just get_option() šŸ™‚
    I need to go deep in our rewrite rules and other WP hooks… there may be just some kind of collision with other plugin or even template code.

    Plugin Author phbernard

    (@phbernard)

    Yep, that’s really weird šŸ™

    As you noticed, the “core” of the plugin is very light: inject some code if get_option returns something. With all WP code and regular plugins on board, I guess get_option runs a dozen of times on each page load.

    However, I did two things:
    – Update checking is done in the admin section. So if anything wrong happens here (eg. update checking is run too often for some reasons), only the admins are impacted.
    – Locales are not loaded anymore in the public section. That was completely useless anyway. As for get_option, I don’t think this is the kind of “heavy processing” that might put a site on his knees. However, if you are willing to make some experiments, you can comment the line add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); in class-favicon-by-realfavicongenerator.php and see if it’s better.

    These changes will be part of version 1.2.12, to be released in a few days.

    Plugin Author phbernard

    (@phbernard)

    The fix was deployed a minute ago (v1.2.12). I hope that will solve your issue!

    Plugin Author phbernard

    (@phbernard)

    Sorry to ask, but did you have the opportunity to retry?

    You already spent a lot of time on this issue, so it’s okay if you don’t want to work on it anymore!

    Thread Starter ladislav.soukup

    (@ladislavsoukupgmailcom)

    sorry… I just didn’t have the spare time… I’m now busy compiling and submitting several apps to iOS and Android stores. I will check the fix later this week šŸ™‚

    Plugin Author phbernard

    (@phbernard)

    Great! No emergency!!

    Thread Starter ladislav.soukup

    (@ladislavsoukupgmailcom)

    I’m sooo sorry for my speed and slow response šŸ™‚

    The good news is, that after the update, I can’t overload the server… whatever I try to do, website is still fully responsive. Server load impact is the same with and without the plugin.

    so…. the problem is fully resolved šŸ˜€ thank you and sorry again for my slow reply šŸ˜€

    Plugin Author phbernard

    (@phbernard)

    Thank you very much for having taken the time to check this one more time!

    Good! So the fix seems to be effective.

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

The topic ‘performance problems – high load sites’ is closed to new replies.