Stateful vs Stateless Applications (Explained by Example)

Sdílet
Vložit
  • čas přidán 11. 06. 2024
  • If you ever wondered the difference between stateless and stateful applications, REST, horizontal scaling versus vertical scaling? We tackle those in a small example. Hope you guys enjoy this quick video. We explain the advantages and disadvantages of each application.
    0:00 Intro
    1:14 Stateful Application
    8:40 Stateless Application
    Online diagram tool used in this video: Http://www.gliffy.com
    Checkout the rest of the content for more software engineering topics by example.
    🏭 Software Architecture Videos
    • Software Architecture
    💾 Database Engineering Videos
    • Database Engineering
    🛰 Network Engineering Videos
    • Network Engineering
    🏰 Load Balancing and Proxies Videos
    • Proxies
    🐘 Postgres Videos
    • PostgresSQL
    🧮 Programming Pattern Videos
    • Programming Patterns
    🛡 Web Security Videos
    • Web Security
    🦠 HTTP Videos
    • HTTP
    🐍 Python Videos
    • Python by Example
    🔆 Javascript Videos
    • Javascript by Example
    Stay Awesome
    -Hussein Nasser
    www.husseinnasser.com
  • Věda a technologie

Komentáře • 316

  • @nikhilbalwani5556
    @nikhilbalwani5556 Před 4 lety +154

    If you were my professor, I would be ready to sit in your lecture for hours. Beautiful explanation

    • @hnasr
      @hnasr  Před 4 lety +9

      Nikhil Balwani im humbled ❤️ thanks

    • @ShoeibShargo
      @ShoeibShargo Před 2 lety +4

      If he were my professor, I would be sitting at FAANG now.

    • @adamgontiersa78
      @adamgontiersa78 Před rokem

      And you would land any job you want, he exolains concerts with simplicity and efficiency

  • @hnasr
    @hnasr  Před 5 lety

    Check out my new video about stateful apps czcams.com/video/EKCM1oQQrCM/video.html

  • @hnasr
    @hnasr  Před 5 lety +4

    Watch the new 2019 video Stateless vs Stateful python 🐍 application code examples czcams.com/video/nhwZn6v5vT0/video.html

  • @zencollector
    @zencollector Před 2 lety +9

    Even 3 years later this explanation is one of the best on the web. Thanks a bunch mate!

  • @hnasr
    @hnasr  Před 2 lety

    Check out my udemy Introduction to Database Engineering course
    database.husseinnasser.com
    Learn the fundamentals of database systems to understand and build performant backend apps

  • @anonymous.youtuber
    @anonymous.youtuber Před 4 lety +24

    Man am I glad I found someone that really knows how to really explain something. Great video ! 👍🙋‍♀️

    • @hnasr
      @hnasr  Před 4 lety +4

      Thank you Claire 🙏 I am glad you enjoyed the content and found it helpful

  • @vishwaskaupvijayananda3900

    This video makes a lot of other web app concepts so much more clearer. Thanks a mil!

  • @matthewspiteri482
    @matthewspiteri482 Před 5 lety +57

    I work full time as a software developer, I stumbled across this while doing some research, and what can I say? you have an amazing character. Well explained :)

    • @hnasr
      @hnasr  Před 5 lety +7

      Matthew Spiteri Thank you so much for your wonderful comment. Glad to see fellow software developers here. Best of luck !

  • @John845
    @John845 Před 3 lety +2

    Been programming over a year and never realized the correlation between REST and Stateless. Mind = blown. THANK YOU.

  • @mollycrime
    @mollycrime Před 4 lety +6

    nice video! i really appreciate videos like this that talk about real concepts/use cases in a simple way that you can watch on down time. keep at it cause it looks like the videos you're making are really cool!

    • @hnasr
      @hnasr  Před 4 lety +1

      mollycrime Thanks! I try to give examples where I can from my personal experience working with a technology. Appreciate it!

  • @ruixue6955
    @ruixue6955 Před 4 lety +54

    2:44
    4:41 introduction to the problem of stateful application
    5:50 problem: impossible to scale up
    6:10
    6:51 stateful with load balancer
    8:36 stateless example
    8:52 Alice is using REST, State transfer
    11:14 server sends Alice a *token*
    11:34 then Alice will send request always with the token

    • @deepak3303
      @deepak3303 Před 2 lety

      wow, indented sub-chapters. CZcams should support MD for comments. 🔥🔥

  • @M1rot1c
    @M1rot1c Před 4 lety +5

    you sounded like u're having a great time explaining this! i can really listen to you speak in a lecture . awesome job!

    • @hnasr
      @hnasr  Před 4 lety +2

      Thanks Shi! And Yes I absolutely enjoy software engineering. Thanks for your comment ❤️

  • @stephaniecrispin674
    @stephaniecrispin674 Před rokem

    This is the best tutorial I have ever seen in my life. I'm awed!.

  • @potaraju92
    @potaraju92 Před 2 měsíci

    I can listen to on any topic you teach, I love your teaching style and voice. I am so glad I came across this channel.

  • @staj
    @staj Před 4 lety +2

    Brilliantly and Concisely explained! Thanks a Lot HN!

  • @potomskazhu
    @potomskazhu Před 2 lety

    dude just thanks, really helped to quickly get a grasp of it

  • @hnasr
    @hnasr  Před 5 lety +27

    Stateful Example: 1:10
    Stateless Example: 8:30
    Stateless vs Stateful pros and cons: 13:30

  • @shreysom2060
    @shreysom2060 Před 3 lety +1

    I am hooked to your videos and as a junior back end developer i am learning a lot seeing things from different perspectives in my job. Thankyou so much

  • @Xardas_
    @Xardas_ Před 2 lety

    It's no longer over my head. Thanks

  • @JS-rz5gx
    @JS-rz5gx Před 2 lety

    Brilliant explanation champ! I've watch about 3 or other videos (each being 2 or 3 times longer) and NOT ONE of them came close to explaining it this comprehensively! Well don and a sub from me!

  • @claushellsing
    @claushellsing Před 4 lety +3

    I'm on a marathon of your videos man. Awesome content

  • @srinidhikulkarni1962
    @srinidhikulkarni1962 Před 2 lety

    This was amazing man!! Loved the way you impart things to the viewers!! High Five!

  • @samuelshoyemi3751
    @samuelshoyemi3751 Před 2 lety

    Plain and simple. Thanks Hussein

  • @shubhambatham49
    @shubhambatham49 Před 4 lety +10

    Sending a long ass token of appreciation all the way from India !! Great & Interesting explanation.Thank you !!

    • @hnasr
      @hnasr  Před 4 lety +12

      Shubham Batham sending a signed and time-stamped response token of love to all my subscribers in india ❤️ passcode to decrypt “stay awesome” thanks for your comment!!

  • @mukulrana1616
    @mukulrana1616 Před 2 lety

    This is the best explaination on youtube

  • @psstream889
    @psstream889 Před rokem

    Your explanation is far more better than my college lecturer

  • @ack377
    @ack377 Před 3 lety

    God bless you sir, when no one could explain me this thing...u did it in such a simple way. And yeah that accent of ur's its awesome....I can listen to your lectures for hours

  • @subramanian121
    @subramanian121 Před 2 lety +1

    Great video Hussein. Thanks for the example.

  • @souravskr
    @souravskr Před 3 lety

    It is worthy of investing 14 minutes of your life. Thanks Hussein

  • @parvezmulla3324
    @parvezmulla3324 Před 3 lety +1

    your channel is a gem!

  • @aminegh8725
    @aminegh8725 Před měsícem

    Thank you very much for your videos , I dare anyone to watch you explaining a concept whatever the complexity of the concept and not understand it ❤❤❤

  • @0xRei
    @0xRei Před 2 lety

    just learned about load balancers too bless you ser!!!!!!!!

  • @noranhany8213
    @noranhany8213 Před 2 lety

    Thank you for simple explanation

  • @tranphunguyen7044
    @tranphunguyen7044 Před 2 lety

    very clear and easy to understand by the excellent explanation. Thank you so much.

  • @viniciosantos
    @viniciosantos Před 2 lety

    I finally understand this! Thank you

  • @harrygeorgiou8518
    @harrygeorgiou8518 Před 3 lety +1

    Very well explained! keep the videos coming!

  • @ducdatnguyen9251
    @ducdatnguyen9251 Před 3 lety +1

    very well explaining, thank you man !

  • @onlyamitava
    @onlyamitava Před 3 lety +1

    You explained nicely.. Thanks a lot.

  • @romanleca4969
    @romanleca4969 Před 5 lety +6

    This is outrageously good. Thank you, mate!

  • @vidyakrishnan1757
    @vidyakrishnan1757 Před 2 lety

    15 mins of awesome ! Thank you !

  • @ayazahamed8254
    @ayazahamed8254 Před 10 měsíci

    Very well explained. Good Job Bro. It clears my concept for stateful and stateless 🌹

  • @lolokj6848
    @lolokj6848 Před 4 lety +1

    Best explain ever..Many thanks

  • @mariusm5187
    @mariusm5187 Před 4 lety +1

    Very helpful video, thank you!

  • @cw5948
    @cw5948 Před 4 lety +1

    Excellent explanation! Good job.

  • @migueljurado6783
    @migueljurado6783 Před 2 lety

    Just amazing explanation bro!

  • @TexAli
    @TexAli Před 4 lety +1

    Thank you for a great explanation

  • @EnochMaheshsilva
    @EnochMaheshsilva Před 2 lety

    Wow ! Simply an amazing explanation, now only I understand what it means 'State Transfer' in ReST, thanks, keep explaining.

  • @natalieschulz7896
    @natalieschulz7896 Před 6 lety +11

    Awesome Video ! Glad I found this - I am VERY NEW to Web Dev and this broke this complex subject down easily :) THANKS

    • @hnasr
      @hnasr  Před 6 lety +1

      Natalie Schulz Glad you find was useful, checkout the rest of the content in the channel where we explain other software engineering topics by example. Cheers :)

  • @verma-kunal
    @verma-kunal Před 2 lety

    Really beautiful explanation !! Thank you so much

  • @fajartris
    @fajartris Před 3 lety

    I enjoyed it, simple and clear explanation.,

  • @mukeshsinghrawat474
    @mukeshsinghrawat474 Před 4 lety +1

    loved it. You made it clear to me. Thanks and yes, I subscribed.

    • @hnasr
      @hnasr  Před 4 lety

      Mukesh Singh Rawat thanks Mukesh! Glad I could help and welcome to the community!! Enjoy the content

  • @sarvesh81s
    @sarvesh81s Před 6 lety +1

    Good Explanation..Thank you

  • @muhammadinshal6216
    @muhammadinshal6216 Před 3 lety

    Just logged in to comment a word of appreciation. Glad I found this channel. Beautiful content

    • @hnasr
      @hnasr  Před 3 lety

      Appreciate it ❤️❤️

  • @joshuawalker7375
    @joshuawalker7375 Před rokem

    Very well made. Thanks for the explanation.

  • @romantsyupryk3009
    @romantsyupryk3009 Před 3 lety

    Thanks so much for this video tutorial.

  • @masonthompson8332
    @masonthompson8332 Před 4 lety

    Nice work, appreciate the overview.

  • @girishtiwari79
    @girishtiwari79 Před 3 lety +1

    Wonderful explanation

  • @mohinimadavi5870
    @mohinimadavi5870 Před 3 lety +1

    Thanks a lot! It was crystal and clear explanation. Easy to understand. Subscribing you!

    • @hnasr
      @hnasr  Před 3 lety

      Thanks for the sub! appreciate you dear enjoy the content

  • @nageshsingh2330
    @nageshsingh2330 Před rokem

    I am from Electrical background still understand it, nice explanation with diagram.

  • @priyamvashi2187
    @priyamvashi2187 Před 5 lety +1

    Nice explanation ..Thank you

  • @batoolal-sulh2165
    @batoolal-sulh2165 Před 4 lety +1

    thank you so much that's so helpful

  • @NAVNEET549
    @NAVNEET549 Před 2 lety

    That's some cool explanation.

  • @denishsubedi3180
    @denishsubedi3180 Před 2 lety

    Very good explanation, i want you to teach a whole class of everything i want to learn!!!!

  • @zenkindo4144
    @zenkindo4144 Před 2 lety

    best teacher man.

  • @JoseBlanquicetM
    @JoseBlanquicetM Před 3 lety

    Hi Hussein, thanks for your channel. I really appreciate the work you are doing on this.
    For this video, I would like to know if in the case of stateful app, is it possible to use an "intelligent" LB such that the requests for a given user go always to the same server. In this way we can also have a cache into the servers for their users given that we know they will always use the same one? Something like consistent hashing?
    Thanks!

  • @kevinmontalvoflores6614
    @kevinmontalvoflores6614 Před 5 lety +3

    Awesome video, I understand most of the good points of stateless, I guess making a web application whether a session is an important concern but not important at scaling we probably would use php session as a way to maintain the session or any other programming that gives us this set of tools. but regarding the we wouldn't scale horizontal, thanks man

    • @hnasr
      @hnasr  Před 5 lety +1

      Kevin Montalvo Flores exactly well said. It is a trade off that you as a software engineer/architect make.

  • @OhWord88
    @OhWord88 Před 4 lety +1

    Your explanation made me feel really "cool" and "lit" because I was able to understand this 😂 Definitely giving this video a like! 👍

    • @hnasr
      @hnasr  Před 4 lety

      Jordan Theisen Jordan you are cool and definitely lit 🔥 thanks for your comment!

  • @othmaneibrahimi6026
    @othmaneibrahimi6026 Před 3 lety

    Very well explained, thank you ;)

  • @vinayaksharma-ys3ip
    @vinayaksharma-ys3ip Před 2 lety

    Great video!!! Thanks a ton Sir!

  • @solracthegreat1002
    @solracthegreat1002 Před 3 lety

    You are a great teacher many thanks!

    • @hnasr
      @hnasr  Před 3 lety

      I try! thank you so much for your lovely comment

  • @KrishAgrawal
    @KrishAgrawal Před 3 lety +6

    Sir, you really explained well. I am a 9th-grade student and I was completely able to understand what you meant.

  • @sumitsharma5537
    @sumitsharma5537 Před 5 lety +1

    Interesting explanation!

  • @hantzleyaudate7697
    @hantzleyaudate7697 Před 6 lety +5

    You’re the man! Great video my dude, the examples were spot on. Are you independent or do you work at a software company?

    • @hnasr
      @hnasr  Před 6 lety +2

      Hantzley Audate thanks buddy for the nice comment! I work at a software company called Esri. I do these videos on the side :) glad you like the content!

  • @stevenhumam2589
    @stevenhumam2589 Před 5 lety +1

    Great Vids and Great explanation , Love From Indonesia

    • @hnasr
      @hnasr  Před 5 lety +1

      Steven Humam thanks! Much love to all my Indonesian subs you guys rock!

  • @emadelhori496
    @emadelhori496 Před 2 lety

    this is amazing channel

  • @jksharma7
    @jksharma7 Před 5 lety +1

    Great..... friend your teaching is very GOOD..... Thanks.

    • @hnasr
      @hnasr  Před 5 lety

      Jk Sharma :) :) glad You like it! Thanks!!

  • @harshad.j3216
    @harshad.j3216 Před 4 lety

    Nicely explained in simple way... with real time login application use case scenario.....

    • @hnasr
      @hnasr  Před 4 lety

      Glad you enjoyed it! I made another video about how Amazon Alexa is stateless maybe you will enjoy that as well czcams.com/video/zhwMv5RxGew/video.html

  • @ore_bear8045
    @ore_bear8045 Před 3 lety

    very good explanation, thanks

  • @ChHammadVEVO
    @ChHammadVEVO Před 3 lety +1

    Oh, man...Wonderful!

  • @CoolBishop1997
    @CoolBishop1997 Před 5 lety +1

    outrageously good l:D like it ! best way to spend my component afternoon at work on something ludicrous lol

    • @hnasr
      @hnasr  Před 5 lety

      Imad Amahmid haha glad I could provide education and entertainment thanks for watching

  • @mukulkopulwar
    @mukulkopulwar Před rokem

    Thank you for this

  • @emjaytripleo
    @emjaytripleo Před 2 lety

    But in a stateful app, the server still has to use cookies to authenticate or recognize the user, and when you meant we have to hit the db every time to query for the token, it sounds pretty bad, but isn't that information also cached somewhere to tie in with the cookie expiry, because if were to really look at it sometime a single page might send around 20 to 30 requests to get different information from a stateless backend(REST) but it cannot afford to authenticate the user 20 times right ?

  • @sagarshekhar6296
    @sagarshekhar6296 Před 4 lety

    Excellent explanation Hussein.....

  • @bilalelmursi4039
    @bilalelmursi4039 Před 3 lety +1

    تسلم علي مجهودك

    • @hnasr
      @hnasr  Před 3 lety +1

      شكرا بلال

  • @NagendraBabutoecrusher
    @NagendraBabutoecrusher Před 6 lety +2

    Good Explanation.. keep up the good work :)

    • @hnasr
      @hnasr  Před 6 lety

      Nagendra Babu thanks dude! Appreciate it

  • @sg7809
    @sg7809 Před 5 lety

    love it..explain so clear

    • @hnasr
      @hnasr  Před 5 lety

      Santosh G glad it was clear to understand! Thanks for your comment

  • @RohitPatnala
    @RohitPatnala Před 2 lety

    Such a cool teacher! :D

  • @mostafahamza2228
    @mostafahamza2228 Před 3 lety

    Thanks very much you are amazing

  • @pswalia2u
    @pswalia2u Před 3 lety +1

    Great explanatio I think nowadays JWT solved the problem of querying db each time we make request.🤔

  • @arijitnagchowdhury3740
    @arijitnagchowdhury3740 Před 5 lety +1

    Thanks for the video -- this is helpful .
    Is oAuth stateless since there we are using token ?

    • @hnasr
      @hnasr  Před 5 lety +2

      Arijit Nag Chowdhury with OAuth2 yes the protocol became easier at achieving statelessness using JWT (Json Web Token) :)

  • @sarcaastech
    @sarcaastech Před rokem

    Done ✔️ thanks for knowledge 🙏

  • @syedshahzaibzafar2422

    great explanation

  • @naderreda2020
    @naderreda2020 Před 2 lety

    Great..... Thank you

  • @gauravvijan03
    @gauravvijan03 Před 5 lety

    Very nicely explained thankyou...

    • @hnasr
      @hnasr  Před 5 lety

      gaurav vijan thanks for your nice comment sir! Glad you enjoyed the video

  • @gabriel-quintiliano
    @gabriel-quintiliano Před 3 měsíci

    Great video!

  • @arioafrashteh6767
    @arioafrashteh6767 Před rokem

    If you replacte the DB and using the same DB replications for the same Microservice replication the statefull-problem will be solved?

  • @raghuvardhansaripalli9636

    Hey Nasser, your video is simply superb. Hatsoff. As your voice is BOLD and STRONG, one thing i visualised you as you will look like "Vin Diesel". By seeing your DP, then i realise you. Take a Bow.God bless you....:-)

    • @hnasr
      @hnasr  Před 3 lety

      Raghu Vardhan Saripalli Raghu 😍😍 thanks my friend

  • @tuck582
    @tuck582 Před 5 lety

    Doesn't something like "Reliable Collections" solve the scaling issue for stateful (at least for Service Fabric devs)?

  • @augustonapuri3152
    @augustonapuri3152 Před 3 lety

    What if we use Sticky connections in the load balancer ? Could it work properly if we scale Stateful applications horizontally ? Putting aside eventually crashes on servers that may not occur frequently.

    • @hnasr
      @hnasr  Před 3 lety +1

      Augusto Napuri that would work and would scale nicely. As you said if the server crash the client will have to login again since they will hit a new server.
      Another disadvantage is if the server is overloaded and latency dropped as a result its difficult to move client to another server in a smooth manner.

  • @tkannab1
    @tkannab1 Před 5 lety

    Great video! Thanks

    • @hnasr
      @hnasr  Před 5 lety

      Toufik Kannab :)