Why is Redis so FAST

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • Get our 158-page System Design PDF for free by subscribing to our weekly newsletter: bit.ly/bytebyt...
    Animation tools: Adobe Illustrator and After Effects.
    Checkout our bestselling System Design Interview books:
    Volume 1: amzn.to/3Ou7gkd
    Volume 2: amzn.to/3HqGozy
    The digital version of System Design Interview books: bit.ly/3mlDSk9
    ABOUT US:
    Covering topics and trends in large-scale system design, from the authors of the best-selling System Design Interview series.

КОМЕНТАРІ • 150

  • @dra4394
    @dra4394 2 місяці тому +98

    I just love that watching this topic the he says "the last one is a bit unintuitive" while different types of videos would say "the last one is crazy!"

    • @omertaprimal6913
      @omertaprimal6913 Місяць тому +1

      A true intellect

    • @YTacc-n4
      @YTacc-n4 21 день тому

      he definietly read the influencer handbook audience retention chapter

  • @aldanasjuan
    @aldanasjuan 6 місяців тому +388

    let cache = {} //in memory cache 😅

    • @doyouwantsli9680
      @doyouwantsli9680 5 місяців тому +72

      Yep. You just beat redis in one line.

    • @egor.okhterov
      @egor.okhterov 5 місяців тому +51

      This is great implementation as long as you are running single program on a single machine:)

    • @yeahyeahduderooski
      @yeahyeahduderooski 5 місяців тому +2

      lol done this. So much easier

    • @justiceessiel6123
      @justiceessiel6123 4 місяці тому +5

      You haven't had heap issues due to garbage collection

    • @aldanasjuan
      @aldanasjuan 4 місяці тому +16

      @@justiceessiel6123 Honestly, I've only done this with static data, like a list of things that won't change much so it's been fine. It's been working in production for 2+years and now it's working in a clustered environment too. I wouldn't do this for large, dynamic data.

  • @gus473
    @gus473 6 місяців тому +65

    You're getting very good at these rapid explanations! Thanks! 😎✌️

  • @snake3837
    @snake3837 6 місяців тому +163

    Redis is „trying” to implement threads but because it wasn’t designed for that from get go so it’s very hard. It has been years. Dragonfly is redis compatible reimplementation with multithreading and is much more faster.

    • @aviadshalom66
      @aviadshalom66 6 місяців тому +21

      if memory serves, there was a memtier test between the two. Redis won.
      you lack of knowledge of an optimal Redis deployment, for example your assumption is that we are using one instance of Redis process per machine, this is far from true (there is roughly 1 redis process per core in an ideal deployment)
      good luck

    • @GreatTaiwan
      @GreatTaiwan 5 місяців тому +18

      @@aviadshalom66in your production do u guys get memory for free ?
      Dragonfly has an inherently smaller memory usage for the same dataset. Dragonfly is faster at both loading the dataset and producing the snapshot. Dragonfly's memory usage does not grow during the snapshotting process, whereas Redis almost doubles its RAM requirements.

    • @kavinho
      @kavinho 5 місяців тому +5

      @@aviadshalom66you can’t share memory between OS processes only between threads within same process. Meaning each process would need to keep own of the cache data causing inefficiencies and limit usability of system memory. A distributed cache cluster is of course possible but that’s different and can still cause inefficiencies if multiple nodes run on the same physical hardware.

    • @radiantveggies9348
      @radiantveggies9348 3 місяці тому +7

      ​@@aviadshalom66 Junior level take

    • @caedenw
      @caedenw 2 місяці тому +2

      @@kavinhonever heard of mmap?

  • @RyanWaite28
    @RyanWaite28 4 місяці тому +22

    Redis is basically the JavaScript of databases.

    • @Blast-Forward
      @Blast-Forward 2 місяці тому +2

      It is the Linux Live of OSes.

  • @wowLaLaLa
    @wowLaLaLa 5 місяців тому +8

    redis stability sucks with large volume data. we have ton of redis usage and we know how unstable when running in kubernetes pods with hundreds of parallel transactions happens. similar operation on postgresql is great.

    • @shadowpwls3
      @shadowpwls3 Місяць тому +8

      You are not supposed to store a lot of data. You're supposed to store data that you only need to access really fast.

  • @andrewfarrell1816
    @andrewfarrell1816 4 місяці тому +6

    Skiplists are under appreciated

    • @caedenw
      @caedenw 2 місяці тому

      maybe but aa-trees definitely are

  • @obscure8125
    @obscure8125 Місяць тому +3

    Basically how JS implements Non-Blocking IO in its REPL, a lot of languages are talking notes from the single threaded style of execution.

  • @XXFlyer1989XX
    @XXFlyer1989XX 5 місяців тому +1

    Brilliant explanation. Thanks!

  • @srsh12345
    @srsh12345 20 днів тому

    thank you for the explanation

  • @vasilyzorin2537
    @vasilyzorin2537 4 місяці тому +10

    Redis is slow. Dragonflydb is fast.

  • @emotional_stuff
    @emotional_stuff 19 днів тому

    Bro, you are GEM!

  • @muzzletov
    @muzzletov 2 місяці тому +2

    also, threads are slow due to the necessary memory allocation associated with a thread. this is a reason why you keep thread pools.

  • @estebanigancio58
    @estebanigancio58 5 місяців тому +1

    if you think Redis is fast then Aerospike is going to blow your mind

  • @RyanWaite28
    @RyanWaite28 4 місяці тому +9

    So basically JavaScript’s async event loop technique.

    • @youtubeacc666
      @youtubeacc666 4 місяці тому +3

      Yeah like u know everything 😂

  • @NarendraChennamsetty
    @NarendraChennamsetty 6 місяців тому +12

    great nugget on redis. Thanks! how did you create these graphics btw?

  • @da40au40
    @da40au40 6 місяців тому +8

    Man i love what you are doing. I
    have a question and a request.
    1: where can I get your free system design ebook please?
    2: please do a video on threads, processes, heaps, and stacks whenever you can.

    • @sourandbitter3062
      @sourandbitter3062 6 місяців тому

      I think there's an Amazon link to the book in the description

    • @rahul169sharma
      @rahul169sharma 6 місяців тому

      ​@@sourandbitter3062 description? Where?

    • @rahul169sharma
      @rahul169sharma 6 місяців тому

      ​@@sourandbitter3062also it's not free on amazon

    • @rustix3
      @rustix3 6 місяців тому +3

      @@rahul169sharmaOn the video in the bottom right there is a button with vertical 3 dots. Click it, and you will see a menu, the first option is "Description".

    • @idahodz
      @idahodz 6 місяців тому

      ​@@rahul169sharma
      blog.bytebytego.com/p/free-system-design-pdf-158-pages

  • @SPimentaTV
    @SPimentaTV 6 місяців тому

    What an amazing video!

  • @PieJee1
    @PieJee1 6 місяців тому +2

    make sure your server has enough memory or your OS will store it in the file system by using temporary files :)
    The other way around is also the case: if you keep loading the same file and you have enough memory the OS will load the file in memory to avoid reading it from file system.
    So Redis works to make it simpler for a developer/devops to not think about it

  • @oleksandrkhivrych6349
    @oleksandrkhivrych6349 5 місяців тому

    The best content ❤

  • @jjophoven
    @jjophoven Місяць тому +1

    all programming languages store variables in RAM

  • @RickySupriyadi
    @RickySupriyadi 19 днів тому

    dude should pin comment with full video link on top

  • @IvaneMkadegebeli
    @IvaneMkadegebeli 2 місяці тому

    The passion mixed with sexuality in his emotions in this man drives me study software engineering more and more!

  • @atsanonwadsanthat166
    @atsanonwadsanthat166 5 місяців тому

    Cue Salesforce using it and effing it up.

  • @VaurionX
    @VaurionX 6 місяців тому +1

    Very good explanation!

  • @doyouwantsli9680
    @doyouwantsli9680 5 місяців тому +4

    Imagine trying to sell being single threaded as something good. At best, it can be not so bad.

  • @rishiraj2548
    @rishiraj2548 Місяць тому

    great thanks.

  • @jacobscheit4128
    @jacobscheit4128 5 місяців тому +1

    Well you left out the biggest issue with Redis. The lack of scalability.
    You can’t scale what you can only run on one thread. But only a Software Developer could call the biggest flaw a feature while every System Integrator is calling it the lack of Hardware understanding!

    • @khalilmohammadmirza4070
      @khalilmohammadmirza4070 4 місяці тому +1

      Plenty of companies use redis at scale.
      Plenty of companies use NodeJs at scale.
      Both have single thread architecture.

    • @jacobscheit4128
      @jacobscheit4128 4 місяці тому

      @@khalilmohammadmirza4070 and how dose that work for them? I can tell you, not so good!

    • @jacobscheit4128
      @jacobscheit4128 4 місяці тому

      @@khalilmohammadmirza4070 Plenty of Companies use Microsoft because someone started doing it, that doesn’t mean it was a good idea or that it works particularly good. It only means it works not that it’s good.

    • @khalilmohammadmirza4070
      @khalilmohammadmirza4070 4 місяці тому

      @jacobscheit4128 dotnet is the fastest common web framework. Consistently in top 10 in techempower ranking. Using Microsoft has a lot of pros like easier access to Microsoft and Windows ecosystem, very fast server, cross platform development and deployment.
      Also, how did Microsoft come into this discussion of single thread architecture.

  • @davidlepold
    @davidlepold 6 місяців тому +1

    Comparison memcached and redis in terms of speed (not vatility)

  • @blarghblargh
    @blarghblargh 6 місяців тому +8

    "why is redis so fast?" due to the exploitation of open source labor

  • @DamBlairFam
    @DamBlairFam Місяць тому

    I just want 64GiB of L1 cache.. lockable and hardware encrypted.

  • @jayleejw1801
    @jayleejw1801 Місяць тому

    Ofcourse it’s fast, it’s just using some in memory efficient data structure, it’s like comparing memory access vs disk access (persistent storage). You don’t compare an apple to orange

  • @MyCodingDiary
    @MyCodingDiary 6 місяців тому +2

    Consider me a loyal subscriber. Your content is top-notch!

  • @fat3d
    @fat3d 6 місяців тому +3

    Not open source anymore, use KeyDB.

    • @nitkarshchourasia2406
      @nitkarshchourasia2406 5 місяців тому

      Really?

    • @fat3d
      @fat3d 5 місяців тому

      @@nitkarshchourasia2406 yes, they switched its licensing from an open source BSD license to both a Source Available License and a Server Side Public License (SSPL).

    • @ShivamJha00
      @ShivamJha00 5 місяців тому

      ​@@nitkarshchourasia2406yep. They changed their license. Now they are only "source available"

    • @OlegKorsak
      @OlegKorsak 5 місяців тому

      keydb has no helm chart

  • @radiantveggies9348
    @radiantveggies9348 3 місяці тому

    Nice video

  • @profjoaogabriellima
    @profjoaogabriellima 5 місяців тому

    Excellent! Btw, how do you create the animated diagrams? Amazing

  • @nonarKitten
    @nonarKitten 5 місяців тому +2

    You and I have wildly different ideas of what "fast" means.

    • @Akrob55555
      @Akrob55555 3 місяці тому

      What do you mean?

    • @nonarKitten
      @nonarKitten 3 місяці тому

      @@Akrob55555 one afternoon I rewrote a mini-Redis that was an order of magnitude faster. And it was in TypeScript.

    • @Akrob55555
      @Akrob55555 3 місяці тому

      @@nonarKitten And then you woke up.

    • @nonarKitten
      @nonarKitten 3 місяці тому

      @@Akrob55555 not at all, I still have the source. I called it 'jedis' and we used it to backend the connection state for a remote client system. Took a little more than a day to debug and flesh out, but it worked really well because we only used a subset anyway.

    • @nonarKitten
      @nonarKitten 3 місяці тому

      @@Akrob55555 we later ported that code into Go, because it's better at handling threading, that's when performance really took off.

  • @AloisMahdal
    @AloisMahdal 5 місяців тому +2

    Wait, what's this redis thing you are talking about? don't you mean Valkey?

    • @doyouwantsli9680
      @doyouwantsli9680 5 місяців тому

      Lmao. Yeah but just make a dict/object and spare yourself the dependency and mess

  • @JamesFreeman
    @JamesFreeman Місяць тому

    To bad that company stole redis from the maintainer

  • @Cheesecake99YearsAgo
    @Cheesecake99YearsAgo 4 місяці тому +3

    How do you create the animation?

  • @MrBigbanan
    @MrBigbanan Місяць тому

    Yes.

  • @nosaanthony7310
    @nosaanthony7310 2 місяці тому

    Same concept as NodeJs

  • @gro967
    @gro967 4 місяці тому

    Redis is actually not lightning fast, it is one of the slowest k/v stores out there currently, cause it’s single threaded 😂

    • @leiregyp5814
      @leiregyp5814 4 місяці тому

      im guessing you didnt watch the video

  • @grugbrain
    @grugbrain 6 місяців тому +1

    How about running multiple redis servers, to mimic multiple threads?

    • @MrC0MPUT3R
      @MrC0MPUT3R 6 місяців тому +4

      There's a concept called clustering which can get you some of the benefits you're thinking about, but it's most useful for high availability or keeping your data available if one or more nodes go offline.
      You can get a read speed boost by distributing reads to all the nodes but writes still have to be handled by a primary node for consistency and then synchronized to the others.

    • @DaVinc-hi7hd
      @DaVinc-hi7hd 5 місяців тому

      node balancing ?

  • @AndersonPEM
    @AndersonPEM 5 місяців тому +1

    KeyDB be like: Poser!

  • @user-qr4jf4tv2x
    @user-qr4jf4tv2x 6 місяців тому

    i prefer rocksdb KeyDB

  • @MehranGhamaty
    @MehranGhamaty 6 місяців тому

    There are a few other redis drop in replacements which are slightly faster in different scenarios.
    Either way drop in replacements make everybody’s lives easier if you ever have performance issues.

    • @dputra
      @dputra 6 місяців тому

      Can you recommend one for windows os?

  • @StanleySathler
    @StanleySathler Місяць тому

    So wait - when it receives the requests, it sends that request do the Event Loop? What in that diagram reads from the Event Loop and processes the requests?

  • @goldfinch5522
    @goldfinch5522 Місяць тому

    How such animation are made ?

  • @pokerface7840
    @pokerface7840 16 днів тому

    Yes

  • @CielMC
    @CielMC 6 місяців тому

    Sorry where do I grab the free book?😅

  • @neonmidnight6264
    @neonmidnight6264 12 днів тому

    Redis is the slowest Redis implementation 😂 Garnet and Dragonfly are faster

  • @unl0ck998
    @unl0ck998 6 місяців тому

    Do you have a merch store with the systems design graphics in posters/hoodies?

  • @X-factor6
    @X-factor6 11 днів тому

    How do they make this animation?

  • @maskman4821
    @maskman4821 5 місяців тому

    Awesome ❤

  • @abhishekpaul6094
    @abhishekpaul6094 6 місяців тому +2

    Small suggestion: ALWAYS USE SUBTITLES. Period.

  • @AyushKumarSingh-e1g
    @AyushKumarSingh-e1g 2 місяці тому

    How can I get the ebook

  • @lymankkox6202
    @lymankkox6202 6 місяців тому

    Alex, my Dev Monk

  • @crazycatlady.
    @crazycatlady. 2 місяці тому

    Does it ever overloads a computer’s RAM? Sorry if the questions is dumb,I am not a techy person.
    But wondering if someone searches loads of complex queries a day and then searchers for them again but slightly different, how will ri process it? Storing a brand new search or adapting the old one?
    Sorry again! lol but trying to understand this thing here

  • @raulzhou_
    @raulzhou_ 5 місяців тому

    Beautiful

  • @fabio.1
    @fabio.1 6 місяців тому

    Is there any lock in the multiple inputs?

  • @salimbeddar8569
    @salimbeddar8569 6 місяців тому +3

    wich software did you use for the animation in this vid?

    • @slvdr510
      @slvdr510 6 місяців тому

      x2

    • @salimbeddar8569
      @salimbeddar8569 6 місяців тому

      @@slvdr510 can you give me the link to download it

    • @kaushalagrawal6258
      @kaushalagrawal6258 6 місяців тому

      not Redis

    • @salimbeddar8569
      @salimbeddar8569 5 місяців тому

      @@slvdr510 can you reply?

    • @salimbeddar8569
      @salimbeddar8569 5 місяців тому

      @@kaushalagrawal6258 what is the name of the software used to make this animation

  • @legobuildingsrewiew7538
    @legobuildingsrewiew7538 6 місяців тому

    How do I get the book?

  • @terrytorres5026
    @terrytorres5026 6 місяців тому

    How is it much faster than a 3k solid state partioned or indexed disk?

    • @elirane85
      @elirane85 4 місяці тому

      Cause RAM is still much much faster then SSD. Otherwise we wouldn't have a need for RAM memory in our computers ;)

  • @razvancomsa2276
    @razvancomsa2276 6 місяців тому

    What if Redis stored data in the GPU memory ? Would that be even faster ?

    • @呀咧呀咧
      @呀咧呀咧 6 місяців тому +1

      No, the latency will be much higher

  • @VishnuVijai_
    @VishnuVijai_ 5 місяців тому

    Link to system design big archive book?

  • @lukash5048
    @lukash5048 6 місяців тому

    So it doesn't use all cores but all ram of my server?

  • @pashutaz
    @pashutaz 5 місяців тому

    Link is broken (

  • @dongyan8717
    @dongyan8717 6 місяців тому

    How do I become a master at data stuff

    • @aiueo8962
      @aiueo8962 6 місяців тому +2

      Learn

    • @dongyan8717
      @dongyan8717 6 місяців тому

      @@aiueo8962 I can learn but what’s the best way to practice so I can upgrade my job?

    • @blarghblargh
      @blarghblargh 6 місяців тому

      practice

  • @olivierginiaux7466
    @olivierginiaux7466 6 місяців тому +2

    Redis is slow af

  • @Mrchingchingdingding
    @Mrchingchingdingding 5 місяців тому

    Can this be used in game development to optimize complex game object interactions between mutable objects?

    • @snehanshuphukon728
      @snehanshuphukon728 5 місяців тому +1

      No, it is better for multi instance server software. Maybe useful for game server.

  • @Hafthor
    @Hafthor Місяць тому

    Why he is talking like michio kaku ? Is that cause he is Asian?

  • @changtimwu
    @changtimwu 5 місяців тому

    cool! your diagrams now get animated! could you please at least give us a clue?

  • @youtubeacc666
    @youtubeacc666 4 місяці тому +1

    I did not understand a single word

  • @WabuhWabuh
    @WabuhWabuh 4 місяці тому

    it is as if they engineered the most hard to listen to person & made him a teacher...

  • @talgis4169
    @talgis4169 6 місяців тому +1

    😂😂😂 CouchbaseDB or ScyllaDB, not Redis 😂😂😂

  • @chutiyauma
    @chutiyauma 6 місяців тому

    System design

  • @SPimentaTV
    @SPimentaTV 6 місяців тому

    What an amazing video!