What is an Asynchronous service?

Hussein Nasser · Intermediate ·📊 Data Analytics & Business Intelligence ·7y ago

Key Takeaways

The video discusses the concept of asynchronous services, highlighting their benefits and trade-offs, and explains how they differ from synchronous services, with examples using Node.js, WCF, REST services, and JavaScript, as well as ArcGIS and Geoprocessing tools.

Full Transcript

what's up y'all this is Hussein NASA from I geometry where we discuss software engineering by example and today's topic is true or full asynchronous service so this is a low advanced topic and at actually at a following-up video of another video that we made called a a synchronous versus synchronous client so I do recommend watching that video first to explain what is the difference between synchronous and asynchronous client from the client perspective and then come back to this video to how to know how to build an actual true asynchronous service and we're going to talk about what is that what is exactly an asynchronous service or true a synchronous service what are the advantages and all that cool stuff so stay tuned guys all right if you guys new to my channel obviously consider subscribing I talked about the software engineering concept by example here and there's a lot of software engineering I specialize in GIS in general so geographic information systems so that's my specialty but I'd also talk about other software engineering topics and journal so if you're interested subscribe and hit that bill icon to get notified all right and with that let's get to it all right so let's first explain a synchronous service how it actually works alright and this allows JavaScript code that is this is a client itself right so this code lives in the client whereas I have a service that I have been written someone wrote this service could be node.js could be wfs let me know first w CF sorry w CF windows communication foundation so any rest service essentially that what it does it's very simple it takes a number and it tells you if it's a prime or not obviously this is a very expensive operation right for not not so much four five and six or seven but for huge numbers it takes a lot of computation alright so we want to know so we have author deserves this service exists there at the back end right so you give it a number using it and it tells you that hey this is the prime or not true/false very simple right and we're using a sink a way to make the client asynchronous so this is very that's that's why I recommend watching that video first to really really learn what an asynchronous client verses in synchronous client right so yeah we have an asynchronous client here but the service is still a synchronous right it still still waits for it all right so yeah it's brunch so that's the function that function takes a number and this send request makes a get request very simple and pressing the in equal number and this generator function so waits for you can still execute a little stuff so the UI is unblocked but after a while you get that value right but the client stole really doesn't know what's happening so all he knows all the client knows that hey I send requests I don't know what's happening right it's just like server's processing this thing it didn't give me any answer didn't fail right it didn't give me any any failure so I can try catch and listen to failures but there's no failures there's no progress I can't know anything about this right you make a request and that's it you forget about it you wait for it you have to wait essentially wait in a sense to receive a request from response from the server right you can still do a UI stuff right but you're waiting you're waiting for a result you can't tell the user anything about what's happening oh I have processed 50% I for 60% oh I'm done I'm not done you can't tell how long this is has been done especially with long processing operations and services this is really critical so that's the synchronous service that's the classical service that we alright this is a rest restful service right so you make a request you wait for it then the server doesn't really tell you anything however you can make your code little smaller right too and true asynchronous service so what it does it's it's essentially just little more code at the server level so you would you introduce and instead of just having the wrist as the rest call as Prime the function you add another one which is essentially the jobs concept or or work orders concept of or yeah jobs right so what do you do instead the user the client will make a request to the service is prime but you immediately the service immediately returns a job ID he says hey alright I get you I got you right I got you this number okay I got your request I'm processing it right but here's a job ID it's like it's like this order confirmation number for for a few book and travel if you book a hotel or something right do you want to check and with those guys right so that's this is the same concept essentially so the server will take that request will start executing that prime job price this is I'm gonna execute that but there's the job ID number 888 all right and check with me any any any time I'm gonna tell you more information about that job if you check with me this is okay how can I check with you there you go you can call this rest endpoint that's so different at some point slash job / ID give me the ID and I'll tell you if it's done if it's processing and I'll tell you very cool information a lot of status I can tell you really cool stuff that about your job and just just like that this have become really powerful right this true asynchronous service so that client doesn't have to wait anymore right you can just close the client if you have the job you can persist it in the client and then boot the client again and then restore if their job says hey by the way I just I have this job ID start locally in my in my for Candace's database name I anyway the sequel cycle light sorry yeah this and my sequel light I have this job ID hey server I think I crashed my Chrome has crashed but I have this job ID is is this job done can you tell me more information about that hey yeah sure this job has been still processing you requested this job in this date and this time by this user and it's still processing it's 70% done of the this the prime number you give the number give me it's a huge so I'm still processing a lot of stuff so here's the result but but yeah keep keep checking with me right and you can build the client in a way to to have this function checked job essentially which is makes the requests and poor request and it tells you like the progress in this case I just added the progress and done and you can check that if it's done or not this just essentially a jason responds which tells you really cool information about the job and just like that you can build a true asynchronous service all right so it's sometimes it's really benefit to beneficial to build a true asynchronous service obviously disadvantages you gotta have ready rel you have to write a lot more code is it worth it or not do you even have a huge job that executes at the server sometimes your request is always those like a persistent to the database and you return right but yeah but with that job with the async rest you have to maintain a table or database you have to store your job somewhere right your code has to read those jobs your code has to persist and purge those jobs after like I don't know 120 days you can't keep your jobs forever if they are done right disadvantages but I passed this question to you back to you guys what do you think would you build a true asynchronous service or you were sticking with a synchronous services because nothing wrong with both right you can choose win what do you exactly need and a few few have you built every current servers what is what is your what is your experience with it tell us in the comment section below and an example of a synchronous server is actually out joyas server with geoprocessing tools and this is a very good example where when we use the ArcGIS where is it uses out joyous service server technology with a true asynchronous service so I hope you enjoyed this video guys I hope it makes sense and let us know in the comment section what do you think about this technology or this pattern I'm not at all called technologists and everything is available there but yeah guys let me know I hope you enjoyed this video and I'm gonna see you and then mixed one you guys stay awesome bye bye

Original Description

We know that synchronous client waits until it receives results from the service before it can go on and execute other codes. Asynchronous client makes the request to the service but it moves on and puts a callback or a promise which will be called when the service responds so client can do other UI stuff. So thats synchronous vs asynchronous client. But what is a true asynchronous service? How do we build something like that? What are the benefits of investing in building one? we discuss all of that in this episode. This episode is little advanced and its recommended to watch the asynchronous vs synchronous client video that we made. It all has to do with the asynchronous job resource. ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ⇨ [x] Proxy vs Reverse Proxy  https://goo.gl/ZYFQAi ⇨ [x] Stateful vs Stateless Applications  https://goo.gl/Fubfi6 ⇨ [x] Virtual Machines vs Containers https://goo.gl/fiECVb ⇨ [x] Database ACID - Atomicity https://goo.gl/ER9PPj ⇨ [x] Database ACID - Consistency https://goo.gl/VpLAeN ⇨ [x] Database ACID - Dirty read https://goo.gl/pkB528 ⇨ [x] Database ACID - Phantom read https://goo.gl/rnyzuA ⇨ [x] Database ACID - Non repeatable read https://goo.gl/8kgEjN ⇨ [x] Database ACID - Read uncommitted https://goo.gl/4igWUq ⇨ [x] Database ACID - Read committed https://goo.gl/twgAKL ⇨ [x] Database ACID - Repeatable read https://goo.gl/vDcP6M ⇨ [x] HOW I GREW MY YOUTUBE SUBS TO 2000 WITH A $25 MIC https://goo.gl/cM5VFx ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Hussein Nasser · Hussein Nasser · 52 of 60

1 Extending ArcObjects (IGeometry) - 01 - Getting Started
Extending ArcObjects (IGeometry) - 01 - Getting Started
Hussein Nasser
2 Extending ArcObjects  (IGeometry) - 02 - The Document, The Map and The Layers
Extending ArcObjects (IGeometry) - 02 - The Document, The Map and The Layers
Hussein Nasser
3 Channel Update - New Book, New Job, New Videos
Channel Update - New Book, New Job, New Videos
Hussein Nasser
4 Learn Programming with VB.NET - 01 - Getting Started
Learn Programming with VB.NET - 01 - Getting Started
Hussein Nasser
5 Learn Programming with VB.NET - 02 - Classes and Objects (Part 1)
Learn Programming with VB.NET - 02 - Classes and Objects (Part 1)
Hussein Nasser
6 Learn Programming with VB.NET - 03 - Classes and Objects (Part 2)
Learn Programming with VB.NET - 03 - Classes and Objects (Part 2)
Hussein Nasser
7 Learn Programming with VB.NET - 04 - User Interface
Learn Programming with VB.NET - 04 - User Interface
Hussein Nasser
8 Learn Programming with VB.NET - 05 - By Value v. By Reference
Learn Programming with VB.NET - 05 - By Value v. By Reference
Hussein Nasser
9 Learn Programming with VB.NET - 06 - Variable size, 32 bit vs 64 bit
Learn Programming with VB.NET - 06 - Variable size, 32 bit vs 64 bit
Hussein Nasser
10 Learn Programming with VB.NET - 07 - Conditional Statements
Learn Programming with VB.NET - 07 - Conditional Statements
Hussein Nasser
11 Learn Programming with VB.NET - 08 - Inheritance
Learn Programming with VB.NET - 08 - Inheritance
Hussein Nasser
12 Learn Programming with VB.NET - 09 - Strategy Design Pattern
Learn Programming with VB.NET - 09 - Strategy Design Pattern
Hussein Nasser
13 Learn Programming with VB.NET - 10 -  How did I learn programming
Learn Programming with VB.NET - 10 - How did I learn programming
Hussein Nasser
14 IGeometry 2016 Retrospective - Channel Update
IGeometry 2016 Retrospective - Channel Update
Hussein Nasser
15 Javascript by Example - The Vook
Javascript by Example - The Vook
Hussein Nasser
16 Vlog - Keep your servers close and your database closer
Vlog - Keep your servers close and your database closer
Hussein Nasser
17 Vlog - Client/Server Programming Languages
Vlog - Client/Server Programming Languages
Hussein Nasser
18 Javascript By Example L1E01 - Getting Started
Javascript By Example L1E01 - Getting Started
Hussein Nasser
19 Persistent Connections (Pros and Cons)
Persistent Connections (Pros and Cons)
Hussein Nasser
20 Javascript By Example L1E02 - Building the Calculator Interface
Javascript By Example L1E02 - Building the Calculator Interface
Hussein Nasser
21 Happy new Year from IGeometry!
Happy new Year from IGeometry!
Hussein Nasser
22 Synchronous v. Asynchronous
Synchronous v. Asynchronous
Hussein Nasser
23 Javascript By Example L1E03 - Displaying the Digits on Calculator Screen
Javascript By Example L1E03 - Displaying the Digits on Calculator Screen
Hussein Nasser
24 Show Your Work. Blog, Vlog, Write, Create and Develop!
Show Your Work. Blog, Vlog, Write, Create and Develop!
Hussein Nasser
25 Relational Database Atomicity Explained By Example
Relational Database Atomicity Explained By Example
Hussein Nasser
26 Javascript By Example L1E04 - Operators, All Clear with Arrow Functions
Javascript By Example L1E04 - Operators, All Clear with Arrow Functions
Hussein Nasser
27 What Comes First, User Experience or Software Architecture?
What Comes First, User Experience or Software Architecture?
Hussein Nasser
28 Javascript By Example L1E05 -  Evaluate the Calculator Expressions with eval
Javascript By Example L1E05 - Evaluate the Calculator Expressions with eval
Hussein Nasser
29 Fastest Way to Learn Programming Language or Technology
Fastest Way to Learn Programming Language or Technology
Hussein Nasser
30 Javascript By Example L1E06 -  Fix Leading Zero Bug with Conditions
Javascript By Example L1E06 - Fix Leading Zero Bug with Conditions
Hussein Nasser
31 Stateful vs Stateless Applications (Explained by Example)
Stateful vs Stateless Applications (Explained by Example)
Hussein Nasser
32 Javascript By Example L1E07 - Running our Calculator on the Mobile Phone
Javascript By Example L1E07 - Running our Calculator on the Mobile Phone
Hussein Nasser
33 Advice for New Software Engineers and Developers
Advice for New Software Engineers and Developers
Hussein Nasser
34 Why JSON is so Popular?
Why JSON is so Popular?
Hussein Nasser
35 Building Scalable Software - SLA, HS, VS
Building Scalable Software - SLA, HS, VS
Hussein Nasser
36 Vlog (Istanbul) - Datacenter Proximity
Vlog (Istanbul) - Datacenter Proximity
Hussein Nasser
37 Should Software Engineers Learn Bleeding-Edge Technologies?
Should Software Engineers Learn Bleeding-Edge Technologies?
Hussein Nasser
38 Do Developers Build Bad User Interfaces/Experience?
Do Developers Build Bad User Interfaces/Experience?
Hussein Nasser
39 Learn By Doing.
Learn By Doing.
Hussein Nasser
40 I Wrote Bad Front-End Code That Broke Chrome
I Wrote Bad Front-End Code That Broke Chrome
Hussein Nasser
41 My Story
My Story
Hussein Nasser
42 Vlog - Horizontal vs Vertical Scaling
Vlog - Horizontal vs Vertical Scaling
Hussein Nasser
43 Can User Experience Help Build Better Rest API?
Can User Experience Help Build Better Rest API?
Hussein Nasser
44 Reverse engineering Instagram in flight mode
Reverse engineering Instagram in flight mode
Hussein Nasser
45 The Benefits of the 3-Tier Architecture (e.g. REST API)
The Benefits of the 3-Tier Architecture (e.g. REST API)
Hussein Nasser
46 Stateless v. Stateful Architecture (Podcast)
Stateless v. Stateful Architecture (Podcast)
Hussein Nasser
47 The evolution from virtual machines to containers
The evolution from virtual machines to containers
Hussein Nasser
48 Proxy vs. Reverse Proxy (Explained by Example)
Proxy vs. Reverse Proxy (Explained by Example)
Hussein Nasser
49 Canary Deployment (Explained by Example)
Canary Deployment (Explained by Example)
Hussein Nasser
50 No Excuses
No Excuses
Hussein Nasser
51 Synchronous vs Asynchronous Applications (Explained by Example)
Synchronous vs Asynchronous Applications (Explained by Example)
Hussein Nasser
What is an Asynchronous service?
What is an Asynchronous service?
Hussein Nasser
53 Difference between Client Polling vs Server Push in Notifications
Difference between Client Polling vs Server Push in Notifications
Hussein Nasser
54 Software vs. Hardware AdBlockers (Explained by Example)
Software vs. Hardware AdBlockers (Explained by Example)
Hussein Nasser
55 HTTP Caching with E-Tags -  (Explained by Example)
HTTP Caching with E-Tags - (Explained by Example)
Hussein Nasser
56 Simple Object Access Protocol Pros and Cons (Explained by Example)
Simple Object Access Protocol Pros and Cons (Explained by Example)
Hussein Nasser
57 Nodejs Express "Hello, World"
Nodejs Express "Hello, World"
Hussein Nasser
58 Reverse Engineering Instagram feed
Reverse Engineering Instagram feed
Hussein Nasser
59 Popup Modal Dialog with Javascript and HTML
Popup Modal Dialog with Javascript and HTML
Hussein Nasser
60 MIME and Media Type sniffing explained and the type of attacks it leads to
MIME and Media Type sniffing explained and the type of attacks it leads to
Hussein Nasser

This video teaches the basics of asynchronous services, their benefits and trade-offs, and how to implement them using various tools and technologies, highlighting their importance in data analytics and client-server architecture.

Key Takeaways
  1. Make a request to the server
  2. Introduce a job ID immediately after receiving a request
  3. Store the job ID and update the client on the status of the job
  4. Persist the job ID and check on the status of the job even after the client has crashed or restarted
  5. Write more code to maintain a database to store job IDs and purge them after a certain period of time
💡 Asynchronous services can be beneficial when dealing with large jobs that execute at the server, but they require more code and maintenance to store and purge job IDs.

Related Reads

Up next
SQL Interview Question on Retention. #sql #dataanalytics #datascience
Rajeev Kanth | BEPEC
Watch →