TechCrunch is one of the largest sites publishing with WordPress and its developers are always looking to improve performance to maximize engagement and ad revenue. This week the team open sourced its WP Async Task Library, which was created to offload time-consuming tasks into background tasks. Alex Khadiwala and Nico Vincent introduced the library at the Big Media & Enterprise Meetup in San Francisco within their “Non-Blocking WordPress” presentation.
Essentially, the purpose of the async task library is to identify anything on page load that blocks better performance and relegate it to a background task. Vincent and Khadiwala offer an example of how the library works to reduce API calls when loading CrunchBase cards:
On the TechCrunch site, loading CrunchBase cards on article pages is an example of a process that could slow down the site, since the information needed for each card becomes available via the CrunchBase API. To improve performance, we cache a copy of their data for about 12 hours. But when we initially retrieve that data or refresh it, we don’t want the API call to affect our page load time.
In both instances, we instead kick off an asynchronous call back to our site with the instruction to retrieve and cache this data to be available the next time it is needed, instead of waiting for a response from their API.
Prior to addressing TechCrunch’s performance issues, the site could take up to 17 seconds to load, as it was calling more than 100 assets. Thanks to the new task library, the situation has been dramatically improved. “Since the redesign, we’ve improved overall performance by 5 to 8 times by implementing the WP Async Task library, among other important back-end and front-end improvements,” the team reported.
It’s always exciting when one of the larger WordPress-powered publishers make their tools available to the community, because these projects tend to be the result of many developer hours. WP Async Task has the potential to benefit many other media sites running on WordPress thanks to the TechCrunch development team. The code is now available on GitHub under the MIT license and the team welcomes your contributions.