Asynchronous Non-Blocking Microservices Tutorial in Springboot with Java Code Example for Beginners

  Рет қаралды 8,728

codeonedigest

codeonedigest

Күн бұрын

In this video we will learn about Non-Blocking Asynchronous Microservices in Springboot framework using Async annotation with Java coding example.
A non-blocking API for the resources allows calling the resources without waiting for the blocked call such as database access and network calls. If the resources are not available at the time of calling, then it moves to other work rather than waiting for the blocked resources. The system is notified when the blocked resources are available.
** Difference between Blocking & Non-Blocking Microservices **
The synchronous (blocking APIs) block the execution of the thread where they are called until a result is received from the server. The asynchronous (non-blocking) APIs do block, the program can continue its execution. The asynchronous (non-blocking) APIs uses methods with a call-back argument.
** What is Multithreading? **
Multithreading refers to a process of executing two or more threads simultaneously for maximum utilization of the CPU. A thread in Java is a lightweight process requiring fewer resources to create and share the process resources. Multithreading is the ability of a program or an operating system to enable more than one user at a time without requiring multiple copies of the program running on the computer. Multithreading can also handle multiple requests from the same user. Multithreading allows the execution of multiple parts of a program at the same time. These parts are known as threads and are lightweight processes available within the process. So multithreading leads to maximum utilization of the CPU by multitasking.
** What is multithreading in Java? **
In Java, Multithreaded applications execute two or more threads run concurrently. Hence, it is also known as Concurrency in Java. Each thread runs parallel to each other.
** What are worker threads in java? **
Worker thread in Java is a high-priority thread that runs in the foreground. Worker thread is a continuous parallel thread that runs and accepts messages until the time it is explicitly closed or terminated. Messages to a worker thread can be sent from the parent thread or its child worker threads.
** What are the benefits of multithreading? **
1. multithreading Improved throughput.
2. Simultaneous and fully symmetric use of multiple processors for computation and I/O.
3. Superior application responsiveness.
4. multithreading Improved server responsiveness.
5. Program structure simplification.
6. Better communication.
** Multithreading in Springboot **
Multithreading in spring boot is achieved using Async annotation and using Task Executor Service class. Multithreading in spring boot is similar to multitasking, except that it allows numerous threads to run concurrently rather than processes. A thread in Java is a sequence of programmed instructions that are managed by the operating system's scheduler. Threads can be utilized in the background to conduct complex activities without interfering with the main program. It is worth mentioning that a thread shares common memory with other threads across the application, but a process is separate and does not share memory.
** Usage and Advantage of Non-Blocking Microservices **
1. Non-blocking asynchronous microservices can handle very high number requests at the same time.
2. This approach can be used for sudden surge in the incoming request.
** Chapter Timestamps **
0:00 Introduction to Non-Blocking Asynchronous Microservices
1:21 Agenda of this video
3:14 Understanding Parallel Processing
7:02 Understanding Asynchronous processing
9:58 Understanding blocking microservices and challenges
14:58 Explaining Non-Blocking Asynchronous Microservices Solution
17:42 Difference between Blocking and Non-blocking Microservices
19:54 Spring boot Async Annotation explained
20:50 Java code implementation of Non-Blocking Asynchronous Microservices
27:08 Performance Testing of Blocking & Non-Blocking Asynchronous Microservices.
31:10 Usage of Non-Blocking Asynchronous Microservices
32:23 Advantages of Non-Blocking Asynchronous API
33:58 Summary of Non-Blocking Asynchronous API
#asynchrounousapi #nonblockingapi #microservice
** GIT Project Link **
github.com/codeonedigest/asyn...
** CHECK OUT OUR OTHER VIDEOS **
Spring boot Multithreading using Async • Spring Boot Multithrea...
Java Multithreading • Learn Java Multithread...
Spring boot project setup: • Spring boot Project St...
Spring Boot Microservice with postgres database Project: • Spring Boot Microservi...
** CHECK OUR PLAYLISTS **
Spring Boot Complete Tutorial with Multithreading Async • Spring Boot Tutorial w...
Java multithreading • Java Language Tutorial...
** ABOUT OUR CHANNEL **
CodeOneDigest is a youtube channel that produces videos on programming languages, cloud and container technologies, Software design principles, Java frameworks in English languages.

Пікірлер: 43
@codeonedigest
@codeonedigest Жыл бұрын
Full video link kzfaq.info/get/bejne/q9p9orqplr7Honk.html Hello friends, new #video on #asynchronousapi #nonblocking #microservice with #java #coding #examples is published on #codeonedigest #youtube channel. @java #java #awscloud @awscloud @AWSCloudIndia #Cloud #CloudComputing @KZfaq #youtube #azure #msazure #asynchronousapi #asynchronousapicallsinspringboot #asynchronousapiinspringboot #asynchronousapicallsjava #asynchronousapicall #asynchronousapijava #asynchronousapiinnodejs #asynchronousapivssynchronousapi #asynchronousapicallinjava8 #nonblockingapi #nonblockingapicallsinspringboot #nonblockingapiinspringboot #nonblockingapicallsjava #nonblockingapicall #nonblockingapijava #nonblockingapiinnodejs #nonblockingapivssynchronousapi #nonblockingapicallinjava8 #microservices #api #asynchronousmicroservice #asynchronousmicroservicecallsinspringboot #asynchronousmicroserviceinspringboot #asynchronousmicroservicecallsjava #asynchronousmicroservicecall #asynchronousmicroservicejava #asynchronousmicroserviceinnodejs #asynchronousmicroservicevssynchronousmicroservice #asynchronousmicroservicecallinjava8
@santhosh285
@santhosh285 Ай бұрын
Your explanation is very clear. Thank you.
@Chrisbees
@Chrisbees 7 ай бұрын
Very detailed. Thank you
@codeonedigest
@codeonedigest 7 ай бұрын
Thanks for your valuable feedback. Do like share and subscribe our codeonedigest family
@franciskinyuru3459
@franciskinyuru3459 6 ай бұрын
This is a great one bro. Many thanks
@codeonedigest
@codeonedigest 6 ай бұрын
Thanks for your valuable feedback. Do like share and subscribe our channel to grow codeonedigest family.
@vibhorsteele
@vibhorsteele Жыл бұрын
Great video sir!
@codeonedigest
@codeonedigest Жыл бұрын
Thanks Vibhor!! Glad you like it. Kindly subscribe to my channel and do share it with all your friends and colleagues.
@engalibadouin5222
@engalibadouin5222 6 ай бұрын
You really deserver thousands of likes. Thanks you bro
@codeonedigest
@codeonedigest 6 ай бұрын
Thanks for valuable feedback. Do like share and subscribe our channel to grow codeonedigest family
@Satishkumar-rx7oy
@Satishkumar-rx7oy 9 ай бұрын
thanks sir, this is helpful to understand this. Please continue making videos like this. I request you to make videos on kafka.
@codeonedigest
@codeonedigest 9 ай бұрын
Sure will prepare in coming days. Thanks for your valuable feedback. Do like share and subscribe our channel to grow codeonedigest family.
@Maheshwaran-zb9fl
@Maheshwaran-zb9fl 10 ай бұрын
Great sir 😎
@codeonedigest
@codeonedigest 10 ай бұрын
Thanks for your valuable feedback. Do like share & subscribe our channel to grow codeonedigest family
@ankittiwary3712
@ankittiwary3712 9 ай бұрын
great video sir 😍
@codeonedigest
@codeonedigest 9 ай бұрын
Thanks for you valuable feedback. Do like share & subscribe our channel to grow codeonedigest family.
@user-hy4fg9xk7t
@user-hy4fg9xk7t 11 ай бұрын
nice explanation
@codeonedigest
@codeonedigest 11 ай бұрын
thanks for feedback. pls share it with your friend & colleagues and subscribe our channel to grow COD family
@vineettalashi
@vineettalashi 9 ай бұрын
Subscribed sir.
@codeonedigest
@codeonedigest 9 ай бұрын
Thanks
@KuldipGhotane
@KuldipGhotane 11 ай бұрын
It was nice video
@codeonedigest
@codeonedigest 11 ай бұрын
Thanks for your comments. Pls share with friends and subscribe to our channel
@rushikeswararaopolaki3602
@rushikeswararaopolaki3602 9 ай бұрын
Nice video
@codeonedigest
@codeonedigest 9 ай бұрын
Thanks & happy to know that u liked. Kindly like share & subscribe our channel
@codeonedigest
@codeonedigest 9 ай бұрын
Learn spring boot graphql api project with mongo database. Learn graphql schema resolver queries & graphql annotations in springboot kzfaq.info/get/bejne/gKuclq6WzZ_FZXU.htmlsi=dk2z32g7973Neon8
@sujitkumar2196
@sujitkumar2196 2 ай бұрын
Awesome sir can you please share code with us github link is not present in description it would be very appreciated thanks.
@codeonedigest
@codeonedigest 2 ай бұрын
hi sujit, here is the GIT link with the project github.com/codeonedigest/asyncnonblockingmicroservice
@sujitkumar2196
@sujitkumar2196 2 ай бұрын
Awesome tutorial but git hub link is not available can you provide us it would be very helpful.Thanks
@codeonedigest
@codeonedigest 2 ай бұрын
Can you check again? Here is the GIT link. github.com/codeonedigest/asyncnonblockingmicroservice
@VenuGopal-pr1ix
@VenuGopal-pr1ix 8 ай бұрын
HI Sir, Its nice one. Please share the code shown in video for reference. And one question -> Blocking call case same thread th1 take up the request and handle it by sending the response. IN the case of non blocking, Thread th1 takes up new request by handing over the first request's IO call to worker thread.Meanwhile what happen to first user's UI without any response? How the first request's response would be given to user after IO operation is done?
@codeonedigest
@codeonedigest 8 ай бұрын
There are multiple components and sequence of threads processing your request. There are webserver then appservers (multiple instances etc). WebServer are HTTP server like apache etc. They are the first receiver of the request and client UI is connected to WEB Server. WebServer passes that request to AppServer like (tomcat, Jboss etc) where our application is running. In some cases web server and app server are also single entity. The non-blocking behaviour described is for the app server running our application. Web server still maintain the session & connect with the client browser. You can do a quick POC by writing simple apis.
@ankursingh9537
@ankursingh9537 6 ай бұрын
Please share the github url for nonblocking microservice
@codeonedigest
@codeonedigest 6 ай бұрын
Here is the GIT project URL github.com/codeonedigest/asyncnonblockingmicroservice.git
@zakariahossain3455
@zakariahossain3455 3 ай бұрын
You are doing customer getting/saving operation in synchronous manner then whats the benefit of AsyncService here? I am confused.
@codeonedigest
@codeonedigest 3 ай бұрын
Idea is to free app server thread and get the work done by worker threads. We always have limited app server threads 200 max. If 500 request comes at same time then this approach would work well
@fayequehannan2473
@fayequehannan2473 Күн бұрын
What if in response we need to send the asynchronously fetched data as well?..will it free up app server thread in that case instantaneously?
@ankursingh9537
@ankursingh9537 6 ай бұрын
where is the github url for source code ? Please share the github url for source code
@codeonedigest
@codeonedigest 6 ай бұрын
Here is the GIT project URL github.com/codeonedigest/asyncnonblockingmicroservice.git
@lunatichigh2896
@lunatichigh2896 6 ай бұрын
Hi, I just discovered your channel. Do you have a linkedin account so I can repost your content? Greetings from the Philippines
@codeonedigest
@codeonedigest 6 ай бұрын
Yes we are on linkedin and we do publish post and articles
@codeonedigest
@codeonedigest 6 ай бұрын
www.linkedin.com/me?trk=p_mwlite_feed_updates-secondary_nav
@zakariahossain3455
@zakariahossain3455 3 ай бұрын
@@codeonedigest link not found
@codeonedigest
@codeonedigest 3 ай бұрын
@@zakariahossain3455 what link not found??
Каха и суп
00:39
К-Media
Рет қаралды 5 МЛН
One moment can change your life ✨🔄
00:32
A4
Рет қаралды 19 МЛН
Русалка
01:00
История одного вокалиста
Рет қаралды 6 МЛН
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 15 МЛН
Handle 1,000,000 Threads with Java and Spring Boot !!!
21:50
Daily Code Buffer
Рет қаралды 20 М.
Microservices using SpringBoot 3.0 | Full Example [NEW]
1:25:38
Daily Code Buffer
Рет қаралды 172 М.
Synchronous and Asynchronous Communication between Microservices
40:10
Asynchronous Programming in Java using Virtual Threads, Venkat Subramaniam
49:16
Bulgarian Java User Group
Рет қаралды 10 М.
Microservices using SpringBoot | Full Example
1:21:39
Daily Code Buffer
Рет қаралды 1 МЛН
Красиво, но телефон жаль
0:32
Бесполезные Новости
Рет қаралды 996 М.
СТРАШНЫЙ ВИРУС НА МАКБУК
0:39
Кринжовый чел
Рет қаралды 1,1 МЛН
НЕ ПОКУПАЙ СМАРТФОН, ПОКА НЕ УЗНАЕШЬ ЭТО! Не ошибись с выбором…
15:23
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 463 М.