Greedy computing with API

 We all know computing resources have a cost. Memory, long term storage, transportation and computing all have their own costs. There are lot of scenarios where your API end point won't be able to respond in time. These are scenarios where you need to use more resources to provide a response. Let us be greedy with our resources and explore different patterns which can solve this.

Polling 

This is a commonly used pattern where the caller initiates a process. Then keeps on checking if the process is complete. If the process is complete then the caller reads the data needed. 

This is a good pattern when both systems are part of the same organization. At least developers of caller and callee should be able to discuss this implementation. 


Call back

This is an improvement over polling pattern. Here the caller supplies a call back URL to the long running process. Once the process is complete it calls the callback URL and informs the caller that process results are available now. 




Comments

Popular posts from this blog

ChatGPT for cavemen

Event driven architecture for micro services