Fireship · @fireship

Kafka in 100 Seconds

Uploaded January 10, 2023 · Length 2:35

Kafka in 100 Seconds

Summary

kafka explained in 100 seconds: a distributed event streaming platform for real-time data.

  • kafka
  • event streaming
  • apache kafka
  • real-time data
  • data pipelines

Transcript preview

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

  1. 0:00

    Apache kofka a distributed event

  2. 0:02

    streaming platform that can scale

  3. 0:04

    massive pipelines of real-time data it

  4. 0:06

    was created in 2011 at LinkedIn written

  5. 0:09

    in Java and Scola and named kofka

  6. 0:11

    because it's a system optimized for

  7. 0:13

    writing let's imagine using it to build

  8. 0:14

    a dashboard like Google analytics when

  9. 0:17

    an event occurs like a website visit the

  10. 0:19

    producer API creates a new record these

  11. 0:22

    records are stored to disk in an ordered

  12. 0:24

    immutable log called a topic which can

  13. 0:27

    persist forever or disappear when no

  14. 0:29

    longer needed top are distributed and

  15. 0:31

    replicated in a cluster which contains

  16. 0:33

    multiple servers called Brokers this

  17. 0:35

    makes kofka fault tolerant and able to

  18. 0:37

    scale to any workload on the other side

  19. 0:39

    multiple consumers can subscribe to this

  20. 0:42

    data they can read the most recent

  21. 0:43

    message like AQ or read the entire topic

  22. 0:46

    log and listen to updates in real time

  23. 0:48

    in addition it provides a very powerful

  24. 0:50

    streams API that can transform and

  25. 0:53

    aggregate these topics before they ever

  26. 0:54

    reach the consumer this all may sound

  27. 0:56

    similar to message Brokers like rabbit

  28. 0:58

    mq but kofka can handle more throughput

  29. 1:01

    and is ideal for streaming data

  30. 1:03

    applications for example it's used today

  31. 1:05

    by companies like Lyft to collect and

  32. 1:07

    process geolocation data Spotify and

  33. 1:09

    Netflix for log processing and

  34. 1:11

    cloudflare for real-time analytics to

  35. 1:14

    get started download it and use a tool

  36. 1:16

    like zookeeper or Kraft to manage your

  37. 1:18

    cluster now in one terminal start

  38. 1:20

    zookeeper then in the other start the

  39. 1:22

    kofka server with the environment up and

  40. 1:24

    running we can now create our first

  41. 1:25

    topic remember a topic is just a log of

  42. 1:28

    events kept in order in an event will

  43. 1:30

    have a key value and timestamp and may

  44. 1:33

    also contain optional metadata and

  45. 1:34

    headers now let's use this command to

  46. 1:36

    publish an event to the topic where

  47. 1:38

    every line represents a different event

  48. 1:40

    and now these events are written to a

  49. 1:42

    topic which is stored durably and

  50. 1:44

    partitioned in the cluster cofa

  51. 1:46

    guarantees that any consumer of a given

  52. 1:48

    topic will always read the events in the

  53. 1:50

    exact same order now with this command

  54. 1:51

    we're able to consume the topic by

  55. 1:53

    default it will give us the latest event

  56. 1:55

    although we can use the from beginning

  57. 1:57

    flag to read the entire log it's also

  58. 1:59

    Poss to provide an offset to read a