Event-Driven Architecture: How to Optimize POST API in Backend Using Kafka

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 123

  • @sandeepdev0
    @sandeepdev0  3 месяца назад +7

    If you're wondering how data consistency will work in EDA-like we are showing a success message before the data is fully saved to the database-and how the post will become instantly available to others, and what if we have to do some validations like (authentication), you're thinking in the right direction!
    The short answer is: we’ll be using CQRS + a feed service along with some additional components (if needed). These strategies ensure smooth performance and handle scenarios like (validations) user authentication without overwhelming the database, even under high traffic.
    I’ll cover all these topics, including edge cases you might be thinking about, in the upcoming videos of this series. Stay tuned!

  • @zensumarai
    @zensumarai 17 дней назад +1

    bhai dill se maza hi agaya ye practicaly implement kiya to . thanks you very much

  • @diwassati6534
    @diwassati6534 Месяц назад +1

    Grand salute aapko…kya padhaya h bhai….gyan chakshu khol diye🎉🎉

  • @DEVKushal-t8b
    @DEVKushal-t8b 3 месяца назад +7

    When someone teaches you with so much detail and a real eye opening view! Mind opens so widely thank you for the course. Ab se mere post api mhe latency nahi hogi

  • @AjayCoding
    @AjayCoding 3 месяца назад +18

    I appreciate the awesome videos you’ve been putting out. I’m really interested in more content that covers production standards and setting up a CI/CD pipeline, especially with ECS and ECR. There are tons of Docker Compose and Kubernetes videos, but I’d love to see more about scaling and auto-scaling with ECS for production cluster setup. It feels like there’s a bit of a gap in that area.

    • @sandeepdev0
      @sandeepdev0  3 месяца назад +6

      Hi @truth_Taken, thanks for the suggestions, I will definitely make videos on your suggestions specially on AWS.
      Keep suggesting💖

    • @AjayCoding
      @AjayCoding 3 месяца назад

      @@sandeepdev0 ty so much ❤️

  • @rajendraprajapat538
    @rajendraprajapat538 2 месяца назад +5

    Bhai its not 95% users but 95 percentile latency
    and Nice video bhai
    Thanks

  • @AjaySingh-jz8qx
    @AjaySingh-jz8qx 3 месяца назад +7

    Oh my god this is senior js dev level content which is very hard to find on youtube
    Nice bro keep going

  • @DevD-q9c
    @DevD-q9c Месяц назад +1

    Sandeep sir it's amazing that one Indian youtuber teaching latest trend tech stack like honojs bun etc., In future want to more such videos like honojs with full-fledged backend video

  • @shubhamshah9358
    @shubhamshah9358 Месяц назад +1

    halfway into the video, and im loving this so much. Thankyou for this awesome video!

  • @diwassati6534
    @diwassati6534 Месяц назад +1

    All developers should follow you

  • @srikantagrawal6118
    @srikantagrawal6118 3 месяца назад +3

    Hi, just eager to know, how to get test results at 0:42

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      using Grafana k6, To know more about it, you can watch this video:ruclips.net/video/TyktC6sPXn4/видео.html
      IN this video I have shown how you can test your backend using Grafana k6

  • @amwolfox
    @amwolfox 2 месяца назад +2

    Best video ever😊
    Tq for knowledge ❤

  • @diwassati6534
    @diwassati6534 Месяц назад +1

    Subscribed just for the next video …please jaldi banana❤

  • @naruto5437
    @naruto5437 3 месяца назад +1

    bahot badhiya
    eagerly waiting for kafka video

  • @mdalmamunit427
    @mdalmamunit427 2 месяца назад

    Thank you for this insightful video 💙! As a web developer, I found your explanation on optimizing POST APIs with Kafka incredibly helpful.
    Looking forward to more of your content!

    • @sandeepdev0
      @sandeepdev0  2 месяца назад +1

      Glad it was helpful!❣️

  • @abhishek171278
    @abhishek171278 3 месяца назад +2

    Super excited for part 2

  • @w3bpiyush_
    @w3bpiyush_ 3 месяца назад +1

    I appreciate your video bro you are only the youtuber making videos on such topic this are very useful for small developers ❤

  • @sayandotcom
    @sayandotcom 3 месяца назад +3

    Bhaiya apka videos hatke type sa hai, full support ❤❤

  • @Kamlesh20005
    @Kamlesh20005 3 месяца назад +2

    Thanks Sandeep bhaiya ye video banane ke liye 😊

  • @LastNode
    @LastNode 3 месяца назад +1

    Really great tutorial, eagerly waiting to see more such content from you. Thank u sirji..🙏

  • @Just.100x.Piyush
    @Just.100x.Piyush 3 месяца назад +1

    subcribedd serr

  • @DesignWithCode
    @DesignWithCode 3 месяца назад +1

    Bro i was tackling this problem
    thanks man just subscribed you and hit a like button need more content on backend

  • @fullstackcodeacademy
    @fullstackcodeacademy 3 месяца назад +1

    beautiful 😍
    waiting for next lectures ☺️

  • @YagneshAcharya-wu4ih
    @YagneshAcharya-wu4ih 2 месяца назад +1

    waiting for next video

  • @sheikhsaifuddinahmed7375
    @sheikhsaifuddinahmed7375 3 месяца назад +2

    Hi, first of all the really liked the video, but at 12:16 you said we will bulk insert all the blogs collected till now, but here in this case we are giving up on consistency right? for example a user post a blog the producer will push the insert event to the kafka, and the user will get a success message, now this specific blog will get inserted to the db after sometime since we are waiting on a batch of write getting collected.

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Yes and there are methods to maintain consistency, and I specifically told in this video, that we have to ensure consistency to implement this type of backend and will cover how we can maintain consistency, data accuracy, fault tolerance, retry, etc. in upcoming videos...
      but am happy that raised this question... just stay tuned with this series you will get answers of your whole questions...

    • @gautam8469
      @gautam8469 3 месяца назад

      ​@@sandeepdev0when can i expect the next video?

  • @JayeshCholkar-v7v
    @JayeshCholkar-v7v 2 месяца назад +1

    Bhai next video kab aaygi

    • @sandeepdev0
      @sandeepdev0  2 месяца назад +1

      Next video: ruclips.net/video/hZYKchyRlDQ/видео.htmlsi=_FXwlxcZbMqRKRfq
      Next next video: coming soon

  • @pankaj_buddy
    @pankaj_buddy 2 месяца назад

    Please give the Git repo for this project.

  • @SagarPatel-y1n
    @SagarPatel-y1n 3 месяца назад +2

    When we will get part -2 ? We are excited about part 2.

  • @SurajYadav-yd2cu
    @SurajYadav-yd2cu 3 месяца назад +1

    Great video and explanation! Can you tell how do you test the application metrics ? Do you deploy it somewhere or test it on local ? Also which tool are you using ?

  • @Yash-xi3qy
    @Yash-xi3qy 2 месяца назад +1

    Nice content

  • @abhishekushwahaa
    @abhishekushwahaa 3 месяца назад

    Bhai DB ko scale and replication krke nhiii bna skte???? Usse bhi more requests handle ho skti hai

  • @rudrasethi20166
    @rudrasethi20166 2 месяца назад +1

    Hey brother can u just bring more like this .

  • @zendr0
    @zendr0 3 месяца назад +2

    You deserve a sub ❤

  • @radhescript
    @radhescript 28 дней назад

    Sir how to test our APIs

  • @Q-Productions23
    @Q-Productions23 3 месяца назад +1

    Can you please make for other CRUD operations as well?

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Covering this up in upcoming videos, where we will build a fullstack project with Event Driven architecture

    • @Q-Productions23
      @Q-Productions23 3 месяца назад +1

      @@sandeepdev0 Thanks. Appreciate the hard work.

  • @ZaidQureshi-o7m
    @ZaidQureshi-o7m Месяц назад +1

    bhai How you get the traffic details. I mean how can i check the number of traffic my server can handle and how to check the time also like you have shown in the starting of the video

    • @sandeepdev0
      @sandeepdev0  Месяц назад

      I used grafana k6 for testing wiuth virtual users

    • @zaidsheikh3655
      @zaidsheikh3655 Месяц назад

      @@sandeepdev0 Thank you bhai for your reply. Yes I saw your video related to grafana. And one more thing can you please make a video on searching in 1 billion user like search a user by name in 1 billion user records.

  • @yashponam1055
    @yashponam1055 3 месяца назад

    Wouldn’t you need ack that the data was inserted successfully? What if it failed in the consumer? How would producer know?

  • @Harsh-Panwar
    @Harsh-Panwar 2 месяца назад +1

    what is the software name you use to see performance backend server

  • @HarshGupta-di6sx
    @HarshGupta-di6sx 3 месяца назад +2

    Bro how to make validation just like some restriction are there on adding post. Or the post / user email already exists as the event is called later so how will it validate.

    • @rajnishsingh7217
      @rajnishsingh7217 3 месяца назад +1

      This is a real scenario content shared covers only happy scenario. A real world api request goes through multiple proxy calls/ data validations.. and we need to give response based on validation result.

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      will cover cover in upcoming videos,
      but short answer is : using CQRS and feed services

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Bro, in upcoming videos we will cover all possible edge cases, this was just a very basic video...
      Short answer for real scenarios: Using multiple stuff like CQRS, feed services, db sharding, replications and a lot more stuff....
      Everything is coming on this channel that required for real scenario stuff💻👉✅

  • @AkramKhan-ez9lr
    @AkramKhan-ez9lr 3 месяца назад

    which font family are you use in vs code editor.

  • @anuj7286
    @anuj7286 3 месяца назад +1

    Thank you sir ❤

    • @anuj7286
      @anuj7286 3 месяца назад

      Sir can we do both in single application what are the pros and cons?

  • @molviwithskills
    @molviwithskills 3 месяца назад +2

    what if the the server gets down? the messages array will be destroyed... and cannot be entered into Kafka! if we use redis then if there are more then 1 severs then it'll create concurrency over control and it could add the same messages into the DB 3 times! Let's say we use RedLock for redis concurrency control then how can it control the lock in milliseconds? Could you answer it? And please make a video on it! Thanks ❤️

    • @sandeepdev0
      @sandeepdev0  3 месяца назад +2

      you are asking absolutely right questions and am happy you are following the video very closely.
      Short answer of your questions is : 👉CQRS - implemeting this for data consistency + feed service ( for instantly make posts available to other users )
      Making a video on it very soon... stay tuned💖

    • @molviwithskills
      @molviwithskills 3 месяца назад +2

      @@sandeepdev0 ok thanks 🤙🏼

  • @aabhishakemishra
    @aabhishakemishra 3 месяца назад +1

    Great content sir

  • @RockyBhai-ow7yn
    @RockyBhai-ow7yn 3 месяца назад +2

    hi sir .....what about get request like how to handle 150k get request

    • @sandeepdev0
      @sandeepdev0  3 месяца назад +3

      That's super easy - (Just need caching ), but we are using EDA in this video, so to optimize Get request -- Firstly need to understand about data consistency, caching strategies, and little bit more things, -- will do all this stuff in upcoming videos ( after Kafka Crash course )

  • @DeepakKumar-ze8ii
    @DeepakKumar-ze8ii 3 месяца назад +1

    Which tool did you use to test the api latency??

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Grafana k6

    • @jitxhere
      @jitxhere 3 месяца назад

      Can you please share the script?​@@sandeepdev0

  • @jubinsoni4694
    @jubinsoni4694 3 месяца назад +1

    Great video

  • @tamimikbal28
    @tamimikbal28 2 месяца назад

    Hello Sir, Can you please let us know your local dev configuration?
    Because I did try on my laravel app, just a simple API which is just doing a basic validation and no DB connection just return the result but its not even pass 100 users and 500 req per min.
    So, can you describe us in a video or give a touch on comment how can we configure local dev for this testing.
    Thanks video was really helpful.

  • @prashlovessamosa
    @prashlovessamosa 3 месяца назад +1

    thanks sir ji

  • @osama-ki_masi-ki_pota7677
    @osama-ki_masi-ki_pota7677 3 месяца назад +1

    Thanks bhai 😊

  • @harsh-raj-6982
    @harsh-raj-6982 3 месяца назад +1

    Make a video, comparing whatsapp, telegram and signal. Also, make highlights how they work behind the scenes so that users will get a clear picture

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Good idea👍, will work on this...

  • @avijitchanda7944
    @avijitchanda7944 3 месяца назад +1

    Great ❤

  • @RushabhRamani-n1w
    @RushabhRamani-n1w Месяц назад

    Sir how did you calculated that your api can Handel this much of request which tool

  • @JOSIMODDINSHAIKH-q4j
    @JOSIMODDINSHAIKH-q4j 2 месяца назад +1

    Suppose in consumerside any issue occur inserting the data, then how user will get this info about this, bcs you have returned success immediately from producer.

    • @sandeepdev0
      @sandeepdev0  2 месяца назад

      If something went wrong on consumer side, fault tolerence system will do retries(Will discuss this in upcoming videos)
      Also, we will make data instantly available to users, I have shown in this video:
      ruclips.net/video/hZYKchyRlDQ/видео.htmlsi=sgB6robuCQB9_O_M

  • @Just.100x.Piyush
    @Just.100x.Piyush 3 месяца назад +1

    100/10 loveddd it

  • @jitxhere
    @jitxhere 3 месяца назад +1

    Can we use redis instead of Kafka?

    • @shis10
      @shis10 2 месяца назад

      Redis is In memory database. Kafka is distributed event store and stream-processing platform

  • @shrikantpande1437
    @shrikantpande1437 3 месяца назад

    sir mujhe kafka seekhna h from scratch please koi resource bta do net par kuch dhang ka mila nhi

  • @nhgghnbfjjbfe
    @nhgghnbfjjbfe 3 месяца назад

    can you share github repo for this code, I am getting some error so I can briefly see your code

  • @DCSIT-e9r
    @DCSIT-e9r 3 месяца назад

    What about those tasks which needs to synchronous... Like sending OTP... We can't afford the latency, it might be possible ki consumer slow hojaye humara , and we are telling user that yeah we have sent OTP

    • @bhagabanghadai186
      @bhagabanghadai186 2 месяца назад

      In that case create a separate queue and add priority for each message

  • @souvikmajumdar3183
    @souvikmajumdar3183 3 месяца назад +1

    I don't know Kafka coding concept... Please allow me to find..

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      A Kafka crash course is coming in a few days

  • @CosMIcAkaSh1111
    @CosMIcAkaSh1111 3 месяца назад +1

    Yeh video ko samaj nake liye mai kafka sikh kar aya 😂

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      good efforts bhai👍

    • @CosMIcAkaSh1111
      @CosMIcAkaSh1111 3 месяца назад +1

      @@sandeepdev0 yes sirji ar easy lagra hai yrh video or samaj vhi gaya.
      Or sir agar time ho paye to koi real-time application banakar dikha dijiye or ache sai samaj jayengai ham sab .
      Ase topics ki bhot jarurat hai ❣

  • @manuclassy
    @manuclassy 3 месяца назад

    Hi sir😎, Currently i start android development career with kotlin❤, now what should i learn create api with kafka please suggest me😊

  • @mohit84604
    @mohit84604 3 месяца назад +2

    And If i was that care about my backend then i wouldn't have written my backend in node in first place i would have chosen go

    • @sandeepdev0
      @sandeepdev0  3 месяца назад +1

      This is a very vague statement, bro. Choosing between Node.js and Go really depends on the type of app you're building and your specific requirements.
      Netflix uses Node.js
      PayPal uses Node.js
      Uber uses Node.js
      ...and many more companies do as well.
      It's not about whether Go is better than Node.js or vice versa. Every language solves different use cases, and the choice between them depends on your application's needs and use cases.

  • @saigovardhanveggalam
    @saigovardhanveggalam 3 месяца назад

    Please make a course

  • @danielmbazu5644
    @danielmbazu5644 Месяц назад

    I feel this is going to be a nice video but i don't speak or understand Indian language, I wish you can create a blog post on what you're sharing

    • @sandeepdev0
      @sandeepdev0  Месяц назад +1

      Thanks for the suggestion, I'll consider adding blog posts as well!

    • @danielmbazu5644
      @danielmbazu5644 Месяц назад

      @@sandeepdev0 I will very much appreciate it

  • @studyplanet4656
    @studyplanet4656 3 месяца назад

    Sir , how access token are stored in frontend like react . If we store them in localstorage then it will not be safe . Then tell what is the correct way of storing them please guide .

    • @ujjwalsahare8360
      @ujjwalsahare8360 3 месяца назад +1

      cookies mai store karte hai hash karke
      Session mai save karoge to server mai save hota hai

    • @studyplanet4656
      @studyplanet4656 3 месяца назад

      @@ujjwalsahare8360 Thanks buddy for replying , but tell me one thing there will be the issue of CSRF attack as we are using cookies . So in that case we need to use CSRF token as well . Is I am correct or missing something.

    • @rishabhmehta6204
      @rishabhmehta6204 3 месяца назад

      Yes you can generate csrf token to prevent csrf attacks and for xss can go with refresh token and access token pattern so even if he get the access token it will expire in few minutes . And send refresh token with http only so from client side js it can't be accessible .

  • @AjayCoding
    @AjayCoding 3 месяца назад +1

  • @saikatdutta1991
    @saikatdutta1991 2 месяца назад

    But still user is htting the api and waiting for the response... user API call is waiting the bulk insert to be finished. isn't it.. let's say,, the consumer waits for 20s or 1000 events ,, then insert data into db... then 20s is the waiting time for the user..

    • @sandeepdev0
      @sandeepdev0  2 месяца назад

      No, user gets response immediately from Producer, but consumer inserts data as bulk in db.
      Now you may be in doubt that user gets response immediately, but the actual data being saved after some time right.... Well also answered and practically implemented in this video, how to make data instantly available in EDA
      ruclips.net/video/hZYKchyRlDQ/видео.htmlsi=cJPeLFm_vKno5VfB
      But if you are still confused, don't worry, I am planning to do a live stream in couple of days, there I can explain in detailed and if you have any questions you can directly ask in live stream

    • @saikatdutta1991
      @saikatdutta1991 2 месяца назад

      @@sandeepdev0 okay got your point 👍. .
      Now let's say, user calls the api and expects an id of the resource saved in db.. in this case how will the system behave. ?? So, it completely dependent on the api requirement .. can't be generalized

  • @FrontendNerd-lg3oh
    @FrontendNerd-lg3oh 3 месяца назад +1

    How many more videos on this series

  • @simpleguy2020
    @simpleguy2020 3 месяца назад +1

    If we keep Kafka aside and consistency also aside if we are focusing on latency then doing the same bulk insertion logic at the producer level instead of using kafka, will also increase the latency so much right? Kafka is used for asynchronous tasks and consistency right? Can you clarify this doubt

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Yes, doing bulk insertion logic at the producer level will significantly increase the latency because producers will be blocked waiting for database responses.
      Kafka solves this by decoupling the producer from the database, enabling asynchronous handling and smoothing out the load.
      Kafka is also used for event consistency and ordering, but a major benefit is how it helps systems scale with low latency by preventing blocking operations on the producer side

    • @simpleguy2020
      @simpleguy2020 3 месяца назад

      Thank you

  • @devgupta7234
    @devgupta7234 3 месяца назад +1

    Please don't use copilot while teaching it henders learning experience

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      Sure bro, will keep it off in upcoming videos

  • @shubhammantri3550
    @shubhammantri3550 3 месяца назад +1

    abhi subscribe kar leta hu jaldi jaldi baad mai weekend pe binge watch kar lunga wale log please give a heads up

  • @Saath_Chale_toh_Jeetenge
    @Saath_Chale_toh_Jeetenge 2 месяца назад +1

    Pehle nhi bata sakte 7:30

    • @sandeepdev0
      @sandeepdev0  2 месяца назад

      😅My bad, next time se dhyaan rakhunga👍

  • @arunaj815
    @arunaj815 3 месяца назад +1

    bro in english plzzzzzzzzzzzzzzzzzzzzzzzzzz.....................................

    • @sandeepdev0
      @sandeepdev0  3 месяца назад

      I think, I need to start an English channel also

  • @ksreenivas3933
    @ksreenivas3933 3 месяца назад

    English please

  • @soulofjack7294
    @soulofjack7294 3 месяца назад

    you need DDD .

  • @ramgopalvarma5949
    @ramgopalvarma5949 3 месяца назад +1

    Great content