Performance

How to Improve WP Cron Performance

Recently I got some requests from the client who uses my Simple Inventory Sync plugin, and the request was about its “full resync tool”.

The thing is that full resync is using WP Cron to sync product inventory because it is a more seemless solution and sutable for a large stores (with an AJAX approach you can not refresh the tool page and forget about it). But this tool has a limit of HTTP requests per cron job, let’s say 5, so no page overload happen. And even when everything is coded with batch requests, sometimes the client could have tons of products with tons of variations for each for them – in that case the resync will take some time anyway.

The issue is when you have scheduled 1 cron job every minute, but your website has 1 visitor every hour, then guess what – WP Cron will run every hour.

Luckily it is possible to fix if you deactivate WordPress standard cron and just run it from the server.

Let’s do it now.

Speeding Up WooCommerce API

I’ve been working with WooCommerce REST API for quite a while now, well, I developed a couple of plugins – Simple WordPress Crossposting and Simple Inventory Sync and both of them are relying on WooCommerce REST API.

And when you develop something that is intended to be used not only on your test website with 5 products total but also on high load websites, when orders can contain more than 100 products and variations, of course you should always keep performance in mind.

In this tutorial I will share with you some simple simple yet effective tips and tricks.