Yaad is a high-throughput scheduleable-job queue. Jobs with different trigger times go in - jobs ordered by trigger by time come out.
Yaad is a job queue (like rabbitMQ) but for jobs that trigger at some time. You add jobs to it with a specific date/time trigger and they are made available to come off the queue at that time.
In it's simplest form, Yaad is an in-memory queue.
Producers can enqueue jobs onto Yaad with a trigger
time and Yaad will internally order them by their trigger
time. Jobs with trigger
time closest to now
are dequeued before jobs with later trigger
times.
In other words, Yaad orders a stream of jobs by their trigger
time.
- Scheduled Emails/SMSs - send messages some time after an event occurs
- Abandoned shopping cart reminders
- Deadman switches - perform pre-set action if job isn't canceled before expiry
- Streaming Time-sorted messages - enqueue jobs in a window and consume a sorted stream
- Asynchronous work queue - run time-consuming tasks asynchronously
-
Pull latest image docker:
docker pull urjitbhatia/goyaad:latest
-
Run server:
docker run --rm --name goyaad -p 11301:11301 urjitbhatia/goyaad:latest -L server
-
Interact using the cli:
docker run --rm urjitbhatia/goyaad:latest put --id "j1" --body "I should be ready second" --delay 45s docker run --rm urjitbhatia/goyaad:latest put --id "j2" --body "I should be ready first" --delay 2s docker run --rm urjitbhatia/goyaad:latest put --id "j3" --body "Cancel me" --delay 20m docker run --rm urjitbhatia/goyaad:latest next --timeout 20s docker run --rm urjitbhatia/goyaad:latest next --timeout 50s docker run --rm urjitbhatia/goyaad:latest cancel --id "j3"
-
Fetch binary
- Github releases
https://github.com/urjitbhatia/goyaad/releases
- Or via
go get
:go get github.com/urjitbhatia/yaad
- Github releases
-
Run server:
goyaad -L server
-
Interact using the cli:
goyaad put --id "j1" --body "I should be ready second" --delay 45s goyaad put --id "j2" --body "I should be ready first" --delay 2s goyaad put --id "j3" --body "Cancel me" --delay 20m goyaad next --timeout 20s goyaad next --timeout 50s goyaad cancel --id "j3"
-
Docker:
docker run --rm --name loadtest urjitbhatia/goyaad:latest \ -L loadtest -e -d \ --raddr \$(docker inspect goyaad -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'):11301
-
Run a load test:
goyaad -L loadtest -e -d
- StatsD server address
--statsAddr string Remote StatsD listener (host:port) (default ":8125")
- Enable human-friendly coloured logs
-l, --log-level string Set log level: INFO, DEBUG (default "INFO")
- Set log level
-L, --friendly-log Use a human-friendly logging style
- RPC listen address
--raddr string Bind RPC listener to (host:port) (default ":11301")
- For
Server
mode, it the address the server should advertize on - For other modes, it is the address of the target server
- For
Runs Yaad queue server. If restore
is used, the server first attempts to restore jobs from the give snapshot location and then starts serving the queue. If the server receives a SIGUSR1
, it exits gracefully by creating a new snapshot with any jobs that were held in memory at shutdown time.
The snapshots can be copied to different machines and supplied to new server instances.
- Restore jobs from a snapshot
--restore
- Loads snapshots from
--store-url
- Filesystem dir (default: PWD) or S3-style url. Examples: filesystemdir/subdir or {file|s3|gs|azblob}://bucket (default "/usr/local/bin")
- An optional
--store-prefix
can also be provided for S3 compatible addressing scheme
- Loads snapshots from
- SpokeSpan is an advanced tuning parameter. It sets the
bucket
size for job ordering.-S, --spokeSpan duration Spoke span (golang duration string format) (default 10s)
It configures the spread of jobtrigger
times.
Runs a loadtest that generated jobs with random payloads with their trigger
times between the delayMin
and the delayMax
values (relative to when they're generated).
- Set max concurrent producer connections
-c, --con int Number of connections to use (default 5)
- Max
trigger
time for test jobs. A random trigger time betweendelayMin
anddelayMax
is assigned to test jobs-M, --delayMax int Max delay in seconds (Delay is random over delayMin, delayMax) (default 60)
- Min
trigger
time for test jobs-N, --delayMin int Min delay in seconds (Delay is random over delayMin, delayMax)
- Set dequeue mode
-d, --dequeueMode Dequeue jobs
- Set enqueue mode
-e, --enqueue Enqueue jobs
- Number of jobs to generated
-n, --num int Number of total jobs (default 1000)
- Fixed job payload size
-z, --size int Job size in bytes (default 1000)
- Number of Jobs to fetch
-n, --num int Max Number of jobs to inspect (default 1)
- If the target server has fewer than
num
jobs, it will return less thannum
jobs.
- If the target server has fewer than
- Inspect output file location
-o, --out string Write output to outfile (default: stdout)