Should You Turn Your API into Asynchronous?

api Should You Turn Your API into Asynchronous? API How it works (technical)

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.

AMP Version This post has 198 words.

Leave a Reply

Your email address will not be published. Required fields are marked *