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
279 stars 83 forks source link

Aggregate views to memcache before updating the database #97

Closed ghost closed 6 years ago

ghost commented 8 years ago

Large wordpress sites usually use some kind of caching (eg: Varnish).

Using a plugin like WPP, every visit to every article will generate an Ajax call to admin-ajax.php which for heavy traffic sites will cause major load to the server(s).

A possible solution would be to pool all update_views_ajax requests to memcache instead of insert/update the database directly and then via wp-cron add the views to the database every X minutes in a single insert/update query instead of doing 1 query per view as it does now.

I believe this method will allow WPP to scale up on very large sites without compromising their caching policy. It will also benefit smaller sites since every write operation on the database is always expensive.

cabrerahector commented 8 years ago

Hi there!

Thanks for the recommendation! I'll keep it in mind for a future version of the plugin.

cabrerahector commented 6 years ago

Resolved on 174177f3c8f8e61b5e5fd05a133ed20ff076e334.

See Caching pageviews for more details.