SlideShare a Scribd company logo
APACHE BOOKKEEPER KV
STORE AND USE CASES
SHIVJI KUMAR JHA
@ShivjiJha
TRACK: MESSAGING
in/shivjijha
About Me
• Senior MTS at Nutanix
• Platform Engineer
– DBs, SOA, Infra, Streams
• Love
– Distributed data systems
– Open-source software (OSS)
• OSS Contributions
– Apache Pulsar
– MySQL
Contents
Why KV
store?
What is
bookkeeper?
How to use
bookkeeper?
History of Data Stores
4
A Brief History…
Of Databases
• 1960: Flat Files
• 1960s: Hierarchical Databases
• 1980: SQL / Relational Databases
– High-level language
– Abstractions: Schema, Transactions, Indexes
• 2004: NoSQL
– Scale & Availability above all
– No relational model
• 2010s: Distributed SQL
Image source: https://commons.wikimedia.org/wiki/File:Human_evolution.svg
A Brief History…
Of Data Streams
• Apache Kafka:
– Built inside LinkedIn
– 2011: Kafka becomes open source
– 2012: Graduated from Apache incubator
• Apache Pulsar
– Built at Yahoo
– 2016: Contributed to Open source
– 2018: Top-level Apache project
Image source: https://commons.wikimedia.org/wiki/File:Human_evolution.svg
A Brief History…
Of Apache Bookkeeper
• Born at Yahoo! Research
• Evolved from Apache Zookeeper (ZK)
• 2011: Incubated as subproject under ZK
• 2015: Top level Apache Project
Apache Bookkeeper
What is Bookkeeper?
• Infinite Stream of log records
• Horizontally scalable storage
• Fault-tolerant
• Low latency writes
• Offers
– Durability
– Tunable replication
– Strong consistency
Use cases
• As write ahead log (WAL) in
– HDFS namenode (first use case)
– Twitter’s Manhattan : distributed KV
– HerdDB : JVM embeddable distributed
database
• Apache Pulsar : Message & Offset store
• Salesforce : Internal database of
application storage
• Pravega (DellEMC) : Message store
• Bytedance : Internal metadata store
B-tree vs LSM
• Primary data structures for storage engines.
• B-trees behind traditional databases
– MySQL, PostgreSQL
– Indexing for expensive random access on
HDD
• Log structured Merge (LSM) trees
– Good write throughput
– Behind variety of the modern workloads
• Stream : Apache Bookkeeper, Kafka
Streams, Apache Pulsar, Flink,
• OLTP : MyRocks, MongoRocks,
Rocksandra, YugaByte, CockroachDB
• TSDB : influxDB
– Take advantage of SSD throughput
Key Value stores
• KV stores as common core behind:
– Key Value databases
– Relational databases
• Key : Primary Key, Value: Complete row
– Document databases
• Key : Primary Key (internal?), Value: document
– Streaming Platforms
• rocksDB based : Apache Pulsar, Kafka Streams, Flink
• Good idea to have less clusters!
• Good idea to have same base (KV) across clusters!
Bookkeeper = ZK + rocksDB
RocksDB
• Implements LSM
• Embeddable
• Key Value store
• Append only
– Low latency
– High throughput
• Duplicate record for update / delete
• Compaction to remove stale /
deleted records
Zookeeper
• Metadata store
• Cluster coordination
• Service discovery
• Leader election
• Dynamic configurations
• Feature flags
Bookkeeper Internals
18
Bookkeeper Cluster : Replication
https://medium.com/streamnative/why-apache-bookkeeper-part-1-consistency-durability-availability-ac697a3cf7a1
Bookkeeper : Typical Usage
https://medium.com/streamnative/why-apache-bookkeeper-part-1-consistency-durability-availability-ac697a3cf7a1
Bookkeeper Glossary
Entries
Actual data (bytes) written to ledgers.
Plus, metadata
Entry: [ledgerId, entryId, Checksum…]
Entry Log File
Actual physical file with entries
Offsets indexed for fast lookup.
Asynchronous garbage collection of
deleted and stale entries.
Bookkeeper Glossary
Journal
Transaction logs (Write ahead log)
Append only semantics
Low latency, high throughput writes
Turn on / off (durability vs
throughput)
Ledger
Logical unit of storage for APIs in bookkeeper.
Append-only semantics
Indexed & cached for faster lookups
Includes:[Status, lastEntryId, [entries] replication
factors…]
Bookkeeper : Client & Server
•Bookkeeper has no leader / follower.
•Same responsibility across nodes.
•Thick bookie client implements replication, coordination, consistency.
•Separate Auto detection and restore module if entries lost.
Client Based Replication
•Create ledger (sync / async)
•Append entry to ledger
•Read entry from ledger
•Delete Ledger (sync / async)
Bookkeeper APIs
Bookkeeper Server : Write Path
BOOKKEEPER
CLIENT
Bookkeeper Server
Bookkeeper Client
Journal (WAL)
Bookkeeper Server : Write Path
BOOKKEEPER
CLIENT
Bookkeeper Server
Bookkeeper Client
Journal (WAL)
LEDGER APIs
Writes
Bookkeeper Server : Append only
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL)
LEDGER APIs
Writes
Bookkeeper Server : Write Path
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL) Write Cache
LEDGER APIs
Writes
Bookkeeper Server : Read-Write
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL) Write Cache
Read Cache
LEDGER APIs
LEDGER APIs
Writes
Reads
Entry
Log
Files
Bookkeeper Server : IO isolation
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL) Write Cache
Read Cache
LEDGER APIs
LEDGER APIs
disk
disk
Writes
Reads
Entry
Log
Files
Bookkeeper Server : Read Path
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL) Write Cache
Entry
Log
Files
Read Cache
LEDGER APIs
Reads
index
Bookkeeper Server : Flush
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL) Write Cache
Entry
Log
Files
Read Cache
LEDGER APIs
Reads
Asynchronous, batched flush!
Bookkeeper : Offsets
• Sent in response to write()
• Cumulative ack
• Readers can read until LAC
Last add confirmed (LAC)
• Last entry client requested to write.
• Write in progress, not acked yet.
Last add pushed (LAP)
READERS
LAC LAP
WRITER
Entries
Bookkeeper : Recovery
READERS
LAC LAP
WRITER
Entries
Bookkeeper : Recovery
•Writer crashed / network partition
•Client retries / fails
•Retry reaches new bookkeeper node
Bookkeeper Failure
•Put Ledger state in recovery
•Fences old file with consensus.
•Write to new file
•New owner back ? Split brain?
New Bookkeeper owner
READERS
LAC LAP
WRITER
Entries
NEW
WRITER
Bookkeeper:
A Pulsar Use case
35
Apache Pulsar 101
PRODUCER CONSUMER
• Cloud-native,
• Distributed messaging and
• Distributed streaming platform
Apache Pulsar
• Modular Design
• Horizontally scalable
• Low latency & high throughput
• Multi-tenancy
• Geo Replication
Highlights
Apache Pulsar 101
PRODUCER CONSUMER
BROKER
BOOKKEEPER
ZOOKEEPER
Bookkeeper Server : Read-Write
BOOKKEEPER
CLIENT
Bookkeeper Client Bookkeeper Server
Journal (WAL) Write Cache
Read Cache
LEDGER APIs
LEDGER APIs
Writes
Reads
Entry
Log
Files
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Bookkeeper Server
Journal (WAL) Write Cache
Read Cache
LEDGER APIs
LEDGER APIs
Writes
Reads
Entry
Log
Files
BROKER
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Bookkeeper Server
Journal (WAL) Write Cache
Read Cache
LEDGER APIs
LEDGER APIs
Writes
Reads
Entry
Log
Files
BROKER
TOPIC1 TOPIC2 TOPIC3
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Bookkeeper Server
Journal (WAL) Write Cache
Read Cache
LEDGER APIs
LEDGER APIs
Writes
Reads
Entry
Log
Files
BROKER
TOPIC1 TOPIC2 TOPIC3
PRODUCER CONSUMER
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Topic Ledger Mapping
BROKER
TOPIC1 TOPIC2 TOPIC3
TOPIC 3
MANAGED LEDGER
PRODUCER CONSUMER
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Topic Ledger Mapping
BROKER
TOPIC1 TOPIC2 TOPIC3
TOPIC 3
MANAGED LEDGER
PRODUCER CONSUMER
Ledgers[]
schemaLedgers[]
compactedLedgers[]
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Topic Ledger Mapping
BROKER
TOPIC1 TOPIC2 TOPIC3
TOPIC 3
MANAGED LEDGER
PRODUCER CONSUMER
Ledgers[]
schemaLedgers[]
compactedLedgers[]
ledgerId,
entriesRange,
Ledger size, metadata
Pulsar Broker & Bookkeeper
BOOKKEEPER
CLIENT
Pulsar Broker Topic Ledger Mapping
BROKER
TOPIC1 TOPIC2 TOPIC3
TOPIC 3
MANAGED LEDGER
PRODUCER CONSUMER
Ledgers[]
schemaLedgers[]
compactedLedgers[]
ledgerId,
entriesRange,
Ledger size, offloaded?
CURSOR 1 CURSOR 2
CONSUMER 1 CONSUMER 1
Cluster Coordination: Zookeeper
• Pointers to data
– Topic ledgers mapping
– Ledger topics mapping
– Topic schema mapping
• Service Discovery
– List of available bookies
– List of available brokers
– Which broker owns which topic
– How much load on which topic etc
• Distributed coordination
– Locks
– Leader election
• System Configuration
– Dynamic configs for hot reload
– Feature flags
• Provisioning Configuration
– Metadata for tenants, namespaces
– Namespace policies
Summary
• Plethora of databases, workloads, use cases.
– Too many clusters – difficult to operate
• RocksDB : very popular LSM implementation
– High write throughput, leverages SSD throughput
– Varied workloads on rocksDB : databases, queues, streams
• Bookkeeper : Consistent distributed KV base
– Infinite commit log
– Can use in a lot of different ways
– Apache Pulsar is one example, but a lot more building up!
– Fault tolerant, horizontally scalable store behind Pulsar
References
1. Mark Callaghan - Choosing between Efficiency and
Performance with RocksDB
2. FoundationDB Record Layer – White paper
3. Why Apache Bookkeeper part 1 :
consistency,durability,availability By Sijie Guo
4. Understanding How Apache Pulsar works By Jack Vanlightly
5. How Pulsar stores your data – Pulsar Summit NA 2021 By
Shivji Kumar Jha
6. Convergence of Messaging, streaming and storage By Sijie
Guo
THANK YOU
QUESTIONS?
@ShivjiJha
shiv4289
in/shivjijha/
ShivjiKumarJha

More Related Content

What's hot

HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 

What's hot (20)

Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka Streams
 
The Future of Column-Oriented Data Processing With Apache Arrow and Apache Pa...
The Future of Column-Oriented Data Processing With Apache Arrow and Apache Pa...The Future of Column-Oriented Data Processing With Apache Arrow and Apache Pa...
The Future of Column-Oriented Data Processing With Apache Arrow and Apache Pa...
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive Mode
 
The Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systemsThe Google Chubby lock service for loosely-coupled distributed systems
The Google Chubby lock service for loosely-coupled distributed systems
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
 
High-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQLHigh-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQL
 
Schemas Beyond The Edge
Schemas Beyond The EdgeSchemas Beyond The Edge
Schemas Beyond The Edge
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Building zero data loss pipelines with apache kafka
Building zero data loss pipelines with apache kafkaBuilding zero data loss pipelines with apache kafka
Building zero data loss pipelines with apache kafka
 
A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
 A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ... A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
 
Kafka Streams State Stores Being Persistent
Kafka Streams State Stores Being PersistentKafka Streams State Stores Being Persistent
Kafka Streams State Stores Being Persistent
 
Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
NoSQL Databases: Why, what and when
NoSQL Databases: Why, what and whenNoSQL Databases: Why, what and when
NoSQL Databases: Why, what and when
 

Similar to Apache Con 2021 : Apache Bookkeeper Key Value Store and use cases

Similar to Apache Con 2021 : Apache Bookkeeper Key Value Store and use cases (20)

How pulsar stores data at Pulsar-na-summit-2021.pptx (1)
How pulsar stores data at Pulsar-na-summit-2021.pptx (1)How pulsar stores data at Pulsar-na-summit-2021.pptx (1)
How pulsar stores data at Pulsar-na-summit-2021.pptx (1)
 
ログ収集プラットフォーム開発におけるElasticsearchの運用
ログ収集プラットフォーム開発におけるElasticsearchの運用ログ収集プラットフォーム開発におけるElasticsearchの運用
ログ収集プラットフォーム開発におけるElasticsearchの運用
 
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
Akka Streams And Kafka Streams: Where Microservices Meet Fast DataAkka Streams And Kafka Streams: Where Microservices Meet Fast Data
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
 
CosmosDB for DBAs & Developers
CosmosDB for DBAs & DevelopersCosmosDB for DBAs & Developers
CosmosDB for DBAs & Developers
 
Introducing Apache Kafka and why it is important to Oracle, Java and IT profe...
Introducing Apache Kafka and why it is important to Oracle, Java and IT profe...Introducing Apache Kafka and why it is important to Oracle, Java and IT profe...
Introducing Apache Kafka and why it is important to Oracle, Java and IT profe...
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new features
 
Introducing Amazon EMR Release 5.0 - August 2016 Monthly Webinar Series
Introducing Amazon EMR Release 5.0 - August 2016 Monthly Webinar SeriesIntroducing Amazon EMR Release 5.0 - August 2016 Monthly Webinar Series
Introducing Amazon EMR Release 5.0 - August 2016 Monthly Webinar Series
 
If You Have The Content, Then Apache Has The Technology!
If You Have The Content, Then Apache Has The Technology!If You Have The Content, Then Apache Has The Technology!
If You Have The Content, Then Apache Has The Technology!
 
JustGiving | Serverless Data Pipelines, API, Messaging and Stream Processing
JustGiving | Serverless Data Pipelines, API, Messaging and Stream ProcessingJustGiving | Serverless Data Pipelines, API, Messaging and Stream Processing
JustGiving | Serverless Data Pipelines, API, Messaging and Stream Processing
 
JustGiving – Serverless Data Pipelines, API, Messaging and Stream Processing
JustGiving – Serverless Data Pipelines,  API, Messaging and Stream ProcessingJustGiving – Serverless Data Pipelines,  API, Messaging and Stream Processing
JustGiving – Serverless Data Pipelines, API, Messaging and Stream Processing
 
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
 
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech TalksDeep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
 
Why do you consider to adopt Koha Open Source Integrated Library System for y...
Why do you consider to adopt Koha Open Source Integrated Library System for y...Why do you consider to adopt Koha Open Source Integrated Library System for y...
Why do you consider to adopt Koha Open Source Integrated Library System for y...
 
Riak CS Build Your Own Cloud Storage
Riak CS Build Your Own Cloud StorageRiak CS Build Your Own Cloud Storage
Riak CS Build Your Own Cloud Storage
 
Training Slides: Basics 103: The Power of Tungsten Connector / Proxy
Training Slides: Basics 103: The Power of Tungsten Connector / ProxyTraining Slides: Basics 103: The Power of Tungsten Connector / Proxy
Training Slides: Basics 103: The Power of Tungsten Connector / Proxy
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)
 
WSO2Con USA 2017: Building an Effective API Architecture
WSO2Con USA 2017: Building an Effective API ArchitectureWSO2Con USA 2017: Building an Effective API Architecture
WSO2Con USA 2017: Building an Effective API Architecture
 

More from Shivji Kumar Jha

Pulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with Pulsar
Pulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with PulsarPulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with Pulsar
Pulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with Pulsar
Shivji Kumar Jha
 

More from Shivji Kumar Jha (19)

Navigating Transactions: ACID Complexity in Modern Databases
Navigating Transactions: ACID Complexity in Modern DatabasesNavigating Transactions: ACID Complexity in Modern Databases
Navigating Transactions: ACID Complexity in Modern Databases
 
Druid Summit 2023 : Changing Druid Ingestion from 3 hours to 5 minutes
Druid Summit 2023 : Changing Druid Ingestion from 3 hours to 5 minutesDruid Summit 2023 : Changing Druid Ingestion from 3 hours to 5 minutes
Druid Summit 2023 : Changing Druid Ingestion from 3 hours to 5 minutes
 
osi-oss-dbs.pptx
osi-oss-dbs.pptxosi-oss-dbs.pptx
osi-oss-dbs.pptx
 
pulsar-platformatory-meetup-2.pptx
pulsar-platformatory-meetup-2.pptxpulsar-platformatory-meetup-2.pptx
pulsar-platformatory-meetup-2.pptx
 
Pulsar Summit Asia 2022 - Streaming wars and How Apache Pulsar is acing the b...
Pulsar Summit Asia 2022 - Streaming wars and How Apache Pulsar is acing the b...Pulsar Summit Asia 2022 - Streaming wars and How Apache Pulsar is acing the b...
Pulsar Summit Asia 2022 - Streaming wars and How Apache Pulsar is acing the b...
 
Pulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with Pulsar
Pulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with PulsarPulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with Pulsar
Pulsar Summit Asia 2022 - Keeping on top of hybrid cloud usage with Pulsar
 
Pulsar summit asia 2021: Designing Pulsar for Isolation
Pulsar summit asia 2021: Designing Pulsar for IsolationPulsar summit asia 2021: Designing Pulsar for Isolation
Pulsar summit asia 2021: Designing Pulsar for Isolation
 
Event sourcing Live 2021: Streaming App Changes to Event Store
Event sourcing Live 2021: Streaming App Changes to Event StoreEvent sourcing Live 2021: Streaming App Changes to Event Store
Event sourcing Live 2021: Streaming App Changes to Event Store
 
Apache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data StreamingApache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data Streaming
 
Pulsar Summit Asia - Structured Data Stream with Apache Pulsar
Pulsar Summit Asia - Structured Data Stream with Apache PulsarPulsar Summit Asia - Structured Data Stream with Apache Pulsar
Pulsar Summit Asia - Structured Data Stream with Apache Pulsar
 
Pulsar Summit Asia - Running a secure pulsar cluster
Pulsar Summit Asia -  Running a secure pulsar clusterPulsar Summit Asia -  Running a secure pulsar cluster
Pulsar Summit Asia - Running a secure pulsar cluster
 
lessons from managing a pulsar cluster
 lessons from managing a pulsar cluster lessons from managing a pulsar cluster
lessons from managing a pulsar cluster
 
FOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationFOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group Replication
 
MySQL High Availability with Replication New Features
MySQL High Availability with Replication New FeaturesMySQL High Availability with Replication New Features
MySQL High Availability with Replication New Features
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and Scalability
 
MySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL ClusterMySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL Cluster
 
MySQL User Camp: GTIDs
MySQL User Camp: GTIDsMySQL User Camp: GTIDs
MySQL User Camp: GTIDs
 
Open source India - MySQL Labs: Multi-Source Replication
Open source India - MySQL Labs: Multi-Source ReplicationOpen source India - MySQL Labs: Multi-Source Replication
Open source India - MySQL Labs: Multi-Source Replication
 
MySQL User Camp: Multi-threaded Slaves
MySQL User Camp: Multi-threaded SlavesMySQL User Camp: Multi-threaded Slaves
MySQL User Camp: Multi-threaded Slaves
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in Technology
 

Apache Con 2021 : Apache Bookkeeper Key Value Store and use cases

  • 1. APACHE BOOKKEEPER KV STORE AND USE CASES SHIVJI KUMAR JHA @ShivjiJha TRACK: MESSAGING in/shivjijha
  • 2. About Me • Senior MTS at Nutanix • Platform Engineer – DBs, SOA, Infra, Streams • Love – Distributed data systems – Open-source software (OSS) • OSS Contributions – Apache Pulsar – MySQL
  • 4. History of Data Stores 4
  • 5. A Brief History… Of Databases • 1960: Flat Files • 1960s: Hierarchical Databases • 1980: SQL / Relational Databases – High-level language – Abstractions: Schema, Transactions, Indexes • 2004: NoSQL – Scale & Availability above all – No relational model • 2010s: Distributed SQL Image source: https://commons.wikimedia.org/wiki/File:Human_evolution.svg
  • 6. A Brief History… Of Data Streams • Apache Kafka: – Built inside LinkedIn – 2011: Kafka becomes open source – 2012: Graduated from Apache incubator • Apache Pulsar – Built at Yahoo – 2016: Contributed to Open source – 2018: Top-level Apache project Image source: https://commons.wikimedia.org/wiki/File:Human_evolution.svg
  • 7. A Brief History… Of Apache Bookkeeper • Born at Yahoo! Research • Evolved from Apache Zookeeper (ZK) • 2011: Incubated as subproject under ZK • 2015: Top level Apache Project
  • 8. Apache Bookkeeper What is Bookkeeper? • Infinite Stream of log records • Horizontally scalable storage • Fault-tolerant • Low latency writes • Offers – Durability – Tunable replication – Strong consistency Use cases • As write ahead log (WAL) in – HDFS namenode (first use case) – Twitter’s Manhattan : distributed KV – HerdDB : JVM embeddable distributed database • Apache Pulsar : Message & Offset store • Salesforce : Internal database of application storage • Pravega (DellEMC) : Message store • Bytedance : Internal metadata store
  • 9. B-tree vs LSM • Primary data structures for storage engines. • B-trees behind traditional databases – MySQL, PostgreSQL – Indexing for expensive random access on HDD • Log structured Merge (LSM) trees – Good write throughput – Behind variety of the modern workloads • Stream : Apache Bookkeeper, Kafka Streams, Apache Pulsar, Flink, • OLTP : MyRocks, MongoRocks, Rocksandra, YugaByte, CockroachDB • TSDB : influxDB – Take advantage of SSD throughput
  • 10. Key Value stores • KV stores as common core behind: – Key Value databases – Relational databases • Key : Primary Key, Value: Complete row – Document databases • Key : Primary Key (internal?), Value: document – Streaming Platforms • rocksDB based : Apache Pulsar, Kafka Streams, Flink • Good idea to have less clusters! • Good idea to have same base (KV) across clusters!
  • 11. Bookkeeper = ZK + rocksDB RocksDB • Implements LSM • Embeddable • Key Value store • Append only – Low latency – High throughput • Duplicate record for update / delete • Compaction to remove stale / deleted records Zookeeper • Metadata store • Cluster coordination • Service discovery • Leader election • Dynamic configurations • Feature flags
  • 13. Bookkeeper Cluster : Replication https://medium.com/streamnative/why-apache-bookkeeper-part-1-consistency-durability-availability-ac697a3cf7a1
  • 14. Bookkeeper : Typical Usage https://medium.com/streamnative/why-apache-bookkeeper-part-1-consistency-durability-availability-ac697a3cf7a1
  • 15. Bookkeeper Glossary Entries Actual data (bytes) written to ledgers. Plus, metadata Entry: [ledgerId, entryId, Checksum…] Entry Log File Actual physical file with entries Offsets indexed for fast lookup. Asynchronous garbage collection of deleted and stale entries.
  • 16. Bookkeeper Glossary Journal Transaction logs (Write ahead log) Append only semantics Low latency, high throughput writes Turn on / off (durability vs throughput) Ledger Logical unit of storage for APIs in bookkeeper. Append-only semantics Indexed & cached for faster lookups Includes:[Status, lastEntryId, [entries] replication factors…]
  • 17. Bookkeeper : Client & Server •Bookkeeper has no leader / follower. •Same responsibility across nodes. •Thick bookie client implements replication, coordination, consistency. •Separate Auto detection and restore module if entries lost. Client Based Replication •Create ledger (sync / async) •Append entry to ledger •Read entry from ledger •Delete Ledger (sync / async) Bookkeeper APIs
  • 18. Bookkeeper Server : Write Path BOOKKEEPER CLIENT Bookkeeper Server Bookkeeper Client Journal (WAL)
  • 19. Bookkeeper Server : Write Path BOOKKEEPER CLIENT Bookkeeper Server Bookkeeper Client Journal (WAL) LEDGER APIs Writes
  • 20. Bookkeeper Server : Append only BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) LEDGER APIs Writes
  • 21. Bookkeeper Server : Write Path BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) Write Cache LEDGER APIs Writes
  • 22. Bookkeeper Server : Read-Write BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) Write Cache Read Cache LEDGER APIs LEDGER APIs Writes Reads Entry Log Files
  • 23. Bookkeeper Server : IO isolation BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) Write Cache Read Cache LEDGER APIs LEDGER APIs disk disk Writes Reads Entry Log Files
  • 24. Bookkeeper Server : Read Path BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) Write Cache Entry Log Files Read Cache LEDGER APIs Reads index
  • 25. Bookkeeper Server : Flush BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) Write Cache Entry Log Files Read Cache LEDGER APIs Reads Asynchronous, batched flush!
  • 26. Bookkeeper : Offsets • Sent in response to write() • Cumulative ack • Readers can read until LAC Last add confirmed (LAC) • Last entry client requested to write. • Write in progress, not acked yet. Last add pushed (LAP) READERS LAC LAP WRITER Entries
  • 27. Bookkeeper : Recovery READERS LAC LAP WRITER Entries
  • 28. Bookkeeper : Recovery •Writer crashed / network partition •Client retries / fails •Retry reaches new bookkeeper node Bookkeeper Failure •Put Ledger state in recovery •Fences old file with consensus. •Write to new file •New owner back ? Split brain? New Bookkeeper owner READERS LAC LAP WRITER Entries NEW WRITER
  • 30. Apache Pulsar 101 PRODUCER CONSUMER • Cloud-native, • Distributed messaging and • Distributed streaming platform Apache Pulsar • Modular Design • Horizontally scalable • Low latency & high throughput • Multi-tenancy • Geo Replication Highlights
  • 31. Apache Pulsar 101 PRODUCER CONSUMER BROKER BOOKKEEPER ZOOKEEPER
  • 32. Bookkeeper Server : Read-Write BOOKKEEPER CLIENT Bookkeeper Client Bookkeeper Server Journal (WAL) Write Cache Read Cache LEDGER APIs LEDGER APIs Writes Reads Entry Log Files
  • 33. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Bookkeeper Server Journal (WAL) Write Cache Read Cache LEDGER APIs LEDGER APIs Writes Reads Entry Log Files BROKER
  • 34. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Bookkeeper Server Journal (WAL) Write Cache Read Cache LEDGER APIs LEDGER APIs Writes Reads Entry Log Files BROKER TOPIC1 TOPIC2 TOPIC3
  • 35. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Bookkeeper Server Journal (WAL) Write Cache Read Cache LEDGER APIs LEDGER APIs Writes Reads Entry Log Files BROKER TOPIC1 TOPIC2 TOPIC3 PRODUCER CONSUMER
  • 36. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Topic Ledger Mapping BROKER TOPIC1 TOPIC2 TOPIC3 TOPIC 3 MANAGED LEDGER PRODUCER CONSUMER
  • 37. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Topic Ledger Mapping BROKER TOPIC1 TOPIC2 TOPIC3 TOPIC 3 MANAGED LEDGER PRODUCER CONSUMER Ledgers[] schemaLedgers[] compactedLedgers[]
  • 38. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Topic Ledger Mapping BROKER TOPIC1 TOPIC2 TOPIC3 TOPIC 3 MANAGED LEDGER PRODUCER CONSUMER Ledgers[] schemaLedgers[] compactedLedgers[] ledgerId, entriesRange, Ledger size, metadata
  • 39. Pulsar Broker & Bookkeeper BOOKKEEPER CLIENT Pulsar Broker Topic Ledger Mapping BROKER TOPIC1 TOPIC2 TOPIC3 TOPIC 3 MANAGED LEDGER PRODUCER CONSUMER Ledgers[] schemaLedgers[] compactedLedgers[] ledgerId, entriesRange, Ledger size, offloaded? CURSOR 1 CURSOR 2 CONSUMER 1 CONSUMER 1
  • 40. Cluster Coordination: Zookeeper • Pointers to data – Topic ledgers mapping – Ledger topics mapping – Topic schema mapping • Service Discovery – List of available bookies – List of available brokers – Which broker owns which topic – How much load on which topic etc • Distributed coordination – Locks – Leader election • System Configuration – Dynamic configs for hot reload – Feature flags • Provisioning Configuration – Metadata for tenants, namespaces – Namespace policies
  • 41. Summary • Plethora of databases, workloads, use cases. – Too many clusters – difficult to operate • RocksDB : very popular LSM implementation – High write throughput, leverages SSD throughput – Varied workloads on rocksDB : databases, queues, streams • Bookkeeper : Consistent distributed KV base – Infinite commit log – Can use in a lot of different ways – Apache Pulsar is one example, but a lot more building up! – Fault tolerant, horizontally scalable store behind Pulsar
  • 42. References 1. Mark Callaghan - Choosing between Efficiency and Performance with RocksDB 2. FoundationDB Record Layer – White paper 3. Why Apache Bookkeeper part 1 : consistency,durability,availability By Sijie Guo 4. Understanding How Apache Pulsar works By Jack Vanlightly 5. How Pulsar stores your data – Pulsar Summit NA 2021 By Shivji Kumar Jha 6. Convergence of Messaging, streaming and storage By Sijie Guo