cabrerahector / wordpress-popular-posts

WordPress Popular Posts - A highly customizable WordPress widget that displays your most popular posts.
https://wordpress.org/plugins/wordpress-popular-posts/
GNU General Public License v2.0
280 stars 83 forks source link

Data Caching vs Data Sampling #218

Closed PhillipHuynh closed 5 years ago

PhillipHuynh commented 5 years ago

I was reading your instructions in regards to trying to improve performance on our high traffic website.

Before reading this, I went ahead and enabled both "Data Caching" and "Data Sampling". I am not sure if I'm supposed to disable one or I can keep them both on.

cabrerahector commented 5 years ago

Hi Phillip,

Data Caching basically caches the data WPP reads from your database temporarily to avoid having to do the same query every time your popular posts list is printed on screen; while Data Sampling reduces the number of database writes done by the plugin (pageviews count updates). They're two different operations and can be run simultaneously so don't worry about it.

If for example you were to enable the Pageviews Caching feature then you probably don't want to use Data Sampling as both do more or less the same thing, except that Pageviews Caching is generally better performance-wise than the latter.

PhillipHuynh commented 5 years ago

Hi Hector,

This is a great answer! Thank you for taking the time to answer my question on such short notice.

Good to hear that both settings can be turned on and not conflict with one another.

I saw your explanation in regards to Pageview Caching, which I might go ahead and implement.

PhillipHuynh commented 5 years ago

Hi everyone,

If you are reading this, I can confirm that enabling the "Pageviews Caching" feature is beneficial for large, high traffic website.

Our system specs are 16GB RAM and 6 vCPUs from Digital Ocean.

Before we had "Data Sampling" and "Data Caching" enabled, during the day, our CPU usage was hovering around 50%-70%. Our RAM usage was hovering around 30-35%.

After enabling those features, our CPU usage dropped down to 30%-40%. Our RAM usage dropped down to hovering around 15%.

However, after enabling the "Pageviews Caching" and disabling "Data Sampling", our CPU usage dropped down even further to 20-30% now. The RAM usage stayed the same.

I hope everyone can see that these stats speak a lot.

cabrerahector commented 5 years ago

Damn, that's fantastic! Thanks for sharing, Phillip. I appreciate the input :)

I'll add a link to your comment to the documentation so future readers can learn about your experience as well.