Fireship · @fireship

Redis in 100 Seconds

Uploaded July 8, 2021 · Length 2:26

Redis in 100 Seconds

Summary

redis database explained: in-memory, multi-model, sub-millisecond latency, durable, cache, primary database

  • redis database
  • in-memory database
  • multi-model database
  • cache layer
  • primary database

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    redis an in-memory multi-model database

  2. 0:03

    famous for its sub-millisecond latency

  3. 0:05

    it was created in 2009 based on the idea

  4. 0:08

    that a cache can also be a durable data

  5. 0:11

    store

  6. 0:11

    around this time apps like twitter were

  7. 0:13

    growing exponentially and needed a way

  8. 0:15

    to deliver data to their end users

  9. 0:16

    faster than a relational database could

  10. 0:18

    handle

  11. 0:19

    redis which means remote dictionary

  12. 0:20

    server was adopted by some of the most

  13. 0:22

    heavily trafficked sites in the world

  14. 0:24

    because it changed the database game by

  15. 0:26

    creating a system where data is always

  16. 0:28

    modified or read from the main computer

  17. 0:30

    memory

  18. 0:31

    as opposed to the much slower disk but

  19. 0:33

    at the same time

  20. 0:34

    it stores its data on the disk so it can

  21. 0:36

    be reconstructed

  22. 0:37

    as needed which means the database is

  23. 0:39

    fully durable supporting things like

  24. 0:40

    snapshots and backups every data point

  25. 0:43

    in the database is a key

  26. 0:44

    followed by one of many different data

  27. 0:46

    structures like a string

  28. 0:48

    list hash or stream so you can store

  29. 0:50

    data naturally just like you would with

  30. 0:52

    your favorite programming language as

  31. 0:53

    opposed to squeezing it into a bunch of

  32. 0:55

    tables or json documents

  33. 0:57

    interacting with the database is handled

  34. 0:59

    with a simple set of commands

  35. 1:00

    like set followed by a key and value to

  36. 1:03

    create data

  37. 1:04

    then git followed by a key to read data

  38. 1:07

    historically

  39. 1:08

    redis has been described as a key value

  40. 1:10

    store and is often used as a cache to

  41. 1:12

    make relational databases faster at

  42. 1:14

    scale

  43. 1:14

    but here's where your mind is about to

  44. 1:16

    be blown redis is perfectly suitable as

  45. 1:18

    a primary database

  46. 1:19

    and can dramatically reduce complexity

  47. 1:21

    because making things go fast at scale

  48. 1:23

    is the primary cause of complexity in

  49. 1:25

    the first place with redis your database

  50. 1:27

    is already fast

  51. 1:28

    no need for a complex caching layer but

  52. 1:31

    you might be wondering

  53. 1:32

    how do i model complex relationships

  54. 1:34

    today redis is what you would call

  55. 1:35

    a multi-model database supporting a

  56. 1:38

    variety of different database paradigms

  57. 1:39

    with

  58. 1:40

    add-on modules that you can opt into as

  59. 1:42

    needed if your data contains

  60. 1:43

    relationships bring in redis graph

  61. 1:45

    and query it with cipher or use the json

  62. 1:47

    module to structure your data as a

  63. 1:49

    hierarchy

  64. 1:50

    just like a document-oriented database

  65. 1:52

    then use the search module

  66. 1:54

    to turn your database into a full text

  67. 1:55

    search engine and it even has modules

  68. 1:57

    for ai workloads time series data