SlideShare a Scribd company logo
Using Cassandra for event logging
Presentation

Using Cassandra for event logging
Ivan Burmistrov
SKB Kontur

December 9th, 2013
Using Cassandra for event logging
EDI

We develop EDI (Electronic data interchange) system.
Using Cassandra for event logging
EDI

We develop EDI (Electronic data interchange) system.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
EventLogger

interface IEventLogger
{
void Write ( Event [] events ) ;
Event [] Read ( Event exclusiveEvent , int count ) ;
}

Availability for Read and Write.
Fast Write.
Read with minimal time lag.
No events in past while we making Read.
Same events chronology in any thread.
For any thread events orders for write and read are equals.
Using Cassandra for event logging
Obvious solution

Event
string EventId;
long Timestamp;
byte[] Content;
Using Cassandra for event logging
Obvious solution

Write(Event[] events)
Write columns for each event e:
e.Timestamp = NowTicks;
RowKey = e.Timestamp / Partition;
ColumnName = e.Timestamp + ":" + e.EventId;
ColumnValue = e.Content;
Read(Event exclusiveEvent, int count)
Execute get_slice from exclusive column;
Skip events with Timestamp > NowTicks - TimeLag.
Using Cassandra for event logging
Obvious solution

Write(Event[] events)
Write columns for each event e:
e.Timestamp = NowTicks;
RowKey = e.Timestamp / Partition;
ColumnName = e.Timestamp + ":" + e.EventId;
ColumnValue = e.Content;
Read(Event exclusiveEvent, int count)
Execute get_slice from exclusive column;
Skip events with Timestamp > NowTicks - TimeLag.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Easy implementation.
Write action is very fast.
Disadvantages
TimeLag =
TimeLag >
TimeLag >
TimeLag >

?
WriteTimeout + SyncDiff;
ReadTimeout + SyncDiff;
Cassandra worst write time;

We can’t cache events in unstable zone, if we want to read
events from it. I.e. more requests −→ more CPU for cassandra.
Using Cassandra for event logging
Our algorithm

Event
string EventId;
long Timestamp;
byte[] Content;
State State (Good or Bad);
Using Cassandra for event logging
Our algorithm

Write(Event event)
Timestamp = NowTicks, State = Bad, write event.
Are there Good events with bigger Timestamp?
No? State = Good, rewrite event.
Yes? Delete event and try again.
Using Cassandra for event logging
Our algorithm

Write(Event event)
Timestamp = NowTicks, State = Bad, write event.
Are there Good events with bigger Timestamp?
No? State = Good, rewrite event.
Yes? Delete event and try again.
Using Cassandra for event logging
Our algorithm

Write(Event event)
Timestamp = NowTicks, State = Bad, write event.
Are there Good events with bigger Timestamp?
No? State = Good, rewrite event.
Yes? Delete event and try again.
Using Cassandra for event logging
Our algorithm

Write(Event event)
Timestamp = NowTicks, State = Bad, write event.
Are there Good events with bigger Timestamp?
No? State = Good, rewrite event.
Yes? Delete event and try again.
Using Cassandra for event logging
Our algorithm

Read
We can read events (same as obvious solution) while it’s Good.
Using Cassandra for event logging
Our algorithm

Read
We can read events (same as obvious solution) while it’s Good.
Using Cassandra for event logging
Our algorithm

TimeLag = ?
TimeLag do not depends on timeouts.
Less write intensity −→ less TimeLag.
Less cassandra write time −→ less TimeLag.
Using Cassandra for event logging
Our algorithm

TimeLag = ?
TimeLag do not depends on timeouts.
Less write intensity −→ less TimeLag.
Less cassandra write time −→ less TimeLag.
Using Cassandra for event logging
Our algorithm

TimeLag = ?
TimeLag do not depends on timeouts.
Less write intensity −→ less TimeLag.
Less cassandra write time −→ less TimeLag.
Using Cassandra for event logging
Improvements

Improvements
"Are there Good events with bigger Timestamp?" for O(1).
Queue write requests and process its by batches.
We could remove the dependency from time sync, if NowTicks
will be monotonous.
Using Cassandra for event logging
Improvements

Improvements
"Are there Good events with bigger Timestamp?" for O(1).
Queue write requests and process its by batches.
We could remove the dependency from time sync, if NowTicks
will be monotonous.
Using Cassandra for event logging
Improvements

Improvements
"Are there Good events with bigger Timestamp?" for O(1).
Queue write requests and process its by batches.
We could remove the dependency from time sync, if NowTicks
will be monotonous.
Using Cassandra for event logging
Sharding

Simple sharding
We can divide all entities by independent parts.
For each part we can use separate eventLogger.
Using Cassandra for event logging
Sharding

Simple sharding
We can divide all entities by independent parts.
For each part we can use separate eventLogger.
Using Cassandra for event logging
Sharding

Sharding for reading
Timestamp = NowTicks, State = Bad, write events in
different rows.
Are there Good events with bigger Timestamp in any row?
No? State = Good, rewrite events.
Yes? Delete event and try again.
Using Cassandra for event logging
Sharding

Sharding for reading
Timestamp = NowTicks, State = Bad, write events in
different rows.
Are there Good events with bigger Timestamp in any row?
No? State = Good, rewrite events.
Yes? Delete event and try again.
Using Cassandra for event logging
Sharding

Sharding for reading
Timestamp = NowTicks, State = Bad, write events in
different rows.
Are there Good events with bigger Timestamp in any row?
No? State = Good, rewrite events.
Yes? Delete event and try again.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Small size of time lag. For 3500 writes per sec worst time lag
is 50ms and 10 events.
More cacheable.
Easy sharding.
Can be independed from time sync.
Disadvantages
More slow writes. But still enough fast.
Limit for writing threads.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Small size of time lag. For 3500 writes per sec worst time lag
is 50ms and 10 events.
More cacheable.
Easy sharding.
Can be independed from time sync.
Disadvantages
More slow writes. But still enough fast.
Limit for writing threads.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Small size of time lag. For 3500 writes per sec worst time lag
is 50ms and 10 events.
More cacheable.
Easy sharding.
Can be independed from time sync.
Disadvantages
More slow writes. But still enough fast.
Limit for writing threads.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Small size of time lag. For 3500 writes per sec worst time lag
is 50ms and 10 events.
More cacheable.
Easy sharding.
Can be independed from time sync.
Disadvantages
More slow writes. But still enough fast.
Limit for writing threads.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Small size of time lag. For 3500 writes per sec worst time lag
is 50ms and 10 events.
More cacheable.
Easy sharding.
Can be independed from time sync.
Disadvantages
More slow writes. But still enough fast.
Limit for writing threads.
Using Cassandra for event logging
Advantages and disadvantages

Advantages
Small size of time lag. For 3500 writes per sec worst time lag
is 50ms and 10 events.
More cacheable.
Easy sharding.
Can be independed from time sync.
Disadvantages
More slow writes. But still enough fast.
Limit for writing threads.
Using Cassandra for event logging
Another applications

Another applications
Indexing. We can use event log as notification about change
state of some objects −→ indexing. Cacheable is very useful
here!
Message queues.
Using Cassandra for event logging
Another applications

Another applications
Indexing. We can use event log as notification about change
state of some objects −→ indexing. Cacheable is very useful
here!
Message queues.

More Related Content

PDF
Taskerman: A Distributed Cluster Task Manager
PDF
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
PDF
Store stream data on Data Lake
PDF
QCon London 2016 - Patterns of reliable in-stream processing @ Scale
PPTX
Node Summit 2018 - Optimize your Lambda functions
PDF
How Spotify scales Apache Storm Pipelines
PDF
Azure Functions - Get rid of your servers, use functions!
PPTX
S3 cassandra or outer space? dumping time series data using spark
Taskerman: A Distributed Cluster Task Manager
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
Store stream data on Data Lake
QCon London 2016 - Patterns of reliable in-stream processing @ Scale
Node Summit 2018 - Optimize your Lambda functions
How Spotify scales Apache Storm Pipelines
Azure Functions - Get rid of your servers, use functions!
S3 cassandra or outer space? dumping time series data using spark

What's hot (20)

PDF
Intro to AWS Lambda
PPTX
Mario on spark
PPT
Fun421 stephens
PDF
distributed tracing in 5 minutes
PDF
Scalable Anomaly Detection (with Zero Machine Learning)
PDF
Spark streaming: Best Practices
PDF
Building a fully-automated Fast Data Platform
PDF
Openstack meetup lyon_2017-09-28
PDF
Counters At Scale - A Cautionary Tale
PDF
Data Streaming Ecosystem Management at Booking.com
PDF
Blueflood: Open Source Metrics Processing at CassandraEU 2013
PDF
Node withoutservers aws-lambda
PDF
Anatomy of an action
PPTX
About time
PDF
Reactor, Reactive streams and MicroServices
PPTX
Ingesting data streams with a serverless infrastructure
PDF
Openstack on Fedora, Fedora on Openstack: An Introduction to cloud IaaS
PDF
Tracing Microservices with Zipkin
PDF
Spark Streaming into context
PDF
AWS Cost Control: Cloud Custodian
Intro to AWS Lambda
Mario on spark
Fun421 stephens
distributed tracing in 5 minutes
Scalable Anomaly Detection (with Zero Machine Learning)
Spark streaming: Best Practices
Building a fully-automated Fast Data Platform
Openstack meetup lyon_2017-09-28
Counters At Scale - A Cautionary Tale
Data Streaming Ecosystem Management at Booking.com
Blueflood: Open Source Metrics Processing at CassandraEU 2013
Node withoutservers aws-lambda
Anatomy of an action
About time
Reactor, Reactive streams and MicroServices
Ingesting data streams with a serverless infrastructure
Openstack on Fedora, Fedora on Openstack: An Introduction to cloud IaaS
Tracing Microservices with Zipkin
Spark Streaming into context
AWS Cost Control: Cloud Custodian
Ad

Viewers also liked (20)

PDF
Евгений Тихонов "Введение в Cassandra". Выступление на Cassandrd conf 2013
PDF
Javantura v2 - Data modeling with Apapche Cassandra - Marko Švaljek
PDF
Олег Анастасьев "Ближе к Cassandra". Выступление на Cassandra Conf 2013
PDF
Александр Соловьев "Cassandra in-e commerce". Выступление на Cassandra conf 2013
PDF
Aleksey Yeschenko "Моделирование данных с помощью CQL3". Выступление на Cassa...
PPTX
Ольга Соболева и Кирилл Иванов "Обработка транзакций на примере телекоммуника...
PDF
Евгений Курпилянский "Индексирование поверх Cassandra". Выступление на Cassan...
PDF
CodeFest 2013. Анастасьев О. — Класс!ная Cassandra
PDF
Jonathan Ellis "Apache Cassandra 2.0 and 2.1". Выступление на Cassandra conf ...
PPTX
Максим Сычев и Александр Коковин "Как мы переезжали на Cassandra". Выступлени...
PDF
CQL3 and Data Modeling 101 with Apache Cassandra
PDF
Александр Сабинин "Организация динамической циклической очереди задач для ска...
PDF
Java Runtime: повседневные обязанности JVM
PPTX
Apache Cassandra, part 2 – data model example, machinery
PDF
Класс!ная Cassandra
PDF
C*ollege Credit: Data Modeling for Apache Cassandra
PDF
Платформа для видео сроком в квартал. Александр Тоболь.
PPTX
Introduction in CUDA (1-3)
PDF
Cassandra 101
PDF
За гранью NoSQL: NewSQL на Cassandra
Евгений Тихонов "Введение в Cassandra". Выступление на Cassandrd conf 2013
Javantura v2 - Data modeling with Apapche Cassandra - Marko Švaljek
Олег Анастасьев "Ближе к Cassandra". Выступление на Cassandra Conf 2013
Александр Соловьев "Cassandra in-e commerce". Выступление на Cassandra conf 2013
Aleksey Yeschenko "Моделирование данных с помощью CQL3". Выступление на Cassa...
Ольга Соболева и Кирилл Иванов "Обработка транзакций на примере телекоммуника...
Евгений Курпилянский "Индексирование поверх Cassandra". Выступление на Cassan...
CodeFest 2013. Анастасьев О. — Класс!ная Cassandra
Jonathan Ellis "Apache Cassandra 2.0 and 2.1". Выступление на Cassandra conf ...
Максим Сычев и Александр Коковин "Как мы переезжали на Cassandra". Выступлени...
CQL3 and Data Modeling 101 with Apache Cassandra
Александр Сабинин "Организация динамической циклической очереди задач для ска...
Java Runtime: повседневные обязанности JVM
Apache Cassandra, part 2 – data model example, machinery
Класс!ная Cassandra
C*ollege Credit: Data Modeling for Apache Cassandra
Платформа для видео сроком в квартал. Александр Тоболь.
Introduction in CUDA (1-3)
Cassandra 101
За гранью NoSQL: NewSQL на Cassandra
Ad

Similar to Иван Бурмистров "Строго ориентированная последовательность временных событий". Выступление на Cassandra Сonf 2013 (20)

PDF
AWS Lambda
PPTX
Beam me up, Samza!
PDF
Building a serverless company on AWS lambda and Serverless framework
ODP
Persistent Read-Side in Lagom
PDF
Lightbend Lagom: Microservices Just Right
PPTX
Native cloud security monitoring
PDF
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
PDF
Event Sourcing - what could possibly go wrong?
PDF
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
PDF
Event Sourcing - what could go wrong - Jfokus 2022
PDF
Low latency stream processing with jet
PDF
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
PPTX
Fun With Reactive Extensions
PPTX
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
PDF
Scalable complex event processing on samza @UBER
PDF
Event Stream Processing with Kafka and Samza
PDF
Writing and deploying serverless python applications
PDF
Flink Forward SF 2017: Srikanth Satya & Tom Kaitchuck - Pravega: Storage Rei...
PDF
A New Perspective on Resource-Level Cloud Forensics
AWS Lambda
Beam me up, Samza!
Building a serverless company on AWS lambda and Serverless framework
Persistent Read-Side in Lagom
Lightbend Lagom: Microservices Just Right
Native cloud security monitoring
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Event Sourcing - what could possibly go wrong?
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Event Sourcing - what could go wrong - Jfokus 2022
Low latency stream processing with jet
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Fun With Reactive Extensions
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Scalable complex event processing on samza @UBER
Event Stream Processing with Kafka and Samza
Writing and deploying serverless python applications
Flink Forward SF 2017: Srikanth Satya & Tom Kaitchuck - Pravega: Storage Rei...
A New Perspective on Resource-Level Cloud Forensics

More from it-people (20)

PDF
«Про аналитику и серебряные пули» Александр Подсобляев, Rambler&Co
PDF
«Scrapy internals» Александр Сибиряков, Scrapinghub
PDF
«Отладка в Python 3.6: Быстрее, Выше, Сильнее» Елизавета Шашкова, JetBrains
PDF
«Gevent — быть или не быть?» Александр Мокров, Positive Technologies
PDF
«Ещё один Поиск Яндекса» Александр Кошелев, Яндекс
PDF
«How I Learned to Stop Worrying and Love the BFG: нагрузочное тестирование со...
PDF
«Write once run anywhere — почём опиум для народа?» Игорь Новиков, Scalr
PDF
«Gensim — тематическое моделирование для людей» Иван Меньших, Лев Константино...
PDF
«Тотальный контроль производительности» Михаил Юматов, ЦИАН
PDF
«Детские болезни live-чата» Ольга Сентемова, Тинькофф Банк
PDF
«Микросервисы наносят ответный удар!» Олег Чуркин, Rambler&Co
PDF
«Память и Python. Что надо знать для счастья?» Алексей Кузьмин, ЦНС
PDF
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
PDF
«Python на острие бритвы: PyPy project» Александр Кошкин, Positive Technologies
PDF
«PyWat. А хорошо ли вы знаете Python?» Александр Швец, Marilyn System
PDF
«(Без)опасный Python», Иван Цыганов, Positive Technologies
PDF
«Python of Things», Кирилл Борисов, Яндекс
PDF
«Как сделать так, чтобы тесты на Swift не причиняли боль» Сычев Александр, Ra...
PDF
«Клиенту и серверу нужно поговорить» Прокопов Никита, Cognician
PDF
«Кошелек или деньги: сложный выбор между памятью и процессором» Алексеенко Иг...
«Про аналитику и серебряные пули» Александр Подсобляев, Rambler&Co
«Scrapy internals» Александр Сибиряков, Scrapinghub
«Отладка в Python 3.6: Быстрее, Выше, Сильнее» Елизавета Шашкова, JetBrains
«Gevent — быть или не быть?» Александр Мокров, Positive Technologies
«Ещё один Поиск Яндекса» Александр Кошелев, Яндекс
«How I Learned to Stop Worrying and Love the BFG: нагрузочное тестирование со...
«Write once run anywhere — почём опиум для народа?» Игорь Новиков, Scalr
«Gensim — тематическое моделирование для людей» Иван Меньших, Лев Константино...
«Тотальный контроль производительности» Михаил Юматов, ЦИАН
«Детские болезни live-чата» Ольга Сентемова, Тинькофф Банк
«Микросервисы наносят ответный удар!» Олег Чуркин, Rambler&Co
«Память и Python. Что надо знать для счастья?» Алексей Кузьмин, ЦНС
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
«Python на острие бритвы: PyPy project» Александр Кошкин, Positive Technologies
«PyWat. А хорошо ли вы знаете Python?» Александр Швец, Marilyn System
«(Без)опасный Python», Иван Цыганов, Positive Technologies
«Python of Things», Кирилл Борисов, Яндекс
«Как сделать так, чтобы тесты на Swift не причиняли боль» Сычев Александр, Ra...
«Клиенту и серверу нужно поговорить» Прокопов Никита, Cognician
«Кошелек или деньги: сложный выбор между памятью и процессором» Алексеенко Иг...

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
cuic standard and advanced reporting.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Modernizing your data center with Dell and AMD
PPTX
A Presentation on Artificial Intelligence
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
Machine learning based COVID-19 study performance prediction
Network Security Unit 5.pdf for BCA BBA.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
20250228 LYD VKU AI Blended-Learning.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Chapter 3 Spatial Domain Image Processing.pdf
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
cuic standard and advanced reporting.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Modernizing your data center with Dell and AMD
A Presentation on Artificial Intelligence
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Unlocking AI with Model Context Protocol (MCP)

Иван Бурмистров "Строго ориентированная последовательность временных событий". Выступление на Cassandra Сonf 2013

  • 1. Using Cassandra for event logging Presentation Using Cassandra for event logging Ivan Burmistrov SKB Kontur December 9th, 2013
  • 2. Using Cassandra for event logging EDI We develop EDI (Electronic data interchange) system.
  • 3. Using Cassandra for event logging EDI We develop EDI (Electronic data interchange) system.
  • 4. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 5. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 6. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 7. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 8. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 9. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 10. Using Cassandra for event logging EventLogger interface IEventLogger { void Write ( Event [] events ) ; Event [] Read ( Event exclusiveEvent , int count ) ; } Availability for Read and Write. Fast Write. Read with minimal time lag. No events in past while we making Read. Same events chronology in any thread. For any thread events orders for write and read are equals.
  • 11. Using Cassandra for event logging Obvious solution Event string EventId; long Timestamp; byte[] Content;
  • 12. Using Cassandra for event logging Obvious solution Write(Event[] events) Write columns for each event e: e.Timestamp = NowTicks; RowKey = e.Timestamp / Partition; ColumnName = e.Timestamp + ":" + e.EventId; ColumnValue = e.Content; Read(Event exclusiveEvent, int count) Execute get_slice from exclusive column; Skip events with Timestamp > NowTicks - TimeLag.
  • 13. Using Cassandra for event logging Obvious solution Write(Event[] events) Write columns for each event e: e.Timestamp = NowTicks; RowKey = e.Timestamp / Partition; ColumnName = e.Timestamp + ":" + e.EventId; ColumnValue = e.Content; Read(Event exclusiveEvent, int count) Execute get_slice from exclusive column; Skip events with Timestamp > NowTicks - TimeLag.
  • 14. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 15. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 16. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 17. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 18. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 19. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 20. Using Cassandra for event logging Advantages and disadvantages Advantages Easy implementation. Write action is very fast. Disadvantages TimeLag = TimeLag > TimeLag > TimeLag > ? WriteTimeout + SyncDiff; ReadTimeout + SyncDiff; Cassandra worst write time; We can’t cache events in unstable zone, if we want to read events from it. I.e. more requests −→ more CPU for cassandra.
  • 21. Using Cassandra for event logging Our algorithm Event string EventId; long Timestamp; byte[] Content; State State (Good or Bad);
  • 22. Using Cassandra for event logging Our algorithm Write(Event event) Timestamp = NowTicks, State = Bad, write event. Are there Good events with bigger Timestamp? No? State = Good, rewrite event. Yes? Delete event and try again.
  • 23. Using Cassandra for event logging Our algorithm Write(Event event) Timestamp = NowTicks, State = Bad, write event. Are there Good events with bigger Timestamp? No? State = Good, rewrite event. Yes? Delete event and try again.
  • 24. Using Cassandra for event logging Our algorithm Write(Event event) Timestamp = NowTicks, State = Bad, write event. Are there Good events with bigger Timestamp? No? State = Good, rewrite event. Yes? Delete event and try again.
  • 25. Using Cassandra for event logging Our algorithm Write(Event event) Timestamp = NowTicks, State = Bad, write event. Are there Good events with bigger Timestamp? No? State = Good, rewrite event. Yes? Delete event and try again.
  • 26. Using Cassandra for event logging Our algorithm Read We can read events (same as obvious solution) while it’s Good.
  • 27. Using Cassandra for event logging Our algorithm Read We can read events (same as obvious solution) while it’s Good.
  • 28. Using Cassandra for event logging Our algorithm TimeLag = ? TimeLag do not depends on timeouts. Less write intensity −→ less TimeLag. Less cassandra write time −→ less TimeLag.
  • 29. Using Cassandra for event logging Our algorithm TimeLag = ? TimeLag do not depends on timeouts. Less write intensity −→ less TimeLag. Less cassandra write time −→ less TimeLag.
  • 30. Using Cassandra for event logging Our algorithm TimeLag = ? TimeLag do not depends on timeouts. Less write intensity −→ less TimeLag. Less cassandra write time −→ less TimeLag.
  • 31. Using Cassandra for event logging Improvements Improvements "Are there Good events with bigger Timestamp?" for O(1). Queue write requests and process its by batches. We could remove the dependency from time sync, if NowTicks will be monotonous.
  • 32. Using Cassandra for event logging Improvements Improvements "Are there Good events with bigger Timestamp?" for O(1). Queue write requests and process its by batches. We could remove the dependency from time sync, if NowTicks will be monotonous.
  • 33. Using Cassandra for event logging Improvements Improvements "Are there Good events with bigger Timestamp?" for O(1). Queue write requests and process its by batches. We could remove the dependency from time sync, if NowTicks will be monotonous.
  • 34. Using Cassandra for event logging Sharding Simple sharding We can divide all entities by independent parts. For each part we can use separate eventLogger.
  • 35. Using Cassandra for event logging Sharding Simple sharding We can divide all entities by independent parts. For each part we can use separate eventLogger.
  • 36. Using Cassandra for event logging Sharding Sharding for reading Timestamp = NowTicks, State = Bad, write events in different rows. Are there Good events with bigger Timestamp in any row? No? State = Good, rewrite events. Yes? Delete event and try again.
  • 37. Using Cassandra for event logging Sharding Sharding for reading Timestamp = NowTicks, State = Bad, write events in different rows. Are there Good events with bigger Timestamp in any row? No? State = Good, rewrite events. Yes? Delete event and try again.
  • 38. Using Cassandra for event logging Sharding Sharding for reading Timestamp = NowTicks, State = Bad, write events in different rows. Are there Good events with bigger Timestamp in any row? No? State = Good, rewrite events. Yes? Delete event and try again.
  • 39. Using Cassandra for event logging Advantages and disadvantages Advantages Small size of time lag. For 3500 writes per sec worst time lag is 50ms and 10 events. More cacheable. Easy sharding. Can be independed from time sync. Disadvantages More slow writes. But still enough fast. Limit for writing threads.
  • 40. Using Cassandra for event logging Advantages and disadvantages Advantages Small size of time lag. For 3500 writes per sec worst time lag is 50ms and 10 events. More cacheable. Easy sharding. Can be independed from time sync. Disadvantages More slow writes. But still enough fast. Limit for writing threads.
  • 41. Using Cassandra for event logging Advantages and disadvantages Advantages Small size of time lag. For 3500 writes per sec worst time lag is 50ms and 10 events. More cacheable. Easy sharding. Can be independed from time sync. Disadvantages More slow writes. But still enough fast. Limit for writing threads.
  • 42. Using Cassandra for event logging Advantages and disadvantages Advantages Small size of time lag. For 3500 writes per sec worst time lag is 50ms and 10 events. More cacheable. Easy sharding. Can be independed from time sync. Disadvantages More slow writes. But still enough fast. Limit for writing threads.
  • 43. Using Cassandra for event logging Advantages and disadvantages Advantages Small size of time lag. For 3500 writes per sec worst time lag is 50ms and 10 events. More cacheable. Easy sharding. Can be independed from time sync. Disadvantages More slow writes. But still enough fast. Limit for writing threads.
  • 44. Using Cassandra for event logging Advantages and disadvantages Advantages Small size of time lag. For 3500 writes per sec worst time lag is 50ms and 10 events. More cacheable. Easy sharding. Can be independed from time sync. Disadvantages More slow writes. But still enough fast. Limit for writing threads.
  • 45. Using Cassandra for event logging Another applications Another applications Indexing. We can use event log as notification about change state of some objects −→ indexing. Cacheable is very useful here! Message queues.
  • 46. Using Cassandra for event logging Another applications Another applications Indexing. We can use event log as notification about change state of some objects −→ indexing. Cacheable is very useful here! Message queues.