SlideShare une entreprise Scribd logo
1  sur  13
KAFKA STREAMS
Kakfa Streams Architecture
Active / Standby tasks
Interactive Queries
One Hop Queries
Queryable State during Restoration
Storage Policies
Rack-Aware task allocation.
Finite Retention in Changelog Topic
Conclusion
Q/A
Agenda
01
02
03
04
05
06
07
08
09
10
Kafka Streams Architecture
Active / StandBy Tasks
Interactive Queries
OneHop Queries
• Leader is elected among Kafka Streams Application Instances using
Apache Curator Leader Recipe.
• Leader pushes any changes to StreamsMetadata to zookeeper
• Client Watches Zookeeper Node and is notified of metadata changes.
• Client builds up partition -> (Node, port) map and uses it to fetch state
related to a given key.
OneHop Queries Implementation Details
• Currently State Store is queryable only when task is in RUNNING state.
• When Primary task fails, Standby is promoted to Primary. But before it
can start processing messages / queries it needs to build up state by
reading from local state store and changelog kafka topic.
• As standby can be arbitrarily behind primary, the amount of changelog
to be read can be huge. During this time state store remains non
queryable.
• Made changes such that store is queryable even when task is in
RESTORATION (PARTITION_ASSIGNED) state.
• This increases availability of micro-services built on top of Kafka
Streams.
Queryable State during Restoration
• RocksDB is used for storing state in Kafka Streams, and RocksDB
works best with SSD’s.
• As state gets huge, it becomes costlier to store entire data in SSD’s.
• We need to move not-so-recent data to HDD’s, where it is still
queryable but does not occupy space on SSD’s.
• We implemented configurable storage policies, like Archival Policy, TTL
policy.
• Archival Policy moves data that is not touched for long time
(configurable) from SSD to HDD.
• On top of this user can also select to use TTL policy to completely
remove state from HDD that is not modified for long time.
Storage Policies
• In addition to actual data in store, we also store time when a particular
key is modified. This information is stored in RocksDB.
• Data in RocksDB is of the format <timestamp>#<key> -> key
• Since RocksDB supports efficient range queries, this data allows us to
find keys that are not modified for long time.
• This helps us in enforcing storage policies.
Storage Policies Implementation Details
• Currently, Kafka Streams does not support rack-awareness while
allocating tasks.
• This means, it is possible that both Primary and Standby tasks are
allocated on the same rack.
• This would result in poor fault-tolerance in case of whole rack failures.
• We have a config in StreamsConfig called "RACK_ID_CONFIG" which
helps StickyPartitionAssignor to assign tasks in such a way that no two
replica tasks are on same rack if possible.
Rack Aware Task allocation
• Changelog topics are log-compacted kafka topics with infinite retention
time.
• As amount of state of application increases, changelog topics also grow
in size and infinite leads to storage consumption on kafka cluster.
• To reduce space pressure on kafka cluster we implemented mechanism
that allows for configurable amount of retention time in Changelog kafka
topic.
• When standby task fails and restarted on different machine, it tries to
copy state directly from the machine on which primary task is running.
And it also replays changelog kafka topic so that state is up-to-date on
standby task node.
Finite Retention in Changelog Topic
• Kafka Streams library allows application developers to write streaming
applications.
• Kafka Streams borrowed few ideas from Apace Samza and provided
new features like Standby Tasks and Interactive Query support.
• We implemented few features which helps towards improving
performance(one-hop queries), availability (queryable state during
RESTORATION phase), fault-tolerance(rack-aware task allocation) etc.
Conclusion

Contenu connexe

Tendances

Tendances (20)

State management in Structured Streaming
State management in Structured StreamingState management in Structured Streaming
State management in Structured Streaming
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
 
SAP on Azure Web Dispatcher High Availability
SAP on Azure Web Dispatcher High AvailabilitySAP on Azure Web Dispatcher High Availability
SAP on Azure Web Dispatcher High Availability
 
Transform your DBMS to drive engagement innovation with Big Data
Transform your DBMS to drive engagement innovation with Big DataTransform your DBMS to drive engagement innovation with Big Data
Transform your DBMS to drive engagement innovation with Big Data
 
Migrating Oracle database to PostgreSQL
Migrating Oracle database to PostgreSQLMigrating Oracle database to PostgreSQL
Migrating Oracle database to PostgreSQL
 
Building real time Data Pipeline using Spark Streaming
Building real time Data Pipeline using Spark StreamingBuilding real time Data Pipeline using Spark Streaming
Building real time Data Pipeline using Spark Streaming
 
Ingesting Data from Kafka to JDBC with Transformation and Enrichment
Ingesting Data from Kafka to JDBC with Transformation and EnrichmentIngesting Data from Kafka to JDBC with Transformation and Enrichment
Ingesting Data from Kafka to JDBC with Transformation and Enrichment
 
How Kafka and MemSQL Became the Dynamic Duo (Sarung Tripathi, MemSQL) Kafka S...
How Kafka and MemSQL Became the Dynamic Duo (Sarung Tripathi, MemSQL) Kafka S...How Kafka and MemSQL Became the Dynamic Duo (Sarung Tripathi, MemSQL) Kafka S...
How Kafka and MemSQL Became the Dynamic Duo (Sarung Tripathi, MemSQL) Kafka S...
 
State transfer With Galera
State transfer With GaleraState transfer With Galera
State transfer With Galera
 
2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-query2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-query
 
HBaseConEast2016: Splice machine open source rdbms
HBaseConEast2016: Splice machine open source rdbmsHBaseConEast2016: Splice machine open source rdbms
HBaseConEast2016: Splice machine open source rdbms
 
HBaseConAsia2018 Track2-4: HTAP DB-System: AsparaDB HBase, Phoenix, and Spark
HBaseConAsia2018 Track2-4: HTAP DB-System: AsparaDB HBase, Phoenix, and SparkHBaseConAsia2018 Track2-4: HTAP DB-System: AsparaDB HBase, Phoenix, and Spark
HBaseConAsia2018 Track2-4: HTAP DB-System: AsparaDB HBase, Phoenix, and Spark
 
Kafka to Hadoop Ingest with Parsing, Dedup and other Big Data Transformations
Kafka to Hadoop Ingest with Parsing, Dedup and other Big Data TransformationsKafka to Hadoop Ingest with Parsing, Dedup and other Big Data Transformations
Kafka to Hadoop Ingest with Parsing, Dedup and other Big Data Transformations
 
Apache Kafka at LinkedIn
Apache Kafka at LinkedInApache Kafka at LinkedIn
Apache Kafka at LinkedIn
 
SAP HANA System Replication (HSR) versus SAP Replication Server (SRS)
SAP HANA System Replication (HSR) versus SAP Replication Server (SRS)SAP HANA System Replication (HSR) versus SAP Replication Server (SRS)
SAP HANA System Replication (HSR) versus SAP Replication Server (SRS)
 
Backup and Recovery in MySQL Cluster
Backup and Recovery in MySQL ClusterBackup and Recovery in MySQL Cluster
Backup and Recovery in MySQL Cluster
 
SAP OS/DB Migration using Azure Storage Account
SAP OS/DB Migration using Azure Storage AccountSAP OS/DB Migration using Azure Storage Account
SAP OS/DB Migration using Azure Storage Account
 
Event Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBEvent Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDB
 
Distributed Kafka Architecture Taboola Scale
Distributed Kafka Architecture Taboola ScaleDistributed Kafka Architecture Taboola Scale
Distributed Kafka Architecture Taboola Scale
 
Scalablity and benchmark in mysql performance
Scalablity and benchmark in mysql performanceScalablity and benchmark in mysql performance
Scalablity and benchmark in mysql performance
 

Similaire à Kafka streams fifth elephant 2018

Similaire à Kafka streams fifth elephant 2018 (20)

Stateful streaming and the challenge of state
Stateful streaming and the challenge of stateStateful streaming and the challenge of state
Stateful streaming and the challenge of state
 
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
 
Kafka streams decoupling with stores
Kafka streams decoupling with storesKafka streams decoupling with stores
Kafka streams decoupling with stores
 
Healthcare Claim Reimbursement using Apache Spark
Healthcare Claim Reimbursement using Apache SparkHealthcare Claim Reimbursement using Apache Spark
Healthcare Claim Reimbursement using Apache Spark
 
It's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda ArchitectureIt's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda Architecture
 
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
 
Using Kafka as a Database For Real-Time Transaction Processing | Chad Preisle...
Using Kafka as a Database For Real-Time Transaction Processing | Chad Preisle...Using Kafka as a Database For Real-Time Transaction Processing | Chad Preisle...
Using Kafka as a Database For Real-Time Transaction Processing | Chad Preisle...
 
Apache Kafka Streams
Apache Kafka StreamsApache Kafka Streams
Apache Kafka Streams
 
Introducing Oxia: A Scalable Zookeeper Alternative
Introducing Oxia: A Scalable Zookeeper AlternativeIntroducing Oxia: A Scalable Zookeeper Alternative
Introducing Oxia: A Scalable Zookeeper Alternative
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Leveraging Databricks for Spark Pipelines
Leveraging Databricks for Spark PipelinesLeveraging Databricks for Spark Pipelines
Leveraging Databricks for Spark Pipelines
 
Leveraging Databricks for Spark pipelines
Leveraging Databricks for Spark pipelinesLeveraging Databricks for Spark pipelines
Leveraging Databricks for Spark pipelines
 
Building Effective Near-Real-Time Analytics with Spark Streaming and Kudu
Building Effective Near-Real-Time Analytics with Spark Streaming and KuduBuilding Effective Near-Real-Time Analytics with Spark Streaming and Kudu
Building Effective Near-Real-Time Analytics with Spark Streaming and Kudu
 
Performance Tuning RocksDB for Kafka Streams’ State Stores
Performance Tuning RocksDB for Kafka Streams’ State StoresPerformance Tuning RocksDB for Kafka Streams’ State Stores
Performance Tuning RocksDB for Kafka Streams’ State Stores
 
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, ShopifyIt's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
 
Kafka tiered-storage-meetup-2022-final-presented
Kafka tiered-storage-meetup-2022-final-presentedKafka tiered-storage-meetup-2022-final-presented
Kafka tiered-storage-meetup-2022-final-presented
 
Work with hundred of hot terabytes in JVMs
Work with hundred of hot terabytes in JVMsWork with hundred of hot terabytes in JVMs
Work with hundred of hot terabytes in JVMs
 
Alluxio - Scalable Filesystem Metadata Services
Alluxio - Scalable Filesystem Metadata ServicesAlluxio - Scalable Filesystem Metadata Services
Alluxio - Scalable Filesystem Metadata Services
 
Strata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaStrata London 2019 Scaling Impala
Strata London 2019 Scaling Impala
 
Strata London 2019 Scaling Impala.pptx
Strata London 2019 Scaling Impala.pptxStrata London 2019 Scaling Impala.pptx
Strata London 2019 Scaling Impala.pptx
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

Kafka streams fifth elephant 2018

  • 2. Kakfa Streams Architecture Active / Standby tasks Interactive Queries One Hop Queries Queryable State during Restoration Storage Policies Rack-Aware task allocation. Finite Retention in Changelog Topic Conclusion Q/A Agenda 01 02 03 04 05 06 07 08 09 10
  • 7. • Leader is elected among Kafka Streams Application Instances using Apache Curator Leader Recipe. • Leader pushes any changes to StreamsMetadata to zookeeper • Client Watches Zookeeper Node and is notified of metadata changes. • Client builds up partition -> (Node, port) map and uses it to fetch state related to a given key. OneHop Queries Implementation Details
  • 8. • Currently State Store is queryable only when task is in RUNNING state. • When Primary task fails, Standby is promoted to Primary. But before it can start processing messages / queries it needs to build up state by reading from local state store and changelog kafka topic. • As standby can be arbitrarily behind primary, the amount of changelog to be read can be huge. During this time state store remains non queryable. • Made changes such that store is queryable even when task is in RESTORATION (PARTITION_ASSIGNED) state. • This increases availability of micro-services built on top of Kafka Streams. Queryable State during Restoration
  • 9. • RocksDB is used for storing state in Kafka Streams, and RocksDB works best with SSD’s. • As state gets huge, it becomes costlier to store entire data in SSD’s. • We need to move not-so-recent data to HDD’s, where it is still queryable but does not occupy space on SSD’s. • We implemented configurable storage policies, like Archival Policy, TTL policy. • Archival Policy moves data that is not touched for long time (configurable) from SSD to HDD. • On top of this user can also select to use TTL policy to completely remove state from HDD that is not modified for long time. Storage Policies
  • 10. • In addition to actual data in store, we also store time when a particular key is modified. This information is stored in RocksDB. • Data in RocksDB is of the format <timestamp>#<key> -> key • Since RocksDB supports efficient range queries, this data allows us to find keys that are not modified for long time. • This helps us in enforcing storage policies. Storage Policies Implementation Details
  • 11. • Currently, Kafka Streams does not support rack-awareness while allocating tasks. • This means, it is possible that both Primary and Standby tasks are allocated on the same rack. • This would result in poor fault-tolerance in case of whole rack failures. • We have a config in StreamsConfig called "RACK_ID_CONFIG" which helps StickyPartitionAssignor to assign tasks in such a way that no two replica tasks are on same rack if possible. Rack Aware Task allocation
  • 12. • Changelog topics are log-compacted kafka topics with infinite retention time. • As amount of state of application increases, changelog topics also grow in size and infinite leads to storage consumption on kafka cluster. • To reduce space pressure on kafka cluster we implemented mechanism that allows for configurable amount of retention time in Changelog kafka topic. • When standby task fails and restarted on different machine, it tries to copy state directly from the machine on which primary task is running. And it also replays changelog kafka topic so that state is up-to-date on standby task node. Finite Retention in Changelog Topic
  • 13. • Kafka Streams library allows application developers to write streaming applications. • Kafka Streams borrowed few ideas from Apace Samza and provided new features like Standby Tasks and Interactive Query support. • We implemented few features which helps towards improving performance(one-hop queries), availability (queryable state during RESTORATION phase), fault-tolerance(rack-aware task allocation) etc. Conclusion