Giter Club home page Giter Club logo

mmapbuffer's Introduction

mmapBuffer

简介

mmapBuffer是linux环境下高性能缓存异步写入库,适用于大量、频繁数据写入的场景。其基于mmap和双向环形链表。线程安全且支持创建多个实例。有如下特性:

  • 内存资源占用低,其采用mmap映射的内存作为缓冲区,对写入文件使用direct io从而避开系统的页缓存策略,内存占用大小完全可控。

  • 缓存内容安全性高,mmap映射的缓存文件在遇到进程意外退出时,内容不会丢失。

  • 可拓展,buffer由多个内存映射的缓冲区块组成,可动态添加缓存区块。

  • 可以在程序中创建多个实例,通过缓存区名称唯一标识。

此项目受ringLog启发,用相关策略减少锁的竞争开销,大幅优化了性能。

性能测试

五线程同时写入一千万条100字节数据,用时11.9044s。(同时使用了优化过后的时间戳获取函数),单缓存区块大小为40960000byte,全程最大使用了4个缓冲区块,内存仅占用了约160MB。

mmapbuffer's People

Contributors

cloudicen avatar

Stargazers

 avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

ajunlonglive

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.