Giter Club home page Giter Club logo

xonoer / queue-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mettcat/queue-client

0.0 0.0 0.0 2.16 MB

在公司接了一个任务,完成一个项目数据同步的模块。要求是不能操作项目的数据库。怕操作不当,数据丢失。所以想到的方案是使用log4jdbc记录数据源的SQL语句到日志文件。然后按行读取日志文件中的数据,记录读取的Point,以便下次继续读取。读取的数据进入bigqueue队列,bigqueue为一个大型、快速且持久的队列实现。使用netty将出对数据实时由客户端传输到服务端。传输后获取状态,判断状态,失败则重新传输。成功传输下一条数据。保证数据的时效性及有序性。作为一个刚结束实习生活Java新手,查阅了队列,netty,以及Java多线程的知识,参考了很多大牛总结的博文。写了这个demo。还有一个服务端用于接收数据,并保存到目标数据库。此模块还有很多地方需要优化,(比如里面涉及的文件路径问题等等)

License: Apache License 2.0

Java 100.00%

queue-client's Introduction

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.

##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.

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 repository mentioned in version history section below, latest stable release is 0.7.0.
    Note : bigqueue depends on log4j, please also added log4j jar reference if you use bigqueue.

  2. Maven reference

     <dependency>
       <groupId>com.leansoft</groupId>
       <artifactId>bigqueue</artifactId>
       <version>0.7.0</version>
     </dependency>
     
     <repository>
       <id>github.release.repo</id>
       <url>https://raw.github.com/bulldog2011/bulldog-repo/master/repo/releases/</url>
     </repository>
    

##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

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.

queue-client's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.