When Should You Turn Your API into Asynchronous?
There are a couple of cases that you should consider turning your APIs into asynchrnous:
Computation-intenstive (Time-consuming)
If your API is about some heavy computation which may not return shortly, you certainly want to make it asynchronous. If your API is time consuming – which is larger than 90 seconds timeout limit by most web servers, you may want to store the information of requests in a database, and provide an API or simply the same API that returns the status of the job i.e. pending, processing, done.
Limited Resources
Even the APIs are fast to process, you might still consider making them asynchrous. This is to improve the throughput of your API servers – to avoid API flooding your web servers. Making API asynchronous delegate the load to the background processing jobs – which can be scheduled (run at intervals) according to the capabilities.
The Video Merger is based on Asynchronous APIs.
Product Recommendations
- Make Your WordPress Fast Again! This WordPress is accelerated by WP Rocket Plugin!
- Free $10 Credit, when you sign up with Vultr Cloud VPS (4 Months Giveaway!)
- Free $10 Credit, when you sign up with Digital Ocean Cloud VPS (2 Months Giveaway!)
- Free $20 Credit, when you sign up with Linode Cloud VPS (4 Months Giveaway!) - (Coupon: PodCastInit2018)
- The easiest way to Buy and Sell Bitcoins/Litecoins via Wirex Visa Debit Card!
- Buy and Sell Bitcoins/Litecoins via Local Bitcoins