Skip to content

AltheaIX/RateGate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RateGate

RateGate is a performance-first notification pipeline for Go.

It is intentionally minimal, allocation-free on hot paths, and designed for high-throughput dispatching where Add() may be called millions of times per second and allocating is unacceptable.

This library prioritizes measurable performance, not convenience abstractions.

Design Goals

  • Zero Allocation on Hot Paths
  • Bounded concurrency to avoid goroutine explosion
  • Benchmark-driven development

Transport Interface

type Transport interface {
    Send(content string)
}

Benchmarks

All benchmarks are local, free from noise, reproducible.

Dispatcher Add

GOMAXPROCS=1

$ go test -bench=BenchmarkDispatcherAdd -benchmem -benchtime=10s -cpu=1
cpu: AMD Ryzen 7 5700X 8-Core Processor 
BenchmarkDispatcherAdd  347886901               34.64 ns/op            0 B/op          0 allocs/op

GOMAXPROCS=5

$ go test -bench=BenchmarkDispatcherAdd -benchmem -benchtime=10s -cpu=5
cpu: AMD Ryzen 7 5700X 8-Core Processor
BenchmarkDispatcherAdd-5        121291398               96.16 ns/op            0 B/op          0 allocs/op

Transport Send

GOMAXPROCS=1

$ go test -bench=BenchmarkSend -benchmem -benchtime=10s -cpu=1
cpu: AMD Ryzen 7 5700X 8-Core Processor
BenchmarkSend     264182             46792 ns/op               0 B/op          0 allocs/op

GOMAXPROCS=5

$ go test -bench=BenchmarkSend -benchmem -benchtime=10s -cpu=5
cpu: AMD Ryzen 7 5700X 8-Core Processor
BenchmarkSend-5           274490             45450 ns/op               0 B/op          0 allocs/op

Integration (Add + Send)

GOMAXPROCS=1

$ go test -bench=BenchmarkIntegration -benchmem -benchtime=10s -cpu=1
cpu: AMD Ryzen 7 5700X 8-Core Processor
BenchmarkIntegration      255927             48357 ns/op               0 B/op          0 allocs/op

GOMAXPROCS=5

$ go test -bench=BenchmarkIntegration -benchmem -benchtime=10s -cpu=5
cpu: AMD Ryzen 7 5700X 8-Core Processor
BenchmarkIntegration-5            674246             16652 ns/op               0 B/op          0 allocs/op

Roadmap

  • Rate Limiter
  • Retry with Policy
  • Comparative Benchmark vs existing library

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages