SlideShare a Scribd company logo
ES & Kafka
Diego Pacheco
ES/CQRS
#1 Reason why we need ES == Microservices
No Places, RAW Events.
Immutability == Append ONLY
Segregation == Scalability
ES
Persists RAW
EVENTS.
When there are
mutations, NEW
events are created.
CQRS
IT's about scaling
READ and
WRITES, basically
in different
RELATIONAL
DBS.
CQRS / ES :: Design
CQRS / ES :: Design
KAFKA
7 Trillion
messages per day.* 2019 numbers
Use Cases
❏ Messaging
❏ Web site tracking activity
❏ Metrics
❏ Stream Processing
❏ Event Sourcing
❏ Commit Log
Performance
❏ 2M writes per second
❏ Intel Xeon 2.5 GHz processor with six cores
❏ Six 7200 RPM SATA drives
❏ 32GB of RAM
❏ 1Gb Ethernet
❏ Single producer thread, no replication
❏ 821,557 records/sec
❏ (78.3 MB/sec)
❏ End-to-end Latency
❏ 2 ms (median)
❏ 3 ms (99th percentile)
❏ 14 ms (99.9th percentile)
Performance
Performance
Kafka: Numbers at LinkedIN 2019/Q1
Kafka: As ES Solution
Kafka
Kafka
Topics & Partitions
❏ Topic = Category or Field Name where records are published.
❏ Zero, 1 or Multiple-subscribers.
❏ Each topic has a partitioned log (partitions).
❏ Each Partition:
❏ Ordered
❏ Immutable
❏ Continually appended
❏ Unique Sequential ID called *offset*
❏ Kafka cluster durable persit all logs (no matter if consumed or not)
❏ Kafka persist published records for period of time(configured retention)
❏ Kafka cluster performance is equivalent constant of data size.
❏ Storing data for a long time is not a problem.
❏ Consumer need to keep track of offset.
❏ Consumer can consume records in any order.
❏ Partition on log enable scaling beyond a single server size.
❏ A Topic may have any partitions so it handle arbitrary size of data.
❏ Partition acts as unit of parallelism.
Topics & Partitions
❏ Partitions are distributed of several server at kafka cluster
❏ Each partition is replicated across configurable N number of servers.
❏ Each partition has at least 1 server “leader” and 0..N “followers”.
❏ IF Leader fails, one of the followers become the new leader automatically.
❏ Kafka Mirror maker provides geo-replication for kafka clusters.
❏ Mirror maker: replication across clusters, data centers, regions.
❏ Can be used as Active/Passive for backup or active/active for data locality.
Topics & Partitions: Distribution,Failover, Replication
❏ Producers can publish data in any topic.
❏ Producer choose each record goes to each partition.
❏ It can be done via Round-robin for LB.
❏ It can be done via semantic partitioning function (key based).
❏ Consumers are labeled in a “Consumer Group”.
❏ Consumer instances can be separated process/machines.
❏ Load-balancer: happens IF all consumer instances have the same consumer
group.
❏ Broadcast: happens if all consumers has different instances.
Producers & Consumers
Producers & Consumers: Publish Subscriber Semantics
❏ Load-Balancer: Same Consumer group
❏ Broadcast: Different Consumer Group
❏ Kafka only provides a total order within a partition.
❏ No total ordering is guaranteed between partitions.
❏ Total Order of records is required? It's Possible. So:
❏ 1 single topic
❏ 1 single partition
❏ 1 single consumer process per consumer group
❏ Kafka can do multi-tenancy configuring which topics can produce or consume
data, there are support for quotas.
Producers & Consumers
❏ Messages sent by a producer to a topic/partition will be appended in order.
❏ Producer send: M1 them M2. M1 will have a lower offset than M2.
❏ Consumer will see the records in order as they are in the log.
❏ Topic with replication factor N will tolerate up to N-1 server failures without
losing records committed to the log.
❏ Kafka can do Queue / Publisher Subscriber at Scale with multiple subscribers.
❏ Kafka has stronger guarantee than regular messaging solution(parallelism).
❏ Data is written in disk by kafka: replicated for fault tolerance.
❏ Kafka scales well with 50kb or 50TB of storage.
Kafka Guarantees
❏ You can consider kafka as a kind of distributed file system(Commit Log)
❏ High performance
❏ Low-latency
❏ Replication & Propagation
Kafka Guarantees
❏ At most once—Messages may be lost but are never redelivered. (LOSS)
❏ At least once—Messages are never lost but may be redelivered. (DEPLICATED)
❏ Exactly once—this is what people actually want, each message is delivered once
and only once. (Harder)
Delivery Semantics
Kafka
Lambda / Kappa Architecture
Kafka: Other use Cases
Kafka: What Platform can do!
Streaming:: Brave new world!
Running Kafka with Docker & Kafka
API Using Java / Spring
$ docker-compose up
Creating Topics & Sending Messages
Java & Kafka - Using Spring Kafka
Java & Kafka - Using Spring Kafka
src/main/resources/application.properties
Java & Kafka - Using Spring Kafka: $ ./gradlew bootRun
Exercises
You can do this exercises with Java or Scala.
You can use additional frameworks / libs to access Kafka.
1. Build a ES Calculator system which does basic math operations like (+,-,*,/) and for each
operation expose a RAW(JSON) event in kafka of the calculation.
2. Build a E-Commerce system which does basic operations like book sales in one service, and sales
report(top sales, top salesman) in another service. Code 1 service in java, the other in Scala.
Use ES in kafka with RAW JSON event to make 2 services “talk”.
3. Build a Analytic system Based on your previous exercise #2, project the amount on revenue for
the next year (create a new service *revenue-forecast* read the sales data from Kafka.
Produce a Revenue event in Kafka as well.
ES & Kafka
Diego Pacheco

More Related Content

What's hot

kafka
kafkakafka
Kafka meetup JP #3 - Engineering Apache Kafka at LINE
Kafka meetup JP #3 - Engineering Apache Kafka at LINEKafka meetup JP #3 - Engineering Apache Kafka at LINE
Kafka meetup JP #3 - Engineering Apache Kafka at LINE
kawamuray
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Srikrishna k
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
Clement Demonchy
 
Kafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internalsKafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internals
Ayyappadas Ravindran (Appu)
 
Kafka Overview
Kafka OverviewKafka Overview
Kafka Overview
iamtodor
 
Apache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging SystemApache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging System
Edureka!
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
Diego Pacheco
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Jemin Patel
 
Kafka
KafkaKafka
Kafka
shrenikp
 
Kafka Tutorial - basics of the Kafka streaming platform
Kafka Tutorial - basics of the Kafka streaming platformKafka Tutorial - basics of the Kafka streaming platform
Kafka Tutorial - basics of the Kafka streaming platform
Jean-Paul Azar
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin Podval
Martin Podval
 
October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...
October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...
October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...
Yahoo Developer Network
 
Flume vs. kafka
Flume vs. kafkaFlume vs. kafka
Flume vs. kafka
Omid Vahdaty
 
Kafka clients and emitters
Kafka clients and emittersKafka clients and emitters
Kafka clients and emitters
Edgar Domingues
 
APACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka StreamsAPACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka Streams
Ketan Gote
 
Kafka Technical Overview
Kafka Technical OverviewKafka Technical Overview
Kafka Technical Overview
Sylvester John
 
Introduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperIntroduction to Kafka and Zookeeper
Introduction to Kafka and Zookeeper
Rahul Jain
 

What's hot (20)

kafka
kafkakafka
kafka
 
Kafka meetup JP #3 - Engineering Apache Kafka at LINE
Kafka meetup JP #3 - Engineering Apache Kafka at LINEKafka meetup JP #3 - Engineering Apache Kafka at LINE
Kafka meetup JP #3 - Engineering Apache Kafka at LINE
 
Kafka basics
Kafka basicsKafka basics
Kafka basics
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Kafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internalsKafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internals
 
Kafka Overview
Kafka OverviewKafka Overview
Kafka Overview
 
Apache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging SystemApache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging System
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Kafka
KafkaKafka
Kafka
 
Kafka Tutorial - basics of the Kafka streaming platform
Kafka Tutorial - basics of the Kafka streaming platformKafka Tutorial - basics of the Kafka streaming platform
Kafka Tutorial - basics of the Kafka streaming platform
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin Podval
 
October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...
October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...
October 2016 HUG: Pulsar,  a highly scalable, low latency pub-sub messaging s...
 
kafka
kafkakafka
kafka
 
Flume vs. kafka
Flume vs. kafkaFlume vs. kafka
Flume vs. kafka
 
Kafka clients and emitters
Kafka clients and emittersKafka clients and emitters
Kafka clients and emitters
 
APACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka StreamsAPACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka Streams
 
Kafka Technical Overview
Kafka Technical OverviewKafka Technical Overview
Kafka Technical Overview
 
Introduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperIntroduction to Kafka and Zookeeper
Introduction to Kafka and Zookeeper
 

Similar to ES & Kafka

Clustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And AvailabilityClustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And AvailabilityConSanFrancisco123
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache Kafka
Amir Sedighi
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
Athens Big Data
 
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
HostedbyConfluent
 
Kubernetes
KubernetesKubernetes
Kubernetes
Diego Pacheco
 
Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
Chhavi Parasher
 
Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015
Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015
Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015
Monal Daxini
 
Kafka Tutorial - introduction to the Kafka streaming platform
Kafka Tutorial - introduction to the Kafka streaming platformKafka Tutorial - introduction to the Kafka streaming platform
Kafka Tutorial - introduction to the Kafka streaming platform
Jean-Paul Azar
 
MySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveMySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspective
Ulf Wendel
 
Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1
Knoldus Inc.
 
Kafka vs kinesis
Kafka vs kinesisKafka vs kinesis
Kafka vs kinesis
Kaushal Lahankar, FRM
 
Apache kafka
Apache kafkaApache kafka
Introduction to apache kafka
Introduction to apache kafkaIntroduction to apache kafka
Introduction to apache kafka
Samuel Kerrien
 
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps_Fest
 
Real time data pipline with kafka streams
Real time data pipline with kafka streamsReal time data pipline with kafka streams
Real time data pipline with kafka streams
Yoni Farin
 
The Impact of Hardware and Software Version Changes on Apache Kafka Performan...
The Impact of Hardware and Software Version Changes on Apache Kafka Performan...The Impact of Hardware and Software Version Changes on Apache Kafka Performan...
The Impact of Hardware and Software Version Changes on Apache Kafka Performan...
Paul Brebner
 
Brief introduction to Kafka Streaming Platform
Brief introduction to Kafka Streaming PlatformBrief introduction to Kafka Streaming Platform
Brief introduction to Kafka Streaming Platform
Jean-Paul Azar
 
Kafka Intro With Simple Java Producer Consumers
Kafka Intro With Simple Java Producer ConsumersKafka Intro With Simple Java Producer Consumers
Kafka Intro With Simple Java Producer Consumers
Jean-Paul Azar
 
Near Real time Indexing Kafka Messages to Apache Blur using Spark Streaming
Near Real time Indexing Kafka Messages to Apache Blur using Spark StreamingNear Real time Indexing Kafka Messages to Apache Blur using Spark Streaming
Near Real time Indexing Kafka Messages to Apache Blur using Spark Streaming
Dibyendu Bhattacharya
 
Kafka Tutorial - DevOps, Admin and Ops
Kafka Tutorial - DevOps, Admin and OpsKafka Tutorial - DevOps, Admin and Ops
Kafka Tutorial - DevOps, Admin and Ops
Jean-Paul Azar
 

Similar to ES & Kafka (20)

Clustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And AvailabilityClustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And Availability
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache Kafka
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
 
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
 
Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015
Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015
Netflix Keystone Pipeline at Big Data Bootcamp, Santa Clara, Nov 2015
 
Kafka Tutorial - introduction to the Kafka streaming platform
Kafka Tutorial - introduction to the Kafka streaming platformKafka Tutorial - introduction to the Kafka streaming platform
Kafka Tutorial - introduction to the Kafka streaming platform
 
MySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveMySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspective
 
Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1
 
Kafka vs kinesis
Kafka vs kinesisKafka vs kinesis
Kafka vs kinesis
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Introduction to apache kafka
Introduction to apache kafkaIntroduction to apache kafka
Introduction to apache kafka
 
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
 
Real time data pipline with kafka streams
Real time data pipline with kafka streamsReal time data pipline with kafka streams
Real time data pipline with kafka streams
 
The Impact of Hardware and Software Version Changes on Apache Kafka Performan...
The Impact of Hardware and Software Version Changes on Apache Kafka Performan...The Impact of Hardware and Software Version Changes on Apache Kafka Performan...
The Impact of Hardware and Software Version Changes on Apache Kafka Performan...
 
Brief introduction to Kafka Streaming Platform
Brief introduction to Kafka Streaming PlatformBrief introduction to Kafka Streaming Platform
Brief introduction to Kafka Streaming Platform
 
Kafka Intro With Simple Java Producer Consumers
Kafka Intro With Simple Java Producer ConsumersKafka Intro With Simple Java Producer Consumers
Kafka Intro With Simple Java Producer Consumers
 
Near Real time Indexing Kafka Messages to Apache Blur using Spark Streaming
Near Real time Indexing Kafka Messages to Apache Blur using Spark StreamingNear Real time Indexing Kafka Messages to Apache Blur using Spark Streaming
Near Real time Indexing Kafka Messages to Apache Blur using Spark Streaming
 
Kafka Tutorial - DevOps, Admin and Ops
Kafka Tutorial - DevOps, Admin and OpsKafka Tutorial - DevOps, Admin and Ops
Kafka Tutorial - DevOps, Admin and Ops
 

More from Diego Pacheco

Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!
Diego Pacheco
 
Continuous Discovery Habits Book Review.pdf
Continuous Discovery Habits  Book Review.pdfContinuous Discovery Habits  Book Review.pdf
Continuous Discovery Habits Book Review.pdf
Diego Pacheco
 
Thoughts about Shape Up
Thoughts about Shape UpThoughts about Shape Up
Thoughts about Shape Up
Diego Pacheco
 
Holacracy
HolacracyHolacracy
Holacracy
Diego Pacheco
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
Diego Pacheco
 
Encryption Deep Dive
Encryption Deep DiveEncryption Deep Dive
Encryption Deep Dive
Diego Pacheco
 
Sec 101
Sec 101Sec 101
Sec 101
Diego Pacheco
 
Reflections on SCM
Reflections on SCMReflections on SCM
Reflections on SCM
Diego Pacheco
 
Management: Doing the non-obvious! III
Management: Doing the non-obvious! IIIManagement: Doing the non-obvious! III
Management: Doing the non-obvious! III
Diego Pacheco
 
Design is not Subjective
Design is not SubjectiveDesign is not Subjective
Design is not Subjective
Diego Pacheco
 
Architecture & Engineering : Doing the non-obvious!
Architecture & Engineering :  Doing the non-obvious!Architecture & Engineering :  Doing the non-obvious!
Architecture & Engineering : Doing the non-obvious!
Diego Pacheco
 
Management doing the non-obvious II
Management doing the non-obvious II Management doing the non-obvious II
Management doing the non-obvious II
Diego Pacheco
 
Testing in production
Testing in productionTesting in production
Testing in production
Diego Pacheco
 
Nine lies about work
Nine lies about workNine lies about work
Nine lies about work
Diego Pacheco
 
Management: doing the nonobvious!
Management: doing the nonobvious!Management: doing the nonobvious!
Management: doing the nonobvious!
Diego Pacheco
 
AI and the Future
AI and the FutureAI and the Future
AI and the Future
Diego Pacheco
 
Dealing with dependencies
Dealing  with dependenciesDealing  with dependencies
Dealing with dependencies
Diego Pacheco
 
Dealing with dependencies in tests
Dealing  with dependencies in testsDealing  with dependencies in tests
Dealing with dependencies in tests
Diego Pacheco
 
Kanban 2020
Kanban 2020Kanban 2020
Kanban 2020
Diego Pacheco
 

More from Diego Pacheco (20)

Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!
 
Continuous Discovery Habits Book Review.pdf
Continuous Discovery Habits  Book Review.pdfContinuous Discovery Habits  Book Review.pdf
Continuous Discovery Habits Book Review.pdf
 
Thoughts about Shape Up
Thoughts about Shape UpThoughts about Shape Up
Thoughts about Shape Up
 
Holacracy
HolacracyHolacracy
Holacracy
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
 
CDKs
CDKsCDKs
CDKs
 
Encryption Deep Dive
Encryption Deep DiveEncryption Deep Dive
Encryption Deep Dive
 
Sec 101
Sec 101Sec 101
Sec 101
 
Reflections on SCM
Reflections on SCMReflections on SCM
Reflections on SCM
 
Management: Doing the non-obvious! III
Management: Doing the non-obvious! IIIManagement: Doing the non-obvious! III
Management: Doing the non-obvious! III
 
Design is not Subjective
Design is not SubjectiveDesign is not Subjective
Design is not Subjective
 
Architecture & Engineering : Doing the non-obvious!
Architecture & Engineering :  Doing the non-obvious!Architecture & Engineering :  Doing the non-obvious!
Architecture & Engineering : Doing the non-obvious!
 
Management doing the non-obvious II
Management doing the non-obvious II Management doing the non-obvious II
Management doing the non-obvious II
 
Testing in production
Testing in productionTesting in production
Testing in production
 
Nine lies about work
Nine lies about workNine lies about work
Nine lies about work
 
Management: doing the nonobvious!
Management: doing the nonobvious!Management: doing the nonobvious!
Management: doing the nonobvious!
 
AI and the Future
AI and the FutureAI and the Future
AI and the Future
 
Dealing with dependencies
Dealing  with dependenciesDealing  with dependencies
Dealing with dependencies
 
Dealing with dependencies in tests
Dealing  with dependencies in testsDealing  with dependencies in tests
Dealing with dependencies in tests
 
Kanban 2020
Kanban 2020Kanban 2020
Kanban 2020
 

Recently uploaded

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 

Recently uploaded (20)

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 

ES & Kafka

  • 2.
  • 4. #1 Reason why we need ES == Microservices
  • 5.
  • 6. No Places, RAW Events.
  • 9. ES Persists RAW EVENTS. When there are mutations, NEW events are created.
  • 10. CQRS IT's about scaling READ and WRITES, basically in different RELATIONAL DBS.
  • 11. CQRS / ES :: Design
  • 12. CQRS / ES :: Design
  • 13. KAFKA
  • 14. 7 Trillion messages per day.* 2019 numbers
  • 15. Use Cases ❏ Messaging ❏ Web site tracking activity ❏ Metrics ❏ Stream Processing ❏ Event Sourcing ❏ Commit Log
  • 16. Performance ❏ 2M writes per second ❏ Intel Xeon 2.5 GHz processor with six cores ❏ Six 7200 RPM SATA drives ❏ 32GB of RAM ❏ 1Gb Ethernet ❏ Single producer thread, no replication ❏ 821,557 records/sec ❏ (78.3 MB/sec) ❏ End-to-end Latency ❏ 2 ms (median) ❏ 3 ms (99th percentile) ❏ 14 ms (99.9th percentile)
  • 19.
  • 20.
  • 21. Kafka: Numbers at LinkedIN 2019/Q1
  • 22. Kafka: As ES Solution
  • 23. Kafka
  • 24.
  • 25. Kafka
  • 26. Topics & Partitions ❏ Topic = Category or Field Name where records are published. ❏ Zero, 1 or Multiple-subscribers. ❏ Each topic has a partitioned log (partitions). ❏ Each Partition: ❏ Ordered ❏ Immutable ❏ Continually appended ❏ Unique Sequential ID called *offset* ❏ Kafka cluster durable persit all logs (no matter if consumed or not)
  • 27. ❏ Kafka persist published records for period of time(configured retention) ❏ Kafka cluster performance is equivalent constant of data size. ❏ Storing data for a long time is not a problem. ❏ Consumer need to keep track of offset. ❏ Consumer can consume records in any order. ❏ Partition on log enable scaling beyond a single server size. ❏ A Topic may have any partitions so it handle arbitrary size of data. ❏ Partition acts as unit of parallelism. Topics & Partitions
  • 28. ❏ Partitions are distributed of several server at kafka cluster ❏ Each partition is replicated across configurable N number of servers. ❏ Each partition has at least 1 server “leader” and 0..N “followers”. ❏ IF Leader fails, one of the followers become the new leader automatically. ❏ Kafka Mirror maker provides geo-replication for kafka clusters. ❏ Mirror maker: replication across clusters, data centers, regions. ❏ Can be used as Active/Passive for backup or active/active for data locality. Topics & Partitions: Distribution,Failover, Replication
  • 29. ❏ Producers can publish data in any topic. ❏ Producer choose each record goes to each partition. ❏ It can be done via Round-robin for LB. ❏ It can be done via semantic partitioning function (key based). ❏ Consumers are labeled in a “Consumer Group”. ❏ Consumer instances can be separated process/machines. ❏ Load-balancer: happens IF all consumer instances have the same consumer group. ❏ Broadcast: happens if all consumers has different instances. Producers & Consumers
  • 30. Producers & Consumers: Publish Subscriber Semantics ❏ Load-Balancer: Same Consumer group ❏ Broadcast: Different Consumer Group
  • 31. ❏ Kafka only provides a total order within a partition. ❏ No total ordering is guaranteed between partitions. ❏ Total Order of records is required? It's Possible. So: ❏ 1 single topic ❏ 1 single partition ❏ 1 single consumer process per consumer group ❏ Kafka can do multi-tenancy configuring which topics can produce or consume data, there are support for quotas. Producers & Consumers
  • 32. ❏ Messages sent by a producer to a topic/partition will be appended in order. ❏ Producer send: M1 them M2. M1 will have a lower offset than M2. ❏ Consumer will see the records in order as they are in the log. ❏ Topic with replication factor N will tolerate up to N-1 server failures without losing records committed to the log. ❏ Kafka can do Queue / Publisher Subscriber at Scale with multiple subscribers. ❏ Kafka has stronger guarantee than regular messaging solution(parallelism). ❏ Data is written in disk by kafka: replicated for fault tolerance. ❏ Kafka scales well with 50kb or 50TB of storage. Kafka Guarantees
  • 33. ❏ You can consider kafka as a kind of distributed file system(Commit Log) ❏ High performance ❏ Low-latency ❏ Replication & Propagation Kafka Guarantees
  • 34. ❏ At most once—Messages may be lost but are never redelivered. (LOSS) ❏ At least once—Messages are never lost but may be redelivered. (DEPLICATED) ❏ Exactly once—this is what people actually want, each message is delivered once and only once. (Harder) Delivery Semantics
  • 35. Kafka
  • 36. Lambda / Kappa Architecture
  • 40. Running Kafka with Docker & Kafka API Using Java / Spring
  • 41.
  • 43. Creating Topics & Sending Messages
  • 44. Java & Kafka - Using Spring Kafka
  • 45. Java & Kafka - Using Spring Kafka src/main/resources/application.properties
  • 46. Java & Kafka - Using Spring Kafka: $ ./gradlew bootRun
  • 47. Exercises You can do this exercises with Java or Scala. You can use additional frameworks / libs to access Kafka. 1. Build a ES Calculator system which does basic math operations like (+,-,*,/) and for each operation expose a RAW(JSON) event in kafka of the calculation. 2. Build a E-Commerce system which does basic operations like book sales in one service, and sales report(top sales, top salesman) in another service. Code 1 service in java, the other in Scala. Use ES in kafka with RAW JSON event to make 2 services “talk”. 3. Build a Analytic system Based on your previous exercise #2, project the amount on revenue for the next year (create a new service *revenue-forecast* read the sales data from Kafka. Produce a Revenue event in Kafka as well.
  • 48. ES & Kafka Diego Pacheco