From 804195f403835fba64b4cb4470b550300cf86695 Mon Sep 17 00:00:00 2001 From: Yaman Ziadeh Date: Tue, 15 Jul 2025 16:13:18 -0400 Subject: [PATCH 1/6] Initial async-profiler Nodetool implementation Add enable/disable AsyncProfiler JVM flags Refactor Add output format option & initial tests Refactor & add tests Add tests for system properties & refactor Checkstyle fixes & switching airlift with picocli (CASSANDRA-17445) Add more tests Fix Picocli 'Profile' command integration Address feedback Changes.txt Remove not needed property Add missing licenses Apply feedback Fix help tests refactoring fix commands hardened validation and simplification of commands fix log dir fixed tests more fixes add purge command more hardening implement list and fetch Remove unused import more fixes added documentation fixed nodetool help output tests added status command introduced binary download of files in fetch command if necessary hardened code ability to specify duration in human format (e.g. 5m) improved error parsing ability to execute purge, list and fetch even with disabled profiler async-profiler is disabled by default added nodetool tests add startup check checking kernel parameters Updates documentation with different profiler info Applies some feedback Merge AsyncProfiler and AsyncProfilerService Improvements Improve refactor Fixed folder for profiles Fix help tests Use config log folder Applies feedback more fixes --- .build/cassandra-deps-maven-pom.xml | 4 + .build/parent-maven-pom.xml | 6 + CHANGES.txt | 1 + NEWS.txt | 1 + conf/jvm-server.options | 7 + doc/modules/cassandra/nav.adoc | 1 + .../managing/operating/async-profiler.adoc | 141 +++++ .../config/CassandraRelevantProperties.java | 2 + .../profiler/AsyncProfilerMBean.java | 92 ++++ .../service/AsyncProfilerService.java | 481 ++++++++++++++++++ .../cassandra/service/CassandraDaemon.java | 2 + .../cassandra/service/StartupChecks.java | 41 ++ .../org/apache/cassandra/tools/NodeProbe.java | 11 + .../nodetool/AsyncProfileCommandGroup.java | 255 ++++++++++ .../tools/nodetool/NodetoolCommand.java | 1 + .../mock/nodetool/InternalNodeProbe.java | 2 + .../distributed/test/AsyncProfilerTest.java | 179 +++++++ test/resources/nodetool/help/nodetool | 1 + test/resources/nodetool/help/profile | 102 ++++ test/resources/nodetool/help/profile$execute | 38 ++ test/resources/nodetool/help/profile$fetch | 40 ++ test/resources/nodetool/help/profile$list | 27 + test/resources/nodetool/help/profile$purge | 27 + test/resources/nodetool/help/profile$start | 48 ++ test/resources/nodetool/help/profile$status | 27 + test/resources/nodetool/help/profile$stop | 32 ++ .../service/AsyncProfilerServiceTest.java | 250 +++++++++ 27 files changed, 1819 insertions(+) create mode 100644 doc/modules/cassandra/pages/managing/operating/async-profiler.adoc create mode 100644 src/java/org/apache/cassandra/profiler/AsyncProfilerMBean.java create mode 100644 src/java/org/apache/cassandra/service/AsyncProfilerService.java create mode 100644 src/java/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroup.java create mode 100644 test/distributed/org/apache/cassandra/distributed/test/AsyncProfilerTest.java create mode 100644 test/resources/nodetool/help/profile create mode 100644 test/resources/nodetool/help/profile$execute create mode 100644 test/resources/nodetool/help/profile$fetch create mode 100644 test/resources/nodetool/help/profile$list create mode 100644 test/resources/nodetool/help/profile$purge create mode 100644 test/resources/nodetool/help/profile$start create mode 100644 test/resources/nodetool/help/profile$status create mode 100644 test/resources/nodetool/help/profile$stop create mode 100644 test/unit/org/apache/cassandra/service/AsyncProfilerServiceTest.java diff --git a/.build/cassandra-deps-maven-pom.xml b/.build/cassandra-deps-maven-pom.xml index 4402a8efd9f1..474c1037d0b1 100644 --- a/.build/cassandra-deps-maven-pom.xml +++ b/.build/cassandra-deps-maven-pom.xml @@ -161,6 +161,10 @@ com.github.jbellis jamm + + tools.profiler + async-profiler + io.netty netty-all diff --git a/.build/parent-maven-pom.xml b/.build/parent-maven-pom.xml index 5d6ca01a4cf4..c75e2545337b 100644 --- a/.build/parent-maven-pom.xml +++ b/.build/parent-maven-pom.xml @@ -40,6 +40,7 @@ 4.0.20 4.1.130.Final 0.5.1 + 4.2 @asm.version@ @@ -465,6 +466,11 @@ jamm ${jamm.version} + + tools.profiler + async-profiler + ${async-profiler.version} +