Aysnc Processing
In this section, we will take a look at Async processing, which is a way of processing, where-in the actual task to be executed is deferred to, a later point in time.
Why do we need Async processing?
If the task to be executed is a computationally intensive operation and is going to take significant amount of time to complete, we may not want the thread which initiates this task to wait till the task executes. For e.g., Let us say we have a user Interface, which initiates file processing task by uploading it to the server. The file processing could take say a few minutes. It may not be a good idea to keep the User Interface in a waiting mode until the server completes its task.
We can make use of Async processing to submit the task and have the user interface return back to receive user actions. Once the task is completed, the user could be notified about its status.
Aysnc processing can be performed on the server side as well as on the client side, depending on the requirement.
How to achieve Server side Async Processing?
There are various ways to achieve Async processing:
- Using Native threads
- Using messaging systems like Java Messenger Service (JMS), Kafka, specialized queues like Rabbit MQ, Active MQ
How to achieve Client side Async Processing?
Client side Async processing techniques like Websockets or Promises feature available in UI frameworks like Angular JS, AJAX provide similar async capabilities.