Support » Plugin: WP RSS Aggregator » Very High Number of Function Calls

  • Resolved davide101

    (@davide101)


    First, thank you for the great plugin! We use an application to profile all of our code and ensure things run smoothly. I quickly noticed that this plugin generates an enormous number of plugin calls constantly – one hundred million in 30 minutes! I can’t imagine what would cause this much activity. Please see below:

    http://www.awesomescreenshot.com/image/2369836/8b513137957bd49962156f92133b7115

    Can you advise? We would love to keep using this plugin but this has me very concerned if our server is ever under high load.

    • This topic was modified 2 years, 6 months ago by  davide101.
Viewing 6 replies - 1 through 6 (of 6 total)
  • As background, we have about 40 feeds and update them once every two hours in a staggered fashion. We are displaying the widget on just two pages that account for about 3% of pageviews.

    Hi @davide101,

    Glad to hear you like the plugin 🙂

    Can you please share with us what application you use to profile the plugin’s code? We’d like to try and reproduce it on our end to see if it comes up with a similar result.

    Also, can you please elaborate what’s exactly is the “plugin call” or the “function call count”? What’s included or what’s covered under this “plugin call”?

    Did you experience any significant lower/down performance affected by this?

    Hi Eric,

    I’m using a tool called New Relic to profile our applications. This portion of the software is paid but they have a free trial. And the free version is fantastic for monitoring overall application performance and server loads – I think you’ll really like it.

    The Function Call Count is how many times a function within the plugin is being called. So, in this case, a function is this plugin has been called over 4.5 BILLION times in the last three days. Which is 100x more function calls than our theme makes or 200x more than our caching software makes.

    The calls might only take a few milliseconds. But billions of milliseconds adds up to real time.

    Thanks for taking a look. I really like this and would be bummed to stop using it. There’s probably a simple tweak or two that can dramatically reduce those function calls.

    Hi @davide101,

    After consulting with our developers, here is what they could say about this.

    At first, we thought that maybe there was an infinite loop somewhere or an infinite recursion. Then, we looked at the numbers for the other things listed there and imagine how WP developers, well, develop.

    We’re pretty sure that the number of “function calls” depends on the complexity of the application.

    For example, if to retrieve a configuration value we retrieve the main plugin instance, which gets the DI container, which gets the component factory, which creates the config object, which calls a few helpers and the DB class and reads JSON to populate itself, then normalizing all configuration sources into one place, getting that value, and passing it up the chain as the result, that’s one thing.

    If the configuration value is stored in a global constant, that’s something else.

    We’re sure you will have figured out by now that the latter could take a few dozen calls less. And therefore, we imagine it would be natural for WP RSS Aggregator to make many more calls than regular WP products.

    Then again, maybe not that many. To be honest, we never concerned with how many “function calls” to make. However, what remains to be found out is: how is this information gathered? What counts as a function call? Is this information gathered on the frontend, the backend, or both? Also, 30 minutes is, well, a long period of time.

    If you have a page shown to your visitors, which say uses the shortcode to display feed items, and this is what you mostly do on your frontend, then it’s very possible that other components (such as EDD or Genesis) are not used that much.

    Genesis is a theme framework. If all it does there is find the right page through the page hierarchy and uses a few functions to get its contents etc, then that’s not much. If you have 60 visits a minute, then in 30 minutes you have 1,800 visits. If each visit triggers 60,000 function calls (which is a lot), then there you have your number.

    Please keep in mind that WP RSS Aggregator can do a lot of work even when there aren’t a lot of visitors because it is importing data in the background. The number of Feed Sources you have and how often they import, having adjusted for this, is easily affecting the realistic number you can get such as 5k function calls per visit.

    That being said, if you’d like to, you can share the details of your research result and how you gather the stats, such as your New Relic settings or configurations.

    Please provide as many information as you can such as what you have given before:

    As background, we have about 40 feeds and update them once every two hours in a staggered fashion. We are displaying the widget on just two pages that account for about 3% of pageviews.

    in order to be able to reproduce the similar results to yours.

    We can then try to on one hand gather stats of our own to see a “baseline”, and on the other – make appropriate calculations and adjustments.

    Thanks again for sharing your analytical result here.

    Hi Eric, thank you for the thoughtful response.

    We sent out our newsletter this week and had our second period of server instability in the last few years. In doing some research, I discovered a bug that was causing a ton of extra queries to admin-ajax.php.

    I then noticed that calls to your function increase similarly to calls to admin-ajax.php. Perhaps a set of function calls are being triggered not just on pageviews, but on calls to admin-ajax.php as well?

    I don’t know that this is a major performance issue, but I do get wary of anything that shows up on my “time consumed” report because if we get hit with 1000 simultaneous visitors, then 10ms x 1000 people x 10 ajax calls adds up to huge amounts of time.

    Thanks for taking a look!

    David

    Plugin Contributor Xedin Unknown

    (@xedinunknown-1)

    Hi David,

    And thank you for this report. Because we cannot test our products in all possible environments, feedback like yours is very valuable to us.

    Unfortunately, at this time we do not have access to a comprehensive report of how our plugin behaves under high load and with your set of components. Therefore, I cannot really tell exactly whether or not the high number of “function calls” is a bad thing. I have been unable to find information on what this metric is and how it is gathered, in the New Relic documentation. WP RSS Aggregator is a far more complex product than Genesis, where there’s no dependency injection, no MVC, and which is almost completely procedural, with the exception of around 25 classes (that’s all I could find in the endless mixture of PHP and HTML) versus many dozens of classes in WP RSS Aggregator Core alone. If a function is considered by new relic to be either a procedural function or a class method, then the number of calls can easily grow dozens of times over what Genesis makes. After all, the Genesis theme has a total of slightly more than a 100 files, while WP RSS Aggregator Core has over 350 PHP files. I’m sure that you can see a correlation here.

    Nevertheless, 100 times more sounds like alone, and if this worries you, we would be willing to investigate further, if you can provide access to the data and analysis results you used to assess the plugin. I would also highly suggest that you isolate the metrics for usage *during a typical request*, separately for the front-end and the back-end of your site.

    I hope this helps.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Very High Number of Function Calls’ is closed to new replies.