bigqueue

Light, fast and persistent queue.

License

License

GroupId

GroupId

org.kairosdb
ArtifactId

ArtifactId

bigqueue
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

bigqueue
Light, fast and persistent queue.
Project URL

Project URL

https://github.com/kairosdb/bigqueue
Source Code Management

Source Code Management

https://github.com/kairosdb/bigqueue

Download bigqueue

How to add to project

<!-- https://jarcasting.com/artifacts/org.kairosdb/bigqueue/ -->
<dependency>
    <groupId>org.kairosdb</groupId>
    <artifactId>bigqueue</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.kairosdb/bigqueue/
implementation 'org.kairosdb:bigqueue:1.0.1'
// https://jarcasting.com/artifacts/org.kairosdb/bigqueue/
implementation ("org.kairosdb:bigqueue:1.0.1")
'org.kairosdb:bigqueue:jar:1.0.1'
<dependency org="org.kairosdb" name="bigqueue" rev="1.0.1">
  <artifact name="bigqueue" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.kairosdb', module='bigqueue', version='1.0.1')
)
libraryDependencies += "org.kairosdb" % "bigqueue" % "1.0.1"
[org.kairosdb/bigqueue "1.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.26
org.kairosdb : metrics4j jar 0.7.0

test (4)

Group / Artifact Type Version
junit : junit jar 4.10
org.mockito : mockito-all jar 1.9.5
org.assertj : assertj-core jar 3.16.1
org.slf4j : slf4j-log4j12 jar 1.7.6

Project Modules

There are no modules declared in this project.

Big Queue

A big, fast and persistent queue based on memory mapped file.

Notice, bigqueue is just a standalone library, for a high-throughput, persistent, distributed, publish-subscrible messaging system, please refer to Luxun, Luxun messaging system uses bigqueue internally as fast and persistent queue.

Double Notice, I (Owner of Kairosdb) have forked this code with the intention of maintaining it. It is some amazing code and it has been neglected for a few years. BigQueue is a critical part of KairosDB and in other projects I've created.

Feature Highlight:

  1. Fast: close to the speed of direct memory access, both enqueue and dequeue are close to O(1) memory access.
  2. Big: the total size of the queue is only limited by the available disk space.
  3. Persistent: all data in the queue is persisted on disk, and is crash resistant.
  4. Reliable: OS will be responsible to presist the produced messages even your process crashes.
  5. Realtime: messages produced by producer threads will be immediately visible to consumer threads.
  6. Memory-efficient: automatic paging & swapping algorithm, only most-recently accessed data is kept in memory.
  7. Thread-safe: multiple threads can concurrently enqueue and dequeue without data corruption.
  8. Simple&Light-weight: current number of source files is 12 and the library jar is less than 30K.
  9. Metrics: queue metrics provided by metrics4j.

The Big Picture

Memory Mapped Sliding Window

design

Performance Highlight:

  • In concurrent producing and consuming case, the average throughput is around 166M bytes per second.
  • In sequential producing then consuming case, the average throughput is around 333M bytes per second.

Suppose the average message size is 1KB, then big queue can concurrently producing and consuming
166K message per second. Basically, the throughput is only limited by disk IO bandwidth.

here is a detailed performance report

How to Use

  1. Direct jar or source reference
    Download jar from the github release section.
    Note : bigqueue depends on log4j, please also added log4j jar reference if you use bigqueue.

  2. Maven reference

     <dependency>
       <groupId>org.kairosdb</groupId>
       <artifactId>bigqueue</artifactId>
       <version>1.0.0</version>
     </dependency>
    

Docs

  1. a simple design doc
  2. big queue tutorial
  3. fanout queue tutorial
  4. big array tutorial
  5. how to turn big queue into a thrift based queue service
  6. use case : producing and consuming 4TB log daily on one commodity machine
  7. use case : sort and search 100GB data on a single commodity machine
  8. the architecture and design of a pub-sub messaging system tailored for big data collecting and analytics
  9. a big, fast and persistent queue[ppt]

Version History

1.0.0 - June 23, 2020 :

  • Full code review and fixed a few bugs found along the way
  • Added metrics4j

0.7.0 - March 24, 2013 : repository

  • Feature: support fanout queue semantics
  • Enhancement: make data file size configurable

0.6.1 — January 29, 2013 : repository

  • Initial version:)

Copyright and License

Copyright 2012 Leansoft Technology [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

org.kairosdb

Versions

Version
1.0.1
1.0.0