**BigQueue-Go是由纯golang开发,无任何三方库依赖, 基于本地文件的高性能Queue实现, 同步与异步模式,使用也非常简洁**<br>
github地址: [ **https://github.com/jhunters/bigqueue**](https://github.com/jhunters/bigqueue)<br>
Feture说明:<br>
**Fast **: close to the speed of direct memory access, both enqueue and dequeue are close to O(1) memory access.<br>
**Big **: the total size of the queue is only limited by the available disk space.<br>
**Persistent **: all data in the queue is persisted on disk, and is crash resistant.<br>
**Reliable **: OS will be responsible to presist the produced messages even your process crashes.<br>
**Realtime **: messages produced by producer threads will be immediately visible to consumer threads.<br>
**Memory-efficient **: automatic paging & swapping algorithm, only most-recently accessed data is kept in memory.<br>
**Thread-safe **: multiple threads can concurrently enqueue and dequeue without data corruption.<br>
**Simple&Light ** : pure Golang implements without any 3rd-party library<br>
快速开发示例:
```go
import "github.com/jhunters/bigqueue"
func main() {
var queue = new(bigqueue.FileQueue)
err := queue.Open(".", "testqueue", nil)
if err != nil {
fmt.Println(err)
return
}
defer queue.Close()
data := []byte("hello jhunters")
i, err := queue.Enqueue(data)
if err != nil {
fmt.Println(err)
return
} else {
fmt.Println("Enqueued index=", i, string(data))
}
index, bb, err := queue.Dequeue()
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Dequeue data:", index, string(bb))
}
```
![架构图](https://raw.githubusercontent.com/jhunters/bigqueue/master/docs/images/log_collector.png)
有疑问加站长微信联系(非本文作者)