SlideShare a Scribd company logo
INSIDE KAFKA STREAMS -
MONITORING COMCAST’S OUTSIDE PLANT
October 17, 2018
2
MONITORING
”OUTSIDE PLANT”
EXTERNAL FACTORS
• Weather
• Power
• Construction
REQUIREMENTS
• Fast
• Resilient
• Evolvable
3
NODENODENODE
MONITORING ”OUTSIDE PLANT”
CMTS
ANALYZE
NODES
GENERATE
EVENTS
SCORE
NODES
PRIORITIZE
WORK
POLL
POLL
THRESHOLDS
DEVICES
USE KAFKA
STREAMS TO
MONITOR
AND
RESPOND TO
OUTSIDE
PLANT
CONDITIONS
4
TOPOLOGY
Copy
XX%
STREAMING APPLICATION APIS
KAFKA STREAMING TECH STACK
CONCEPTS
INFORMATION SYSTEM
CLIENTPROCESSOR
API
STREAMS
API
KSQL
STREAMING APPLICATIONS
KAFKA SERVER PLATFORM
ANALYSIS EVENTS NODE SCORE
BROKERS ZOOKEEPER CONNECT
PRODUCER TOPIC CONSUMER
CLIENTJAR
ADMIN CLIENT
STREAMSJARKSQLJAR
SOURCE PROCESSOR SINK
STATE STORE
BUILDER
KSTREAM OPERATIONS
KTABLE
STREAM KSQL
TABLE
5
PARTITION MECHANICS
KAFKA CONSUMERS & PRODUCERS
CONCEPTS
PRODUCERS
TOPIC CONSUMER GROUP
BROKERBROKERBROKERBROKER
P 0
P 0
P 0
P 1
P 2
P 1
P 1
P 2
P 2
KEY
VALUE
KEY
VALUE
KEY
VALUE
KEY
VALUE
PRODUCER
PRODUCER
PRODUCER
PRODUCER
H
A
S
H
CONSUMER
CONSUMER
CONSUMER
CONSUMER
CONSUMER GROUP
CONSUMER
6
PARTITION MECHANICS IN THE PROCESSOR API
KAFKA STREAMS - PROCESSOR API - PARTITIONING
CONCEPTS
SOURCE-TOPICS
P 0
P 1
P 2
SINK-TOPICS
P 0
P 1
P 2
STATE-STORE-CHANGELOG-TOPICS
P 0 P 1 P 2
TOPOLOGY
SOURCES SINKS
STATE STORES
INSTANCE 0
SOURCES PROCESSORS SINKS
STATE STORES
INSTANCE 1
SOURCES PROCESSOR SINKS
STATE STORES
INSTANCE 2
SOURCES PROCESSORS SINKS
STATE STORES
PROCESSORS
7
PROCESSOR
STATE STORE DURABILITY
KAFKA STREAMS - PROCESSOR API – STATE STORE
CONCEPTS
STATE STORE (P 0)
STATE-STORE-CHANGELOG-TOPIC (P 0)
K:1
V:a
K:1
V:a
K:2
V:b
K:2
V:b
K:3
V:c
K:3
V:c
K:1
V:a
K:2
V:b
K:3
V:c
K:1
V:d
K:1
V:d
K:1
V:d
K:2
V:e
K:1
V:f
K:2
V:e
K:2
V:e
K:1
V:f
K:1
V:f
LOG COMPACTION
K:1
V:a
K:2
V:b
K:1
V:d
SOURCE TOPIC (P 0)
K:1
V:a
K:2
V:b
K:3
V:c
K:1
V:d
K:2
V:e
K:1
V:f
8
TODAY’S DISCUSSION – PROCESSOR API PATTERNS
Monitoring Outside Plant
Streaming Concepts
Processor API Patterns
Tech Notes
9
STATE STORE USE
STATE STORES ARE USED FOR
• Deduplication of requests
• Materialized view of table data
• Rolling aggregates
1 0
STATE STORE
DE-DEPLICATION OF NODE REQUESTS
• Use Case: Do not have duplicate node polls running concurrently
• This architecture easily prevents duplicate node requests and reduces
resource stress and avoids database locking
• Works in conjunction with sockets to return results to multiple requestors
(UI), or will publish results to a state store
1 1
STATE STORE
DE-DUPLICATION OF NODE REQUESTS
NA
Publish
processor
Node
State
store
request
Set to “running”
Node LK1 “at rest”
Node AnalysisNA
Request
processor
Set to “at rest”
Node Poll Results
DE-DUPLICATION OF NODE REQUESTS
UI (or
other)
1 2
STATE STORE
MATERIALIZED VIEW OF TABLE DATA
• Use Case: Need to have a current list of device data (location & device type),
also ref data, poll data and other needs. We are reshaping the raw data for
use, this is faster that retrieving and reshaping constantly.
• We use the UI, a timer or an external system “push” to load data to a topic
and then a state store. In the future, we would like to get all changes in data
streamed to our application
• We query the app not the DB
1 3
STATE STORE
MATERIALIZED VIEW OF TABLE DATA
Topic with
raw data
processor
State store
Device &
location
State
store
stats
State store
performance
Timer
UI App
Rest
Endpoint
Rest of
application
1 4
STATE STORE
ROLLING AGGREGATES
• Use Case: Keeping track of the steps of a node request
• Can pull stats from this data, and is a powerful tool for checking health of our
application
• Gives us a window into the node analysis steps
1 5
STATE STORE
ROLLING AGGREGATES
Our UI displays the results
from each stage of a node
request. This is a useful tool
for operations.
1 6
TIMERS AND STREAM LOGIC
TIMERS AND STREAMING SOLUTION
• Data Pump
• Plant Validator
1 7
TIMERS AND STREAM LOGIC
DATA PUMP
• Use Case: Load data from other systems/ sources on a schedule
• Most other systems don’t push change messages to us, and generally make
the data available through rest APIs
• We use a timer to kick off getting the data
• We stream the data to a topic and a processor takes the data, shapes it to the
needed use, and populates a state store or topic.
1 8
Copy
XX%
Copy
XX%
Copy
XX%
Copy
XX%
CODE SAMPLE FOR A TIMER
TIMER DATA LOAD
Spring application
@EnableScheduling
Use @Scheduled
Runs the data load
this one uses web service call
1 9
TIMERS AND STREAM LOGIC
EVENT VALIDATOR FUNCTION
• Use Case: Some issues found in the outside plant need a “soaking” period to
confirm the issue to determine the correct action (if any)
• We need to move “soaking” events to “confirmed”, “closed” or “outbound”
• We use a one minute timer, check the status of an event, check if event is still
valid and update the status
• Possible through the use of a state store for the soaking events. No need to
query a DB
2 0
TIMERS AND STREAM LOGIC
EVENT VALIDATOR PROCESS
Validation
Result
Processor
Soaking
Event
store
request
Get soaking events
Node AnalysisValidation
Processor
Event Actions
Timer
Set to “outbound”
2 1
ASYNC REST SERVICE CALLS
USED IN COMMUNICATION WITH LEGACY SYSTEM
• Use Case: Remove latency when calling rest web services
• One thread available per stream topology, so we use Flux (from Reactor Web)
to make async rest service calls to prevent blocking
• To poll a node, we call a webservice that retrieves all the SNMP data for the
devices. The call takes 10+ seconds and the streaming
• When the async calls returns, we are no longer in streams processing, so we
use a producer to create the next topic message.
2 2
ASYNC REST SERVICE CALLS
NODENODENODE
CMTS
ANALYZE
NODES
GENERATE
EVENTS
SCORE
NODES
PRIORITIZE
WORK
POLL
POLL
THRESHOLDS
ACCOUNTS
2 3
Copy
XX%
CODE SAMPLE CREATING THE ASYNC CALL
ASYNC REST SERVICE CALLS
WebService call
callClient is a
WebClient
Returns a Mono
2 4
Copy
XX%
Copy
XX%
Copy
XX%
Copy
XX%
CODE SAMPLE PROCESSING THE ASYNC RETURN
ASYNC REST SERVICE CALLS
Code runs when
call completes
receives the
response object
runs business
logic
2 5
Copy
XX%
Copy
XX%
Copy
XX%
Copy
XX%
CODE SAMPLE PROCESSING THE ASYNC RETURN, GETTING BACK INTO STREAMS USING A PRODUCER
ASYNC REST SERVICE CALLS
Response returns
We are out of
streaming framework
Need to use a producer
2 6
ADVANTAGES OF STREAMING
ADVANTAGES INCLUDE:
• Looked for solutions to refactor our current application code base
• Faster than a traditional database for this use case
• Streams solution is not monolithic. We’ll be able to update the app quicker
• Modular, once we had the basic framework for Node Analysis developed.
• Programming model is very straightforward
• We only need a few code patterns to solve many of our needs
• Kafka streams is fundamentally different from the other solutions we had
available
2 7
TODAY’S DISCUSSION – TECH NOTES
Monitoring Outside Plant
Streaming Concepts
Processor API Patterns
Tech Notes
2 8
INSTANCE2
REST API ßà STATE STORE
INTERACTIVE QUERY
TECH NOTES
STATE-STORE-CHANGELOG-TOPIC
P 0 P 1 P 2
INSTANCE0
REST API
STATE STORE
INSTANCE1
REST API
STATE STORE STATE STORE
PROPERTY: SERVER & PORT
INJECT TOPOLOGY BUILDER
GET STREAMS FROM TOPOLOGY
STREAMS.STORE (LOOP / TIMER)
META: SERVER MAP WITH PARTITIONS
REST API
2 9
PROCESSOR API - DIAGRAMING & NAMING
DIAGRAMING
TECH NOTES
3 0
MICROSERVICES & DEPLOYMENT
TECH NOTES
APPLICATION INTEGRATION
STREAMING APPLICATIONS
KAFKA SERVER PLATFORM
APP 1 APP 2
TOPICS
3 1
SCRIPT TO MANAGE TOPICS
TOPICS SCRIPT
TECH NOTES
ENVIRONMENT PREFIX
TOPOLOGIES, CONSUMER GROUPS, & TOPICS
KAFKA TOPICS
MIKE- DAN- DEV-
MIKE- DAN- DEV- TEST-
TEST-
Topic Prefix
Partition Count
Target Kafka Cluster
Delete Existing Topics?
Create New Topics?
3 2
GRAFANA & PROMETHEUS
MONITORING
TECH NOTES
KAFKA SERVER
PLATFORM
BROKER
JMX
EXPORTER
GRAFANA DASHBOARDS
YAML
PROMETHEUS PLATFORM
JSON
JNDI(:1234)
3 3
OPEN SOURCE AT COMCAST
APACHE TRAFFIC
CONTROL
Graduated to TLP May 16, 2018
Build a large scale content
delivery network using open
source.
MIRROR-TOOL-FOR-KAFKA-
CONNECT
Comcast’s Rhys McCaig
Mirroring Kafka topics between
clusters using the Kafka
Connect framework.
145 OPEN SOURCE
REPOSITORIES
Comcast is committed to open
source software.
We use OSS to build products,
attract talent and evolve the
technology we use to improve
the customer experience.
comcast.github.io
github.com/comcast
labs.comcast.com
comcast.github.io
github.com/comcast
Mike Graham
twitter datumgeek
github datumgeek
charles_graham@comcast.com
Dan Carroll
twitter dcarroll
github dcarroll
daniel_carroll@comcast.com
Thank You !!!!
J J

More Related Content

PDF
Technical Deep Dive: Using Apache Kafka to Optimize Real-Time Analytics in Fi...
PPTX
Kafka Connect - debezium
PDF
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB)
PDF
Kafka for Real-Time Replication between Edge and Hybrid Cloud
PPTX
Processing Semantically-Ordered Streams in Financial Services
PDF
Streaming all over the world Real life use cases with Kafka Streams
PDF
Reliable Event Delivery in Apache Kafka Based on Retry Policy and Dead Letter...
PPTX
The Top 5 Apache Kafka Use Cases and Architectures in 2022
Technical Deep Dive: Using Apache Kafka to Optimize Real-Time Analytics in Fi...
Kafka Connect - debezium
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB)
Kafka for Real-Time Replication between Edge and Hybrid Cloud
Processing Semantically-Ordered Streams in Financial Services
Streaming all over the world Real life use cases with Kafka Streams
Reliable Event Delivery in Apache Kafka Based on Retry Policy and Dead Letter...
The Top 5 Apache Kafka Use Cases and Architectures in 2022

What's hot (20)

PPSX
Apache Flink, AWS Kinesis, Analytics
PDF
Best Practices for Streaming IoT Data with MQTT and Apache Kafka
PDF
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
PDF
Telco 4.0 - Payment and FinServ Integration for Data in Motion with 5G and Ap...
PDF
Intro to Delta Lake
PPTX
Apache Flink: Real-World Use Cases for Streaming Analytics
PDF
Apache Kafka for Real-time Supply Chain in the Food and Retail Industry
PDF
Serverless Kafka on AWS as Part of a Cloud-native Data Lake Architecture
ODP
Introduction to Kafka connect
PDF
Securing Kafka
PDF
Apache Kafka for Automotive Industry, Mobility Services & Smart City
PDF
Introducing Change Data Capture with Debezium
PDF
Kafka At Scale in the Cloud
PPTX
Apache Flink @ NYC Flink Meetup
PDF
Apache Kafka
PPTX
Welcome to the Flink Community!
PDF
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
PDF
Apache Kafka Streams + Machine Learning / Deep Learning
PDF
Apache Kafka Architecture & Fundamentals Explained
PDF
Apache Kafka in the Automotive Industry (Connected Vehicles, Manufacturing 4....
Apache Flink, AWS Kinesis, Analytics
Best Practices for Streaming IoT Data with MQTT and Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Telco 4.0 - Payment and FinServ Integration for Data in Motion with 5G and Ap...
Intro to Delta Lake
Apache Flink: Real-World Use Cases for Streaming Analytics
Apache Kafka for Real-time Supply Chain in the Food and Retail Industry
Serverless Kafka on AWS as Part of a Cloud-native Data Lake Architecture
Introduction to Kafka connect
Securing Kafka
Apache Kafka for Automotive Industry, Mobility Services & Smart City
Introducing Change Data Capture with Debezium
Kafka At Scale in the Cloud
Apache Flink @ NYC Flink Meetup
Apache Kafka
Welcome to the Flink Community!
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Apache Kafka Streams + Machine Learning / Deep Learning
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka in the Automotive Industry (Connected Vehicles, Manufacturing 4....
Ad

Similar to Inside Kafka Streams—Monitoring Comcast’s Outside Plant (20)

PPTX
Next Gen Big Data Analytics with Apache Apex
PPTX
Big Data Berlin v8.0 Stream Processing with Apache Apex
PPTX
Thomas Weise, Apache Apex PMC Member and Architect/Co-Founder, DataTorrent - ...
PPTX
Hadoop Summit SJ 2016: Next Gen Big Data Analytics with Apache Apex
PDF
Introduction to Apache Apex by Thomas Weise
PDF
Apache Big Data EU 2016: Next Gen Big Data Analytics with Apache Apex
PPTX
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
PPTX
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
PDF
Operationalizing Machine Learning—Managing Provenance from Raw Data to Predic...
PPTX
Apache Apex: Stream Processing Architecture and Applications
PPTX
Apache Apex: Stream Processing Architecture and Applications
PPTX
Ingestion and Dimensions Compute and Enrich using Apache Apex
PDF
Observability with Spring-based distributed systems
PPTX
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
PPTX
Stream Processing with Apache Apex
PDF
Tame the Mesh An intro to cross-platform tracing and troubleshooting.pdf
PDF
Rocana Deep Dive OC Big Data Meetup #19 Sept 21st 2016
PPTX
Introduction to Apache Apex and writing a big data streaming application
PPTX
IoT Ingestion & Analytics using Apache Apex - A Native Hadoop Platform
PPTX
Intro to Apache Apex @ Women in Big Data
Next Gen Big Data Analytics with Apache Apex
Big Data Berlin v8.0 Stream Processing with Apache Apex
Thomas Weise, Apache Apex PMC Member and Architect/Co-Founder, DataTorrent - ...
Hadoop Summit SJ 2016: Next Gen Big Data Analytics with Apache Apex
Introduction to Apache Apex by Thomas Weise
Apache Big Data EU 2016: Next Gen Big Data Analytics with Apache Apex
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Operationalizing Machine Learning—Managing Provenance from Raw Data to Predic...
Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and Applications
Ingestion and Dimensions Compute and Enrich using Apache Apex
Observability with Spring-based distributed systems
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
Stream Processing with Apache Apex
Tame the Mesh An intro to cross-platform tracing and troubleshooting.pdf
Rocana Deep Dive OC Big Data Meetup #19 Sept 21st 2016
Introduction to Apache Apex and writing a big data streaming application
IoT Ingestion & Analytics using Apache Apex - A Native Hadoop Platform
Intro to Apache Apex @ Women in Big Data
Ad

More from confluent (20)

PDF
Stream Processing Handson Workshop - Flink SQL Hands-on Workshop (Korean)
PPTX
Webinar Think Right - Shift Left - 19-03-2025.pptx
PDF
Migration, backup and restore made easy using Kannika
PDF
Five Things You Need to Know About Data Streaming in 2025
PDF
Data in Motion Tour Seoul 2024 - Keynote
PDF
Data in Motion Tour Seoul 2024 - Roadmap Demo
PDF
From Stream to Screen: Real-Time Data Streaming to Web Frontends with Conflue...
PDF
Confluent per il settore FSI: Accelerare l'Innovazione con il Data Streaming...
PDF
Data in Motion Tour 2024 Riyadh, Saudi Arabia
PDF
Build a Real-Time Decision Support Application for Financial Market Traders w...
PDF
Strumenti e Strategie di Stream Governance con Confluent Platform
PDF
Compose Gen-AI Apps With Real-Time Data - In Minutes, Not Weeks
PDF
Building Real-Time Gen AI Applications with SingleStore and Confluent
PDF
Unlocking value with event-driven architecture by Confluent
PDF
Il Data Streaming per un’AI real-time di nuova generazione
PDF
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
PDF
Break data silos with real-time connectivity using Confluent Cloud Connectors
PDF
Building API data products on top of your real-time data infrastructure
PDF
Speed Wins: From Kafka to APIs in Minutes
PDF
Evolving Data Governance for the Real-time Streaming and AI Era
Stream Processing Handson Workshop - Flink SQL Hands-on Workshop (Korean)
Webinar Think Right - Shift Left - 19-03-2025.pptx
Migration, backup and restore made easy using Kannika
Five Things You Need to Know About Data Streaming in 2025
Data in Motion Tour Seoul 2024 - Keynote
Data in Motion Tour Seoul 2024 - Roadmap Demo
From Stream to Screen: Real-Time Data Streaming to Web Frontends with Conflue...
Confluent per il settore FSI: Accelerare l'Innovazione con il Data Streaming...
Data in Motion Tour 2024 Riyadh, Saudi Arabia
Build a Real-Time Decision Support Application for Financial Market Traders w...
Strumenti e Strategie di Stream Governance con Confluent Platform
Compose Gen-AI Apps With Real-Time Data - In Minutes, Not Weeks
Building Real-Time Gen AI Applications with SingleStore and Confluent
Unlocking value with event-driven architecture by Confluent
Il Data Streaming per un’AI real-time di nuova generazione
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
Break data silos with real-time connectivity using Confluent Cloud Connectors
Building API data products on top of your real-time data infrastructure
Speed Wins: From Kafka to APIs in Minutes
Evolving Data Governance for the Real-time Streaming and AI Era

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
Teaching material agriculture food technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Electronic commerce courselecture one. Pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Review of recent advances in non-invasive hemoglobin estimation
Teaching material agriculture food technology
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
A Presentation on Artificial Intelligence
Advanced methodologies resolving dimensionality complications for autism neur...
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Electronic commerce courselecture one. Pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Monthly Chronicles - July 2025
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm

Inside Kafka Streams—Monitoring Comcast’s Outside Plant

  • 1. INSIDE KAFKA STREAMS - MONITORING COMCAST’S OUTSIDE PLANT October 17, 2018
  • 2. 2 MONITORING ”OUTSIDE PLANT” EXTERNAL FACTORS • Weather • Power • Construction REQUIREMENTS • Fast • Resilient • Evolvable
  • 4. 4 TOPOLOGY Copy XX% STREAMING APPLICATION APIS KAFKA STREAMING TECH STACK CONCEPTS INFORMATION SYSTEM CLIENTPROCESSOR API STREAMS API KSQL STREAMING APPLICATIONS KAFKA SERVER PLATFORM ANALYSIS EVENTS NODE SCORE BROKERS ZOOKEEPER CONNECT PRODUCER TOPIC CONSUMER CLIENTJAR ADMIN CLIENT STREAMSJARKSQLJAR SOURCE PROCESSOR SINK STATE STORE BUILDER KSTREAM OPERATIONS KTABLE STREAM KSQL TABLE
  • 5. 5 PARTITION MECHANICS KAFKA CONSUMERS & PRODUCERS CONCEPTS PRODUCERS TOPIC CONSUMER GROUP BROKERBROKERBROKERBROKER P 0 P 0 P 0 P 1 P 2 P 1 P 1 P 2 P 2 KEY VALUE KEY VALUE KEY VALUE KEY VALUE PRODUCER PRODUCER PRODUCER PRODUCER H A S H CONSUMER CONSUMER CONSUMER CONSUMER CONSUMER GROUP CONSUMER
  • 6. 6 PARTITION MECHANICS IN THE PROCESSOR API KAFKA STREAMS - PROCESSOR API - PARTITIONING CONCEPTS SOURCE-TOPICS P 0 P 1 P 2 SINK-TOPICS P 0 P 1 P 2 STATE-STORE-CHANGELOG-TOPICS P 0 P 1 P 2 TOPOLOGY SOURCES SINKS STATE STORES INSTANCE 0 SOURCES PROCESSORS SINKS STATE STORES INSTANCE 1 SOURCES PROCESSOR SINKS STATE STORES INSTANCE 2 SOURCES PROCESSORS SINKS STATE STORES PROCESSORS
  • 7. 7 PROCESSOR STATE STORE DURABILITY KAFKA STREAMS - PROCESSOR API – STATE STORE CONCEPTS STATE STORE (P 0) STATE-STORE-CHANGELOG-TOPIC (P 0) K:1 V:a K:1 V:a K:2 V:b K:2 V:b K:3 V:c K:3 V:c K:1 V:a K:2 V:b K:3 V:c K:1 V:d K:1 V:d K:1 V:d K:2 V:e K:1 V:f K:2 V:e K:2 V:e K:1 V:f K:1 V:f LOG COMPACTION K:1 V:a K:2 V:b K:1 V:d SOURCE TOPIC (P 0) K:1 V:a K:2 V:b K:3 V:c K:1 V:d K:2 V:e K:1 V:f
  • 8. 8 TODAY’S DISCUSSION – PROCESSOR API PATTERNS Monitoring Outside Plant Streaming Concepts Processor API Patterns Tech Notes
  • 9. 9 STATE STORE USE STATE STORES ARE USED FOR • Deduplication of requests • Materialized view of table data • Rolling aggregates
  • 10. 1 0 STATE STORE DE-DEPLICATION OF NODE REQUESTS • Use Case: Do not have duplicate node polls running concurrently • This architecture easily prevents duplicate node requests and reduces resource stress and avoids database locking • Works in conjunction with sockets to return results to multiple requestors (UI), or will publish results to a state store
  • 11. 1 1 STATE STORE DE-DUPLICATION OF NODE REQUESTS NA Publish processor Node State store request Set to “running” Node LK1 “at rest” Node AnalysisNA Request processor Set to “at rest” Node Poll Results DE-DUPLICATION OF NODE REQUESTS UI (or other)
  • 12. 1 2 STATE STORE MATERIALIZED VIEW OF TABLE DATA • Use Case: Need to have a current list of device data (location & device type), also ref data, poll data and other needs. We are reshaping the raw data for use, this is faster that retrieving and reshaping constantly. • We use the UI, a timer or an external system “push” to load data to a topic and then a state store. In the future, we would like to get all changes in data streamed to our application • We query the app not the DB
  • 13. 1 3 STATE STORE MATERIALIZED VIEW OF TABLE DATA Topic with raw data processor State store Device & location State store stats State store performance Timer UI App Rest Endpoint Rest of application
  • 14. 1 4 STATE STORE ROLLING AGGREGATES • Use Case: Keeping track of the steps of a node request • Can pull stats from this data, and is a powerful tool for checking health of our application • Gives us a window into the node analysis steps
  • 15. 1 5 STATE STORE ROLLING AGGREGATES Our UI displays the results from each stage of a node request. This is a useful tool for operations.
  • 16. 1 6 TIMERS AND STREAM LOGIC TIMERS AND STREAMING SOLUTION • Data Pump • Plant Validator
  • 17. 1 7 TIMERS AND STREAM LOGIC DATA PUMP • Use Case: Load data from other systems/ sources on a schedule • Most other systems don’t push change messages to us, and generally make the data available through rest APIs • We use a timer to kick off getting the data • We stream the data to a topic and a processor takes the data, shapes it to the needed use, and populates a state store or topic.
  • 18. 1 8 Copy XX% Copy XX% Copy XX% Copy XX% CODE SAMPLE FOR A TIMER TIMER DATA LOAD Spring application @EnableScheduling Use @Scheduled Runs the data load this one uses web service call
  • 19. 1 9 TIMERS AND STREAM LOGIC EVENT VALIDATOR FUNCTION • Use Case: Some issues found in the outside plant need a “soaking” period to confirm the issue to determine the correct action (if any) • We need to move “soaking” events to “confirmed”, “closed” or “outbound” • We use a one minute timer, check the status of an event, check if event is still valid and update the status • Possible through the use of a state store for the soaking events. No need to query a DB
  • 20. 2 0 TIMERS AND STREAM LOGIC EVENT VALIDATOR PROCESS Validation Result Processor Soaking Event store request Get soaking events Node AnalysisValidation Processor Event Actions Timer Set to “outbound”
  • 21. 2 1 ASYNC REST SERVICE CALLS USED IN COMMUNICATION WITH LEGACY SYSTEM • Use Case: Remove latency when calling rest web services • One thread available per stream topology, so we use Flux (from Reactor Web) to make async rest service calls to prevent blocking • To poll a node, we call a webservice that retrieves all the SNMP data for the devices. The call takes 10+ seconds and the streaming • When the async calls returns, we are no longer in streams processing, so we use a producer to create the next topic message.
  • 22. 2 2 ASYNC REST SERVICE CALLS NODENODENODE CMTS ANALYZE NODES GENERATE EVENTS SCORE NODES PRIORITIZE WORK POLL POLL THRESHOLDS ACCOUNTS
  • 23. 2 3 Copy XX% CODE SAMPLE CREATING THE ASYNC CALL ASYNC REST SERVICE CALLS WebService call callClient is a WebClient Returns a Mono
  • 24. 2 4 Copy XX% Copy XX% Copy XX% Copy XX% CODE SAMPLE PROCESSING THE ASYNC RETURN ASYNC REST SERVICE CALLS Code runs when call completes receives the response object runs business logic
  • 25. 2 5 Copy XX% Copy XX% Copy XX% Copy XX% CODE SAMPLE PROCESSING THE ASYNC RETURN, GETTING BACK INTO STREAMS USING A PRODUCER ASYNC REST SERVICE CALLS Response returns We are out of streaming framework Need to use a producer
  • 26. 2 6 ADVANTAGES OF STREAMING ADVANTAGES INCLUDE: • Looked for solutions to refactor our current application code base • Faster than a traditional database for this use case • Streams solution is not monolithic. We’ll be able to update the app quicker • Modular, once we had the basic framework for Node Analysis developed. • Programming model is very straightforward • We only need a few code patterns to solve many of our needs • Kafka streams is fundamentally different from the other solutions we had available
  • 27. 2 7 TODAY’S DISCUSSION – TECH NOTES Monitoring Outside Plant Streaming Concepts Processor API Patterns Tech Notes
  • 28. 2 8 INSTANCE2 REST API ßà STATE STORE INTERACTIVE QUERY TECH NOTES STATE-STORE-CHANGELOG-TOPIC P 0 P 1 P 2 INSTANCE0 REST API STATE STORE INSTANCE1 REST API STATE STORE STATE STORE PROPERTY: SERVER & PORT INJECT TOPOLOGY BUILDER GET STREAMS FROM TOPOLOGY STREAMS.STORE (LOOP / TIMER) META: SERVER MAP WITH PARTITIONS REST API
  • 29. 2 9 PROCESSOR API - DIAGRAMING & NAMING DIAGRAMING TECH NOTES
  • 30. 3 0 MICROSERVICES & DEPLOYMENT TECH NOTES APPLICATION INTEGRATION STREAMING APPLICATIONS KAFKA SERVER PLATFORM APP 1 APP 2 TOPICS
  • 31. 3 1 SCRIPT TO MANAGE TOPICS TOPICS SCRIPT TECH NOTES ENVIRONMENT PREFIX TOPOLOGIES, CONSUMER GROUPS, & TOPICS KAFKA TOPICS MIKE- DAN- DEV- MIKE- DAN- DEV- TEST- TEST- Topic Prefix Partition Count Target Kafka Cluster Delete Existing Topics? Create New Topics?
  • 32. 3 2 GRAFANA & PROMETHEUS MONITORING TECH NOTES KAFKA SERVER PLATFORM BROKER JMX EXPORTER GRAFANA DASHBOARDS YAML PROMETHEUS PLATFORM JSON JNDI(:1234)
  • 33. 3 3 OPEN SOURCE AT COMCAST APACHE TRAFFIC CONTROL Graduated to TLP May 16, 2018 Build a large scale content delivery network using open source. MIRROR-TOOL-FOR-KAFKA- CONNECT Comcast’s Rhys McCaig Mirroring Kafka topics between clusters using the Kafka Connect framework. 145 OPEN SOURCE REPOSITORIES Comcast is committed to open source software. We use OSS to build products, attract talent and evolve the technology we use to improve the customer experience. comcast.github.io github.com/comcast labs.comcast.com
  • 34. comcast.github.io github.com/comcast Mike Graham twitter datumgeek github datumgeek charles_graham@comcast.com Dan Carroll twitter dcarroll github dcarroll daniel_carroll@comcast.com Thank You !!!! J J