SlideShare a Scribd company logo
BigQueue
A Big, Fast and Persistent
Queue
    - by William
    http://bulldog2011.github.com/
Feature Highlights
   Fast
         enqueue and dequeue are close to O(1) direct memory access.
   Big
         Only limited by available disk space.
   Persistent
         Data is persisted on disk and is crash resistant.
   Reliable
         OS will be responsible for message persistence even your process crashes.
   Realtime
         Produced messages will be immediately visible to consumers
   Flexible Queue Semantics
         Consume once queue, fanout queue, can even consume by index
   Memory-efficient
         Automatic pagging & swapping algorithm, only most recently accessed data is kept in memory.
   Thread-safe
         Multiple threads can concurrently enqueue and dequeue without data corruption.
   Simple & Light-weight
         Current library jar is less than 40K.
Performance Highlights

   In concurrent producing and consuming case,
    average throughput is around 166MBps.
   In sequential producing then consuming case,
    average throughput is around 333MBps.
Design – Logical View

   Looks just like a big array or a circular array
Design – Consume Once and Fanout
Semantics Support
Design – Physical View : Paged Index +
Data File
Design – Components View
Design – Dynamic View :
Memory Mapped Sliding Window
Concurrency

   Produce(or append) is synchronized in the
    queue implementation
   Consume(or read) is already thread-safe
Simple Interface

   Creation
    IBigQueue bigQueue = new BigQueueImpl("d:/bigqueue/tutorial",
    "demo");
   Enqueue
     for(int i = 0; i < 10; i++) {
        String item = String.valueOf(i);
        bigQueue.enqueue(item.getBytes());
    }
   Dequeue
    for(int i = 0; i < 5; i++) {
      String item = new String(bigQueue.dequeue());
    }
   Peek
     byte[] data = bigQueue.peek();
Fanout Queue
   Creation
    IFanOutQueue foQueue = new FanOutQueueImpl("d:/tutorial/fanout-queue", "demo");
   Enqueue
     for(int i = 0; i < 10; i++) {
       String log = "log-" + i;
       foQueue.enqueue(log.getBytes());
    }
   Fanout 1 Dequeue
    String fanoutId1 = "realtime";
    while(!foQueue.isEmpty(fanoutId1)) {
        String item = new String(foQueue.dequeue(fanoutId1));
        System.out.println(item);
    }
   Fanout 2 Dequeue
    String fanoutId2 = "offline";
    while(!foQueue.isEmpty(fanoutId2)) {
        String item = new String(foQueue.dequeue(fanoutId2));
        System.out.println(item);
    }
    Fanout 1 and Fanout 2 consuming are independent
Fanout Queue Semantics
Use Case 1 :
Log Collecting & Consuming
Use Case 2 :
Big Data Sorting
        Queue Only Algorithm:
    1.     Put all data into a source queue
    2.     Build a queueOfSortedQueues by dividing and
           sorting the source queue
    3.     Merge sort the queueOfSortedQueues
    4.     The last one left in the queueOfSortedQueues
           is the final sorted queue
Source, Samples, Docs and Tutorials


    https://github.com/bulldog2011/bigqueue
Other Alternatives

   Apache ActiveMQ
       http://activemq.apache.org
   RabbitMQ
       http://www.rabbitmq.com/
   ZeroMQ
       http://www.zeromq.org
   Kestrel
       https://github.com/robey/kestrel
   Apache Kafka
       http://kafka.apache.org

More Related Content

What's hot

CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
 
B.Tech CSE Marksheets_10_B. Tech Degree
B.Tech CSE Marksheets_10_B. Tech DegreeB.Tech CSE Marksheets_10_B. Tech Degree
B.Tech CSE Marksheets_10_B. Tech Degreetusharchowdhury1503
 
How to build pitching deck - Entrepreneur
How to build pitching deck - EntrepreneurHow to build pitching deck - Entrepreneur
How to build pitching deck - Entrepreneur
Trivena Mamarodia
 
스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트
스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트 스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트
스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트
HwanJin 'David' Choi
 
Statement of result
Statement of resultStatement of result
Statement of result
Dominique Hërnandêz
 
Bachelor's Degree Certificate
Bachelor's Degree CertificateBachelor's Degree Certificate
Bachelor's Degree CertificateEvelyne Mukami
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
Komal Samdariya
 
Ajax
AjaxAjax
The walking dead (103)
The walking dead (103)The walking dead (103)
The walking dead (103)
Azhroth B.S
 

What's hot (14)

Consolidated Marksheet
Consolidated MarksheetConsolidated Marksheet
Consolidated Marksheet
 
se marksheet
se marksheetse marksheet
se marksheet
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
B.Tech CSE Marksheets_10_B. Tech Degree
B.Tech CSE Marksheets_10_B. Tech DegreeB.Tech CSE Marksheets_10_B. Tech Degree
B.Tech CSE Marksheets_10_B. Tech Degree
 
How to build pitching deck - Entrepreneur
How to build pitching deck - EntrepreneurHow to build pitching deck - Entrepreneur
How to build pitching deck - Entrepreneur
 
스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트
스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트 스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트
스타트업 비즈니스 현황 분석 및 향후 계획 수립 진단 및 점검 시트
 
Statement of result
Statement of resultStatement of result
Statement of result
 
Recommendation Letter 1
Recommendation Letter 1Recommendation Letter 1
Recommendation Letter 1
 
Bachelor's Degree Certificate
Bachelor's Degree CertificateBachelor's Degree Certificate
Bachelor's Degree Certificate
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
 
Ajax
AjaxAjax
Ajax
 
The walking dead (103)
The walking dead (103)The walking dead (103)
The walking dead (103)
 
B.S.C CERTIFICATE
B.S.C CERTIFICATEB.S.C CERTIFICATE
B.S.C CERTIFICATE
 
College Testimonial
College TestimonialCollege Testimonial
College Testimonial
 

Similar to A Big, Fast and Persistent Queue

StorageQuery: federated querying on object stores, powered by Alluxio and Presto
StorageQuery: federated querying on object stores, powered by Alluxio and PrestoStorageQuery: federated querying on object stores, powered by Alluxio and Presto
StorageQuery: federated querying on object stores, powered by Alluxio and Presto
Alluxio, Inc.
 
Apache ZooKeeper TechTuesday
Apache ZooKeeper TechTuesdayApache ZooKeeper TechTuesday
Apache ZooKeeper TechTuesdayAndrei Savu
 
Java 7 Features and Enhancements
Java 7 Features and EnhancementsJava 7 Features and Enhancements
Java 7 Features and Enhancements
Gagan Agrawal
 
Project Tungsten: Bringing Spark Closer to Bare Metal
Project Tungsten: Bringing Spark Closer to Bare MetalProject Tungsten: Bringing Spark Closer to Bare Metal
Project Tungsten: Bringing Spark Closer to Bare Metal
Databricks
 
What’s new in Alluxio 2: from seamless operations to structured data management
What’s new in Alluxio 2: from seamless operations to structured data managementWhat’s new in Alluxio 2: from seamless operations to structured data management
What’s new in Alluxio 2: from seamless operations to structured data management
Alluxio, Inc.
 
Speeding Up Spark Performance using Alluxio at China Unicom
Speeding Up Spark Performance using Alluxio at China UnicomSpeeding Up Spark Performance using Alluxio at China Unicom
Speeding Up Spark Performance using Alluxio at China Unicom
Alluxio, Inc.
 
Fedora Overview
Fedora OverviewFedora Overview
Fedora Overvieweposthumus
 
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
Travis Oliphant
 
dotMemory 4 - What's inside?
dotMemory 4 - What's inside?dotMemory 4 - What's inside?
dotMemory 4 - What's inside?
Maarten Balliauw
 
Hadoop Vectored IO
Hadoop Vectored IOHadoop Vectored IO
Hadoop Vectored IO
Steve Loughran
 
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
MukundThakur22
 
Alluxio Use Cases at Strata+Hadoop World Beijing 2016
Alluxio Use Cases at Strata+Hadoop World Beijing 2016Alluxio Use Cases at Strata+Hadoop World Beijing 2016
Alluxio Use Cases at Strata+Hadoop World Beijing 2016
Alluxio, Inc.
 
Reproducibility and automation of machine learning process
Reproducibility and automation of machine learning processReproducibility and automation of machine learning process
Reproducibility and automation of machine learning process
Denis Dus
 
Mutexes 2
Mutexes 2Mutexes 2
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
Yu-Shuan Hsieh
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
Sven Ruppert
 
EUDAT Generic Execution Framework
EUDAT Generic Execution FrameworkEUDAT Generic Execution Framework
EUDAT Generic Execution Framework
EUDAT
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
Mahendra M
 
XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014
Vincent Massol
 
06 file processing
06 file processing06 file processing
06 file processingIssay Meii
 

Similar to A Big, Fast and Persistent Queue (20)

StorageQuery: federated querying on object stores, powered by Alluxio and Presto
StorageQuery: federated querying on object stores, powered by Alluxio and PrestoStorageQuery: federated querying on object stores, powered by Alluxio and Presto
StorageQuery: federated querying on object stores, powered by Alluxio and Presto
 
Apache ZooKeeper TechTuesday
Apache ZooKeeper TechTuesdayApache ZooKeeper TechTuesday
Apache ZooKeeper TechTuesday
 
Java 7 Features and Enhancements
Java 7 Features and EnhancementsJava 7 Features and Enhancements
Java 7 Features and Enhancements
 
Project Tungsten: Bringing Spark Closer to Bare Metal
Project Tungsten: Bringing Spark Closer to Bare MetalProject Tungsten: Bringing Spark Closer to Bare Metal
Project Tungsten: Bringing Spark Closer to Bare Metal
 
What’s new in Alluxio 2: from seamless operations to structured data management
What’s new in Alluxio 2: from seamless operations to structured data managementWhat’s new in Alluxio 2: from seamless operations to structured data management
What’s new in Alluxio 2: from seamless operations to structured data management
 
Speeding Up Spark Performance using Alluxio at China Unicom
Speeding Up Spark Performance using Alluxio at China UnicomSpeeding Up Spark Performance using Alluxio at China Unicom
Speeding Up Spark Performance using Alluxio at China Unicom
 
Fedora Overview
Fedora OverviewFedora Overview
Fedora Overview
 
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
 
dotMemory 4 - What's inside?
dotMemory 4 - What's inside?dotMemory 4 - What's inside?
dotMemory 4 - What's inside?
 
Hadoop Vectored IO
Hadoop Vectored IOHadoop Vectored IO
Hadoop Vectored IO
 
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
[ACNA2022] Hadoop Vectored IO_ your data just got faster!.pdf
 
Alluxio Use Cases at Strata+Hadoop World Beijing 2016
Alluxio Use Cases at Strata+Hadoop World Beijing 2016Alluxio Use Cases at Strata+Hadoop World Beijing 2016
Alluxio Use Cases at Strata+Hadoop World Beijing 2016
 
Reproducibility and automation of machine learning process
Reproducibility and automation of machine learning processReproducibility and automation of machine learning process
Reproducibility and automation of machine learning process
 
Mutexes 2
Mutexes 2Mutexes 2
Mutexes 2
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
EUDAT Generic Execution Framework
EUDAT Generic Execution FrameworkEUDAT Generic Execution Framework
EUDAT Generic Execution Framework
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
 
XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014
 
06 file processing
06 file processing06 file processing
06 file processing
 

More from William Yang

MicroServices architecture @ Ctrip v1.1
MicroServices architecture @ Ctrip v1.1MicroServices architecture @ Ctrip v1.1
MicroServices architecture @ Ctrip v1.1
William Yang
 
Antifragile, Microservices and DevOps - A Study
Antifragile, Microservices and DevOps - A StudyAntifragile, Microservices and DevOps - A Study
Antifragile, Microservices and DevOps - A Study
William Yang
 
From SOA to MSA
From SOA to MSAFrom SOA to MSA
From SOA to MSA
William Yang
 
Nano
NanoNano
Luxun a Persistent Messaging System Tailored for Big Data Collecting & Analytics
Luxun a Persistent Messaging System Tailored for Big Data Collecting & AnalyticsLuxun a Persistent Messaging System Tailored for Big Data Collecting & Analytics
Luxun a Persistent Messaging System Tailored for Big Data Collecting & Analytics
William Yang
 
Easy Web Serivce on iOS with Pico
Easy Web Serivce on iOS with PicoEasy Web Serivce on iOS with Pico
Easy Web Serivce on iOS with Pico
William Yang
 

More from William Yang (6)

MicroServices architecture @ Ctrip v1.1
MicroServices architecture @ Ctrip v1.1MicroServices architecture @ Ctrip v1.1
MicroServices architecture @ Ctrip v1.1
 
Antifragile, Microservices and DevOps - A Study
Antifragile, Microservices and DevOps - A StudyAntifragile, Microservices and DevOps - A Study
Antifragile, Microservices and DevOps - A Study
 
From SOA to MSA
From SOA to MSAFrom SOA to MSA
From SOA to MSA
 
Nano
NanoNano
Nano
 
Luxun a Persistent Messaging System Tailored for Big Data Collecting & Analytics
Luxun a Persistent Messaging System Tailored for Big Data Collecting & AnalyticsLuxun a Persistent Messaging System Tailored for Big Data Collecting & Analytics
Luxun a Persistent Messaging System Tailored for Big Data Collecting & Analytics
 
Easy Web Serivce on iOS with Pico
Easy Web Serivce on iOS with PicoEasy Web Serivce on iOS with Pico
Easy Web Serivce on iOS with Pico
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
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
Tobias Schneck
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
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
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

A Big, Fast and Persistent Queue

  • 1. BigQueue A Big, Fast and Persistent Queue - by William http://bulldog2011.github.com/
  • 2. Feature Highlights  Fast  enqueue and dequeue are close to O(1) direct memory access.  Big  Only limited by available disk space.  Persistent  Data is persisted on disk and is crash resistant.  Reliable  OS will be responsible for message persistence even your process crashes.  Realtime  Produced messages will be immediately visible to consumers  Flexible Queue Semantics  Consume once queue, fanout queue, can even consume by index  Memory-efficient  Automatic pagging & swapping algorithm, only most recently accessed data is kept in memory.  Thread-safe  Multiple threads can concurrently enqueue and dequeue without data corruption.  Simple & Light-weight  Current library jar is less than 40K.
  • 3. Performance Highlights  In concurrent producing and consuming case, average throughput is around 166MBps.  In sequential producing then consuming case, average throughput is around 333MBps.
  • 4. Design – Logical View  Looks just like a big array or a circular array
  • 5. Design – Consume Once and Fanout Semantics Support
  • 6. Design – Physical View : Paged Index + Data File
  • 8. Design – Dynamic View : Memory Mapped Sliding Window
  • 9. Concurrency  Produce(or append) is synchronized in the queue implementation  Consume(or read) is already thread-safe
  • 10. Simple Interface  Creation IBigQueue bigQueue = new BigQueueImpl("d:/bigqueue/tutorial", "demo");  Enqueue for(int i = 0; i < 10; i++) { String item = String.valueOf(i); bigQueue.enqueue(item.getBytes()); }  Dequeue for(int i = 0; i < 5; i++) { String item = new String(bigQueue.dequeue()); }  Peek byte[] data = bigQueue.peek();
  • 11. Fanout Queue  Creation IFanOutQueue foQueue = new FanOutQueueImpl("d:/tutorial/fanout-queue", "demo");  Enqueue for(int i = 0; i < 10; i++) { String log = "log-" + i; foQueue.enqueue(log.getBytes()); }  Fanout 1 Dequeue String fanoutId1 = "realtime"; while(!foQueue.isEmpty(fanoutId1)) { String item = new String(foQueue.dequeue(fanoutId1)); System.out.println(item); }  Fanout 2 Dequeue String fanoutId2 = "offline"; while(!foQueue.isEmpty(fanoutId2)) { String item = new String(foQueue.dequeue(fanoutId2)); System.out.println(item); } Fanout 1 and Fanout 2 consuming are independent
  • 13. Use Case 1 : Log Collecting & Consuming
  • 14. Use Case 2 : Big Data Sorting  Queue Only Algorithm: 1. Put all data into a source queue 2. Build a queueOfSortedQueues by dividing and sorting the source queue 3. Merge sort the queueOfSortedQueues 4. The last one left in the queueOfSortedQueues is the final sorted queue
  • 15. Source, Samples, Docs and Tutorials https://github.com/bulldog2011/bigqueue
  • 16. Other Alternatives  Apache ActiveMQ  http://activemq.apache.org  RabbitMQ  http://www.rabbitmq.com/  ZeroMQ  http://www.zeromq.org  Kestrel  https://github.com/robey/kestrel  Apache Kafka  http://kafka.apache.org