Benchmarking
ERPBridge includes deterministic Go microbenchmarks for cache and request-preparation paths. They run in process and do not require Redis, MockERP, Docker, credentials, or a live MCP connection.
Local performance baseline
Measure the code paths that run for every cached tool call, then compare the same workload on the same machine.
- Measures
- Latency, memory, and allocations
- Excludes
- ERP, Redis, plugins, and HTTP
- Use
- Local regression comparison
Run microbenchmarks​
Core suite
Run all microbenchmarks
Runs only benchmark functions and reports latency and allocation metrics.
make benchCompare locally
Collect five samples
Keep the machine otherwise idle before comparing a change.
go test -run '^$' -bench . -benchmem -count=5 ./internal/cache ./internal/mcpThe commands use -run '^$', so they do not run ordinary tests. They report
ns/op, B/op, and allocs/op.
Local baseline​
The following five-sample medians were measured on 2026-08-31 with Go 1.26.2 on Linux/amd64, using an 11th Gen Intel Core i5-1135G7. They are a local baseline only.
On small screens, scroll this table horizontally to view all result columns.
| Benchmark | Median | Allocation |
|---|---|---|
ArgsHash/empty | 2.5 ns/op | 0 B/op, 0 allocs/op |
ArgsHash/small | 2348 ns/op | 384 B/op, 7 allocs/op |
ArgsHash/nested | 4352 ns/op | 656 B/op, 12 allocs/op |
ExactKey | 2910 ns/op | 528 B/op, 11 allocs/op |
MemoryManager/hit | 8500 ns/op | 1082 B/op, 22 allocs/op |
MemoryManager/set | 5548 ns/op | 977 B/op, 18 allocs/op |
CacheMiddleware/hit | 17287 ns/op | 2662 B/op, 58 allocs/op |
CacheMiddleware/disabled | 236 ns/op | 144 B/op, 3 allocs/op |
PrepareERPCall/legacy_get_query | 2193 ns/op | 613 B/op, 11 allocs/op |
PrepareERPCall/generated_locations | 5211 ns/op | 1625 B/op, 24 allocs/op |
PrepareERPCall/complete_body | 1329 ns/op | 240 B/op, 6 allocs/op |
Concurrent cache-hit stress test​
The stress benchmark shares one pre-seeded in-memory cache entry across parallel callers. It exercises cache-key creation, the cache middleware, JSON decoding, the lifecycle read lock, and the memory LRU lock. It does not call Redis, an ERP, plugins, or an HTTP server.
Shared-cache contention
Stress concurrent in-memory cache hits
Run the cache-hit path for five seconds at one and eight CPUs.
make stressThis command runs CacheMiddleware/hit_parallel for five seconds at one and
eight CPUs. On the same local environment, five-sample medians were:
The eight-CPU samples varied from 171757 to 255476 ops/s because callers contend for the shared in-memory LRU lock. Use the median for local regression comparison. Do not use these values to size a production deployment.