Skip to content

feat(core): add continuous profiling support with async-profiler#6150

Merged
bluestreak01 merged 13 commits intomasterfrom
jh_contious_profiling
Sep 24, 2025
Merged

feat(core): add continuous profiling support with async-profiler#6150
bluestreak01 merged 13 commits intomasterfrom
jh_contious_profiling

Conversation

@jerrinot
Copy link
Copy Markdown
Contributor

@jerrinot jerrinot commented Sep 16, 2025

This change integrates async-profiler 4.1 with two profiling modes for QuestDB performance analysis.

Screenshot From 2025-09-16 21-48-57

Usage

  1. Continuous Profiling (start with agent)
    Start QuestDB with profiling enabled from startup:
  $ questdb.sh start -p

Profile files will be saved to ~/.questdb/profiles/ (or your configured $QDB_ROOT/profiles).

  1. Attach to Running Instance
    Attach profiler to an already running QuestDB instance:
  # Start a CPU profile for 30 seconds and save as HTML flame graph
  $ questdb.sh profile -- -e cpu -d 30 -f /tmp/profile.html

  # Start allocation profiling and save as JFR
  $ questdb.sh profile -- -e alloc -f /tmp/alloc.jfr

Custom Profiler Parameters

Override default profiling settings:

# Continuous profiling with custom parameters
$ questdb.sh start -p -- start,event=alloc,file=/tmp/custom.jfr,interval=1ms
# Profile specific database instance
$ questdb.sh profile -t mydb -- -e cpu -d 60 -f /tmp/mydb-profile.html

Analyzing Profiles

Generate CPU flame graph heatmaps from the JFR files:

$ jfrconv --cpu -o heatmap ~/.questdb/profiles/profile-1.jfr heatmap.html

Note: jfrconv is part of the async-profiler project and is included in a QuestDB Linux x86-64 distribution under the lib/ directory.

Features

  • Two profiling modes: continuous (agent-based) and on-demand (attach to running instance)
  • Continuous profiling with configurable loop duration (default: 30 minutes)
  • JFR format output with timestamped files in $QDB_ROOT/profiles/
  • Configurable profiling parameters (event type, sampling interval, etc.)
  • Support for custom agent parameters via -- delimiter
  • Automatic profile directory creation
  • Robust error handling and validation
  • Fails fast if profiler library is missing when -p is specified

Currently implemented for the Linux x86-64 distribution only. The libasyncProfiler.so library and asprof/jfrconv binaries are included in the distribution package under the lib/ directory. For other platforms you download the async profile from https://github.com/async-profiler/async-profiler/releases and copy asprof and libasyncProfiler.so to lib/.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants