Skip to main content

Asynchronous Processing

Asynchronous Processing

C# Programming context

To understand what is Asynchronous Processing, the prerequisite is to understand what is Synchronous Processing.
Basically, there are two main things involved in this:

  1. Client
  2. Server
Client: Sends the request to a server and keeps waiting until it receives the response. During the process, it keeps loading and needs a constant connection to the server.

Server: It processes the request received by the client and sends the response. If the process is long-running, sometimes the server goes out of memory or shows timeout error. Due to this, it is not suitable or recommended for long-running operations.


There are multiple problems with this approach... Let's discuss a few of them:
  1. Bad user experience
  2. The server needs to be very powerful as it may need to work on concurrent requests
  3. Server consumes a lot of resources
To overcome this problem, Microsoft .NET Framework 4.0 introduces a new Task Parallel Library (TPL) for parallel computing and asynchronous programming.

The namespace is "System.Threading.Tasks".
Here, we need to do it all manually. So this is again a tedious task.

So to solve this problem Microsoft came up with async / await in C# 5 in .Net 4.5 under System.Threading.Tasks.Task
This is pretty much good and could solve the issues like blocking client screen.

Asynchronous processing means "Fire & Forget"... Just sit back and wait...

In this client sends the request and forget about it. Later it checks whether my request is completed or not.

Because of this waiting at the client-side reduced drastically.

This is the typical flow of Asynchronous processing. Here we are going to talk about the infrastructure provided by Azure for implementing the same.


Reference:
1.  https://docs.microsoft.com/en-us/azure/architecture/patterns/async-request-reply
2.  https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-async-messaging
3.  https://www.c-sharpcorner.com/UploadFile/84c85b/asynchronous-programming-with-C-Sharp-5-0/
4.  https://docs.plm.automation.siemens.com/content/pl4x/18.1/T4EA/en_US/Teamcenter_Gateway-Technical_Connectivity_Guide/synchronous_vs_asynchronous.html

Comments

Popular posts from this blog

Azure based Asynchronous Processing

Azure Infrastructure for Asynchronous Processing This article's main focus is on the infrastructure provided by Microsoft Azure for seamless processing. Article on  Asynchronous Processing  can be found here  ☺️ Microsoft Azure provides us various things for application to work in bits and pieces. It helps in managing long-running processes; Azure provides: Azure Service Bus (Messaging) Topic Queue Storage Queue (Storage) WebJobs Function Apps Service Fabric We'll also try to touch on Microservices. There is one confusing part we need to understand is Queue ... As it is in the Azure Service Bus as well as in the Storage. Azure Service Bus has Topics and Queues. Storage has Table, Blob, File Storage and Queues. The major difference between storage queues and service bus queues is well documented here . In this architecture as well we need an end-point to which consumers will hit and a message will go to a queue, which will be consumed by...