Simple, efficient background processing for Go.
Godot uses go routine to handle many jobs at the same time in the
same process
redis
go 1.19+
go get github.com/easedot/godot
Step1
Write doters , doters/doters.go
Step2
Write job servers, examples/examples_srv.go
Step3
Write run job task, examples/examples_cli.go
Step4
go build example/example_srv.go
go build example/example_cli.go
Step5
open new termial run
docker-compose up -d
open new termial run
./example_srv -m 50
open new termial run
./example_cli -m 5000
//set queue weight
var queues = []godot.Queue{
{Name: "work1", Weight: 3},
{Name: "work2", Weight: 2},
{Name: "work3", Weight: 1},
{Name: "default", Weight: 1},
}
//set dots to 1000 goroutine
godotSRV := godot.NewGoDot(ctx, client, queues, 50, 6698)
//set job option and register
options := Doter{
Queue: "default",
Retry: false,
RetryCount: 2,
}
doter := defaultDoter{options}
Register(doter, options)
client.Run(ctx, "defaultDoter", "test_at")
//or run after 1000ms
client.RunAt(ctx, 1000, "defaultDoter", "test_at")
dashboard localhost:6698
Macbook M1 Pro
10 process 1m27s put 500000 jobs
./example_cli -m 50000
one server, 2000 redis conn, 30s done.
./example_srv -m 2000
Please see LICENSE.txt for licensing details.
Haihui Jiang @easedot