trickstercache / trickster

Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
https://trickstercache.org
Apache License 2.0
1.98k stars 177 forks source link

Longest-Match Router #730

Closed jranson closed 4 weeks ago

jranson commented 1 month ago

This patch replaces the embedded gorrila/mux router with a new Longest-Match router. The LM Router is made for high-performance proxies in that it only uses basic string prefix matching, with no path parameter parsing or use of regular expressions. Some notes:

Key Files:

Benchmarks:

BenchmarkGorillaMux_GithubStatic    705271   1606.00 ns/op     784 B/op     7 allocs/op
BenchmarkLMRouter_GithubStatic    21476557     55.63 ns/op       0 B/op     0 allocs/op

BenchmarkGorillaMux_GPlusStatic    2740124    438.00 ns/op     784 B/op     7 allocs/op
BenchmarkLMRouter_GPlusStatic     68944386     16.97 ns/op       0 B/op     0 allocs/op

BenchmarkGorillaMux_ParseStatic    2073722    575.70 ns/op     784 B/op     7 allocs/op
BenchmarkLMRouter_ParseStatic     47952765     24.58 ns/op       0 B/op     0 allocs/op

BenchmarkGorillaMux_StaticAll         3350    348207 ns/op  123092 B/op  1099 allocs/op
BenchmarkLMRouter_StaticAll         134061      9001 ns/op       0 B/op     0 allocs/op
coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 10357898241

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/proxy/handlers/rpc/rpc.go 0 1 0.0%
pkg/proxy/handlers/clickhouse/clickhouse.go 0 2 0.0%
pkg/proxy/handlers/influxdb/influxdb.go 0 2 0.0%
pkg/proxy/handlers/prometheus/prometheus.go 0 2 0.0%
pkg/proxy/methods/methods.go 0 4 0.0%
pkg/proxy/handlers/purge.go 0 8 0.0%
pkg/httpserver/httpserver.go 0 16 0.0%
pkg/httpserver/listeners.go 0 22 0.0%
<!-- Total: 235 292 80.48% -->
Files with Coverage Reduction New Missed Lines %
pkg/cache/bbolt/bbolt.go 4 88.55%
<!-- Total: 4 -->
Totals Coverage Status
Change from base Build 9143081403: 1.3%
Covered Lines: 17253
Relevant Lines: 19112

💛 - Coveralls