Files
neon/libs/utils/benches
Erik Grinaker 9b42d1ce1a pageserver: periodically log slow ongoing getpage requests (#10906)
## Problem

We don't have good observability for "stuck" getpage requests.

Resolves https://github.com/neondatabase/cloud/issues/23808.

## Summary of changes

Log a periodic warning (every 30 seconds) if GetPage request execution
is slow to complete, to aid in debugging stuck GetPage requests.

This does not cover response flushing (we have separate logging for
that), nor reading the request from the socket and batching it (expected
to be insignificant and not straightforward to handle with the current
protocol).

This costs 95 nanoseconds on the happy path when awaiting a
`tokio::task::yield_now()`:

```
warn_slow/enabled=false time:   [45.716 ns 46.116 ns 46.687 ns]
warn_slow/enabled=true  time:   [141.53 ns 141.83 ns 142.18 ns]
```
2025-02-20 21:38:42 +00:00
..

Utils Benchmarks

To run benchmarks:

# All benchmarks.
cargo bench --package utils

# Specific file.
cargo bench --package utils --bench benchmarks

# Specific benchmark.
cargo bench --package utils --bench benchmarks warn_slow/enabled=true

# List available benchmarks.
cargo bench --package utils --benches -- --list

# Generate flamegraph profiles using pprof-rs, profiling for 10 seconds.
# Output in target/criterion/*/profile/flamegraph.svg.
cargo bench --package utils --bench benchmarks warn_slow/enabled=true --profile-time 10

Additional charts and statistics are available in target/criterion/report/index.html.

Benchmarks are automatically compared against the previous run. To compare against other runs, see --baseline and --save-baseline.