Skip to main content
Version: ERPBridge + bridgectl · v0.5.0-alpha.2

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 bench

Compare locally

Collect five samples

Keep the machine otherwise idle before comparing a change.

go test -run '^$' -bench . -benchmem -count=5 ./internal/cache ./internal/mcp

The 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.

Empty argument hash2.5 ns0 allocations
Memory cache hit8.5 us22 allocations
Full cache middleware hit17.3 us58 allocations

On small screens, scroll this table horizontally to view all result columns.

BenchmarkMedianAllocation
ArgsHash/empty2.5 ns/op0 B/op, 0 allocs/op
ArgsHash/small2348 ns/op384 B/op, 7 allocs/op
ArgsHash/nested4352 ns/op656 B/op, 12 allocs/op
ExactKey2910 ns/op528 B/op, 11 allocs/op
MemoryManager/hit8500 ns/op1082 B/op, 22 allocs/op
MemoryManager/set5548 ns/op977 B/op, 18 allocs/op
CacheMiddleware/hit17287 ns/op2662 B/op, 58 allocs/op
CacheMiddleware/disabled236 ns/op144 B/op, 3 allocs/op
PrepareERPCall/legacy_get_query2193 ns/op613 B/op, 11 allocs/op
PrepareERPCall/generated_locations5211 ns/op1625 B/op, 24 allocs/op
PrepareERPCall/complete_body1329 ns/op240 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 stress

This command runs CacheMiddleware/hit_parallel for five seconds at one and eight CPUs. On the same local environment, five-sample medians were:

1 CPU77,206 ops/s12,952 ns/op · 2,656 B/op
8 CPUs176,903 ops/s5,653 ns/op · 2,664 B/op

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.