SlideShare a Scribd company logo
Asynchronous Processing
in Big System
Lê Minh Nghĩa
Solution Architect at Tiki.vn
Big System’s Targets
• High Performance
• High Scalability
• High Reliable
• Low Cost Maintenance
Problems
• IO Bottleneck
• Scale Processing
• Handle a Huge Concurrent Request
• Availability and Partition Fault Tolerance
• Deal with consistency and concurrency
Split to Scale
• If you can’t split, you can’t scale it
• From Monolithic System to Distributed System
• From One to Many Processing
• From One to Many Persistent
• From Single to Parallel Processing
• From Synchronous to Asynchronous
Data Replication
• Every nodes need a way to communicate with
other
• Data replication is the most important in
distributed system
• The reliability of a system depends on the way
data replication
Replicate Model
• Primary Data Backup
• State Machine Model
(Active Active Model)
What’s Reliable
Replication?
• No Lost Data
• Guarantee Ordering
• High Scalability
• Easy Integration
Message Queue
• Message Queue is the key to split and scale
system
• It’s the solution for reliable replication
• But It’s not simple as we think…
Message Queue
1. Guarantee No Lost Data
We usually do both:
- Write Data To DB
- Send Message To
Queue
Database
Message
Queue
Processing
Problems, In fact:
- Can Write But Can’t
Send
- Can Send But Cant’
Write
1. Guarantee No Lost Data
• Solutions:
• Use One Way data flow:
Process —> Database —> Message Queue
• Use Transaction Log to Dispatch Data Changes
1. Guarantee No Lost Data
2. Guarantee
Sending Ordering
• Problems:
• Each request sending out
one message at the
same time, in different
threads
• One of the messages can
be fail in sending
• That cause the messages
are not in ordering
2. Guarantee
Sending Ordering
• Use Transaction Log To Append Un-dispatched
Message in Order
• Asynchronous Sending Un-Dispatched Message
to Message Queue
2. Guarantee
Sending Ordering
Transaction
Undispatched
Message
Write
Polling
Worker
1. Poll Messages
Message Bus
2. Publish Messages
3. Remove Messages
3. Guarantee
Delivery Ordering
E2 E3 E4E1
Worker 1 Worker 2 Worker 3 Worker 4
- Events are dequeued in
concurrency by many
workers
- Message Queue can
guarantee first in first out
- The later event can be
processed faster than the
earlier event —> cause lost
ordering
3. Guarantee
Delivery Ordering
• Solutions:
• if use Rabbit MQ/Active MQ: use only one
consumer for a queue
• If use Kafka, Kafka guarantee ordering delivery
message per each partition. Only one thread of a
consumer group can receive message from a
partition
4. Idempotemcy Filtering
• This is about duplicate message
• A message can be delivery more than one time
• Example: can deposit twice because receive
deposit message twice
4. Idempotemcy Filtering
• Solutions:
• Use UUID/GUID v4 for message id
• Use timestamp or version of message to detect
duplicate
5. Versoning Message
• Replicated data is
always eventually
consistency
• Sometime we
need to know
about how stale
data is
V4 V3 V2V5
Write V5 Read V1
5. Versoning Message
• Use timestamp
• Use incremental version (integer)
• Guarantee increase version consistency when
write data
6. Non Blocking IO
• How to handle million
messages in a queue?
• Solutions:
• Processing message in
pipeline.
• Split processing in three
separated phases: receiving,
handling and completing
message
• Each phase is processing in
parallel
receiving
handling
completing
7. Capture Data Changes
• Is the way capture data changes of DB to
replicate data to Message Queue
• Use specific mechanism of DB to know the
changes of Data
MySQL Bin Log
• Decode My
SQL Bin Log
to know new
data changes
MySQL My SQL Binlog
Event Handler
Decode Bin Log
Message Queue
Postgresql Notification
• Use Postgres
Notification to
notify the
changes of
data
Postgresql
Notification
Receiver
Message Queue
Notify
Thank You
• Contact: Lê Minh Nghĩa
• Email: nghia.fit@gmail.com
• Facebook: /nghialeminh

More Related Content

What's hot (20)

PPTX
Maria db 이중화구성_고민하기
NeoClova
 
PDF
Kinh nghiệm triển khai Microservices tại Sapo.vn
Dotnet Open Group
 
PDF
Introduction to Redis
Dvir Volk
 
PDF
Bizweb Microservices Architecture
Khôi Nguyễn Minh
 
PPTX
Microservices Part 3 Service Mesh and Kafka
Araf Karsh Hamid
 
PDF
High Concurrency Architecture at TIKI
Nghia Minh
 
PDF
Microservice - Up to 500k CCU
Viet Tran
 
PPTX
[넥슨] kubernetes 소개 (2018)
용호 최
 
PDF
Event Driven-Architecture from a Scalability perspective
Jonas Bonér
 
PPTX
Redis introduction
Federico Daniel Colombo Gennarelli
 
PDF
Gitlab, GitOps & ArgoCD
Haggai Philip Zagury
 
PDF
Intro to HBase
alexbaranau
 
PDF
Design patterns for microservice architecture
The Software House
 
PDF
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
mumrah
 
PDF
Introduction to MongoDB
Mike Dirolf
 
PPTX
Architecture Sustaining LINE Sticker services
LINE Corporation
 
PDF
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
SeungYong Oh
 
PDF
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
confluent
 
PDF
How to Write Great Kafka Connectors
confluent
 
PDF
Kubernetes Basics
Eueung Mulyana
 
Maria db 이중화구성_고민하기
NeoClova
 
Kinh nghiệm triển khai Microservices tại Sapo.vn
Dotnet Open Group
 
Introduction to Redis
Dvir Volk
 
Bizweb Microservices Architecture
Khôi Nguyễn Minh
 
Microservices Part 3 Service Mesh and Kafka
Araf Karsh Hamid
 
High Concurrency Architecture at TIKI
Nghia Minh
 
Microservice - Up to 500k CCU
Viet Tran
 
[넥슨] kubernetes 소개 (2018)
용호 최
 
Event Driven-Architecture from a Scalability perspective
Jonas Bonér
 
Gitlab, GitOps & ArgoCD
Haggai Philip Zagury
 
Intro to HBase
alexbaranau
 
Design patterns for microservice architecture
The Software House
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
mumrah
 
Introduction to MongoDB
Mike Dirolf
 
Architecture Sustaining LINE Sticker services
LINE Corporation
 
Elastic Stack 을 이용한 게임 서비스 통합 로깅 플랫폼 - elastic{on} 2019 Seoul
SeungYong Oh
 
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
confluent
 
How to Write Great Kafka Connectors
confluent
 
Kubernetes Basics
Eueung Mulyana
 

Similar to Asynchronous processing in big system (20)

PPTX
Message and Stream Oriented Communication
Dilum Bandara
 
PPTX
Synchronous and asynchronous software communication components
Panagiotis Tsilopoulos
 
PPTX
SOA Pattern-Asynchronous Queuing
WSO2
 
PDF
Work Queue Systems
David Butler
 
PDF
Async Messaging in CQRS: Part 1 - Masstransit
George Tourkas
 
PPTX
Scalable Persistent Message Brokering with WSO2 Message Broker
Srinath Perera
 
PPTX
NServiceBus - building a distributed system based on a messaging infrastructure
Mauro Servienti
 
DOCX
White paper for High Performance Messaging App Dev with Oracle AQ
Jeff Jacobs
 
PDF
The Current State of Asynchronous Processing With Ruby
mattmatt
 
PPTX
Designing distributed systems
Malisa Ncube
 
PPTX
RabbitMQ vs Apache Kafka Part II Webinar
Erlang Solutions
 
PPT
1 messagepassing-121015032028-phpapp01
Zaigham Abbas
 
PPTX
designing distributed scalable and reliable systems
Mauro Servienti
 
PDF
9 queuing
ashish61_scs
 
PDF
Async Messaging in CQRS: Part 1 - Masstransit + DDD Intro
George Tourkas
 
PPTX
NServiceBus - introduction to a message based distributed architecture
Mauro Servienti
 
PPT
Apache ActiveMQ - Enterprise messaging in action
dejanb
 
PPT
13 tm adv
ashish61_scs
 
PPTX
Overview of Message Queues
Bozhidar Bozhanov
 
PDF
Application Integration Patterns (not only) for Microservices
Dennis Traub
 
Message and Stream Oriented Communication
Dilum Bandara
 
Synchronous and asynchronous software communication components
Panagiotis Tsilopoulos
 
SOA Pattern-Asynchronous Queuing
WSO2
 
Work Queue Systems
David Butler
 
Async Messaging in CQRS: Part 1 - Masstransit
George Tourkas
 
Scalable Persistent Message Brokering with WSO2 Message Broker
Srinath Perera
 
NServiceBus - building a distributed system based on a messaging infrastructure
Mauro Servienti
 
White paper for High Performance Messaging App Dev with Oracle AQ
Jeff Jacobs
 
The Current State of Asynchronous Processing With Ruby
mattmatt
 
Designing distributed systems
Malisa Ncube
 
RabbitMQ vs Apache Kafka Part II Webinar
Erlang Solutions
 
1 messagepassing-121015032028-phpapp01
Zaigham Abbas
 
designing distributed scalable and reliable systems
Mauro Servienti
 
9 queuing
ashish61_scs
 
Async Messaging in CQRS: Part 1 - Masstransit + DDD Intro
George Tourkas
 
NServiceBus - introduction to a message based distributed architecture
Mauro Servienti
 
Apache ActiveMQ - Enterprise messaging in action
dejanb
 
13 tm adv
ashish61_scs
 
Overview of Message Queues
Bozhidar Bozhanov
 
Application Integration Patterns (not only) for Microservices
Dennis Traub
 
Ad

Recently uploaded (20)

PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Python basic programing language for automation
DanialHabibi2
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
July Patch Tuesday
Ivanti
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Ad

Asynchronous processing in big system

  • 1. Asynchronous Processing in Big System Lê Minh Nghĩa Solution Architect at Tiki.vn
  • 2. Big System’s Targets • High Performance • High Scalability • High Reliable • Low Cost Maintenance
  • 3. Problems • IO Bottleneck • Scale Processing • Handle a Huge Concurrent Request • Availability and Partition Fault Tolerance • Deal with consistency and concurrency
  • 4. Split to Scale • If you can’t split, you can’t scale it • From Monolithic System to Distributed System • From One to Many Processing • From One to Many Persistent • From Single to Parallel Processing • From Synchronous to Asynchronous
  • 5. Data Replication • Every nodes need a way to communicate with other • Data replication is the most important in distributed system • The reliability of a system depends on the way data replication
  • 6. Replicate Model • Primary Data Backup • State Machine Model (Active Active Model)
  • 7. What’s Reliable Replication? • No Lost Data • Guarantee Ordering • High Scalability • Easy Integration
  • 8. Message Queue • Message Queue is the key to split and scale system • It’s the solution for reliable replication • But It’s not simple as we think…
  • 10. 1. Guarantee No Lost Data We usually do both: - Write Data To DB - Send Message To Queue Database Message Queue Processing Problems, In fact: - Can Write But Can’t Send - Can Send But Cant’ Write
  • 11. 1. Guarantee No Lost Data • Solutions: • Use One Way data flow: Process —> Database —> Message Queue • Use Transaction Log to Dispatch Data Changes
  • 12. 1. Guarantee No Lost Data
  • 13. 2. Guarantee Sending Ordering • Problems: • Each request sending out one message at the same time, in different threads • One of the messages can be fail in sending • That cause the messages are not in ordering
  • 14. 2. Guarantee Sending Ordering • Use Transaction Log To Append Un-dispatched Message in Order • Asynchronous Sending Un-Dispatched Message to Message Queue
  • 15. 2. Guarantee Sending Ordering Transaction Undispatched Message Write Polling Worker 1. Poll Messages Message Bus 2. Publish Messages 3. Remove Messages
  • 16. 3. Guarantee Delivery Ordering E2 E3 E4E1 Worker 1 Worker 2 Worker 3 Worker 4 - Events are dequeued in concurrency by many workers - Message Queue can guarantee first in first out - The later event can be processed faster than the earlier event —> cause lost ordering
  • 17. 3. Guarantee Delivery Ordering • Solutions: • if use Rabbit MQ/Active MQ: use only one consumer for a queue • If use Kafka, Kafka guarantee ordering delivery message per each partition. Only one thread of a consumer group can receive message from a partition
  • 18. 4. Idempotemcy Filtering • This is about duplicate message • A message can be delivery more than one time • Example: can deposit twice because receive deposit message twice
  • 19. 4. Idempotemcy Filtering • Solutions: • Use UUID/GUID v4 for message id • Use timestamp or version of message to detect duplicate
  • 20. 5. Versoning Message • Replicated data is always eventually consistency • Sometime we need to know about how stale data is V4 V3 V2V5 Write V5 Read V1
  • 21. 5. Versoning Message • Use timestamp • Use incremental version (integer) • Guarantee increase version consistency when write data
  • 22. 6. Non Blocking IO • How to handle million messages in a queue? • Solutions: • Processing message in pipeline. • Split processing in three separated phases: receiving, handling and completing message • Each phase is processing in parallel receiving handling completing
  • 23. 7. Capture Data Changes • Is the way capture data changes of DB to replicate data to Message Queue • Use specific mechanism of DB to know the changes of Data
  • 24. MySQL Bin Log • Decode My SQL Bin Log to know new data changes MySQL My SQL Binlog Event Handler Decode Bin Log Message Queue
  • 25. Postgresql Notification • Use Postgres Notification to notify the changes of data Postgresql Notification Receiver Message Queue Notify
  • 26. Thank You • Contact: Lê Minh Nghĩa • Email: [email protected] • Facebook: /nghialeminh