xfy
445401c40f
perf(accesslog): add sample_rate for access log to reduce CPU and allocations
Add configurable access log sampling via :
- 0.0-1.0 range; defaults to 1.0 (record all) for backward compatibility
- Uses lock-free atomic counter for deterministic sampling
- Non-2xx responses always logged regardless of sample rate
Benchmark results (combined format, /dev/null):
Full logging: ~2245 ns/op, 1987 B/op, 17 allocs/op
10% sampling: ~1593 ns/op, 1633 B/op, 6 allocs/op
Improvement: -29% latency, -65% allocations/op
This addresses the top application-layer CPU hotspot identified
in the v0.4.0 profile (LogAccess at 16.36% cumulative CPU).
2026-06-11 13:53:41 +08:00
..
2026-06-04 08:13:25 +08:00
2026-06-10 13:45:35 +08:00
2026-06-03 23:47:29 +08:00
2026-06-11 13:53:41 +08:00
2026-06-09 15:59:36 +08:00
2026-06-03 23:47:29 +08:00
2026-06-05 12:31:39 +08:00
2026-06-04 11:17:08 +08:00
2026-06-03 23:47:29 +08:00
2026-06-05 12:31:41 +08:00
2026-06-09 15:59:36 +08:00
2026-06-09 15:59:36 +08:00
2026-06-03 23:47:29 +08:00
2026-06-05 13:48:04 +08:00
2026-06-04 11:06:09 +08:00
2026-06-11 13:53:41 +08:00
2026-06-03 23:47:29 +08:00
2026-06-03 23:47:29 +08:00
2026-06-08 18:17:08 +08:00
2026-06-04 00:22:45 +08:00
2026-06-11 13:47:47 +08:00
2026-06-04 11:14:23 +08:00
2026-06-04 08:13:42 +08:00
2026-06-10 13:48:07 +08:00
2026-06-03 16:36:23 +08:00
2026-06-04 11:17:08 +08:00
2026-06-04 08:21:48 +08:00
2026-04-21 08:12:34 +08:00