GithubHelp home page GithubHelp logo

goblero's Introduction

Goblero

Pure Go, Simple, Embedded, Persistent Job Queue, backed by BadgerDB

Build Status Coverage Status goreportcard codebeat badge Documentation

DO NOT USE IN PRODUCTION This library is still in Alpha / Work In Progress

About Goblero

Intro article: Introducing Goblero: a Go Embedded Job Queue

  • Pure Go library, no cgo
  • Simple, embedded, persistent job queue
  • Provides in-process job processing to any Go app
  • The jobs/status changes are persisted to disk after each operation and pending jobs can continue processing after an app restart or a crash
  • Allows multiple "processors", each processor/worker processes one job at a time then is assigned a new job, etc
  • The storage engine used is BadgerDB

P.S: Why is the library named Goblero ? Go for the Go programming language obviously, and Badger in french is "Blaireau", but blero is easier to pronounce :)

Usage

The full API is documented on godoc.org. There is also a demo repo goblero-demo

Get package

go get -u github.com/didil/goblero/pkg/blero

API

// Create a new Blero backend
bl := blero.New("db/")

// Start Blero
bl.Start()

// defer Stopping Blero
defer bl.Stop()

// register a processor
bl.RegisterProcessorFunc(func(j *blero.Job) error {
  // Do some processing, access job name with j.Name, job data with j.Data
})

// enqueue a job
bl.EnqueueJob("MyJob", []byte("My Job Data"))

Benchmarks

# Core i5 laptop / 8GB Ram / SSD 
make bench
BenchmarkEnqueue/EnqueueJob-4          50000            159942 ns/op (~ 6250 ops/s)
BenchmarkEnqueue/dequeueJob-4           5000           2767260 ns/op (~  361 ops/s)

Todo:

  • Restart interrupted jobs after app restart/crashes
  • Sweep completed jobs from the "complete" queue
  • Failed Jobs retry options
  • Allow batch enqueuing
  • Add support for Go contexts
  • Test in real conditions under high load
  • Expose Prometheus Metrics in an Http handler
  • Optimize performance / Locking

Contributing

All contributions (PR, feedback, bug reports, ideas, etc.) are welcome !

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.