Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

jemalloc Heap Profiling Runbook

Операторский runbook для memory/heap анализа на базе jemalloc. Каноничный источник: этот runbook в angarabook/src/operations/.

Scope

  • feature: jemalloc-prof (opt-in);
  • метрики heap-фрагментации;
  • on-demand profiling в staging/debug;
  • leak-check для длительных прогонов (Golden DB).

Build and verify

cargo build --release --features jemalloc-prof
curl http://localhost:9091/metrics | rg jemalloc

Key metrics

  • angarabase_jemalloc_allocated_bytes
  • angarabase_jemalloc_resident_bytes
  • angarabase_jemalloc_active_bytes
  • angarabase_jemalloc_mapped_bytes
  • angarabase_jemalloc_fragmentation_ratio

Практическая интерпретация:

  • ~1.0: низкая фрагментация;
  • >1.5: риск фрагментации;
  • >2.0: требуется разбор memory path.

Heap profiling workflow

  1. Запуск с MALLOC_CONF=prof:true,....
  2. Сигнал SIGUSR1 для forced dump.
  3. Анализ jeprof (text/pdf/diff).

Leak-check for long-lived runs

Golden DB flow:

  • tools/golden_db/manage.sh leak-check baseline
  • длительная нагрузка
  • tools/golden_db/manage.sh leak-check report

Сравниваются baseline/after по allocated/resident/mapped и fragmentation.

  • tools/golden_db/manage.sh
  • src/operations/golden-dataset.md