add memory fragmentation automation testing
cover add memory fragmentation automation testing
This extends monitoring support on kdevops to leverage tracepoint analysis for automatic memory fragmentation analysis.
Luis Chamberlain (5):
monitoring: add memory fragmentation eBPF monitoring support
mmtests: add monitoring framework integration
sysbench: add monitoring framework integration
ai milvus: add monitoring support
minio: add monitoring support
kconfigs/monitors/Kconfig | 53 + playbooks/ai_benchmark.yml | 14 + playbooks/minio.yml | 15 + .../tasks/install-deps/debian/main.yml | 1 + .../tasks/install-deps/redhat/main.yml | 1 + .../fstests/tasks/install-deps/suse/main.yml | 1 + .../roles/milvus/tasks/install_docker.yml | 2 + playbooks/roles/minio_install/tasks/main.yml | 24 +- .../tasks/install-deps/debian/main.yml | 1 + .../tasks/install-deps/redhat/main.yml | 1 + .../mmtests/tasks/install-deps/suse/main.yml | 1 + playbooks/roles/mmtests/tasks/main.yaml | 12 + .../monitoring/files/fragmentation_tracker.py | 533 ++++++++ .../files/fragmentation_visualizer.py | 1161 +++++++++++++++++ .../monitoring/tasks/monitor_collect.yml | 145 +- .../roles/monitoring/tasks/monitor_run.yml | 123 ++ .../tasks/install-deps/debian/main.yml | 2 + .../tasks/install-deps/redhat/main.yml | 1 + .../sysbench/tasks/install-deps/suse/main.yml | 1 + playbooks/roles/sysbench/tasks/main.yaml | 12 + workflows/ai/Makefile | 5 + workflows/minio/Makefile | 9 +- workflows/mmtests/Makefile | 8 + workflows/sysbench/Makefile | 8 +- 24 files changed, 2130 insertions(+), 4 deletions(-) create mode 100644 playbooks/roles/monitoring/files/fragmentation_tracker.py create mode 100644 playbooks/roles/monitoring/files/fragmentation_visualizer.py
Signature · 1 line
2.45.2
PATCH 1/5 monitoring: add memory fragmentation eBPF monitoring support
Add support for memory fragmentation monitoring using eBPF-based tracking, we leverage the plot-fragmentation effort [0]. This provides real-time tracking of memory allocation events and fragmentation indices with matplotlib visualization.
Features:
- eBPF tracepoint-based fragmentation tracking
- Real-time fragmentation index monitoring
- Automatic plot generation with fragmentation_visualizer.py
- Configurable monitoring duration and output directory
- Integration with existing monitoring framework
The scripts are included directly in kdevops rather than cloning an external repository for simplicity.
--- kconfigs/monitors/Kconfig | 53 + .../tasks/install-deps/debian/main.yml | 1 + .../tasks/install-deps/redhat/main.yml | 1 + .../fstests/tasks/install-deps/suse/main.yml | 1 + .../monitoring/files/fragmentation_tracker.py | 533 ++++++++ .../files/fragmentation_visualizer.py | 1161 +++++++++++++++++ .../monitoring/tasks/monitor_collect.yml | 126 ++ .../roles/monitoring/tasks/monitor_run.yml | 123 ++ 8 files changed, 1999 insertions(+) create mode 100644 playbooks/roles/monitoring/files/fragmentation_tracker.py create mode 100644 playbooks/roles/monitoring/files/fragmentation_visualizer.py
kconfigs/monitors/Kconfig +53 -0
@@ -61,6 +61,59 @@ config MONITOR_FOLIO_MIGRATION_INTERVAL performance. Higher values reduce overhead but may miss short-lived migration events. +config MONITOR_MEMORY_FRAGMENTATION + bool "Monitor memory fragmentation with eBPF" + output yaml + default n + help + Enable monitoring of memory fragmentation using eBPF-based tracking. + This provides advanced memory fragmentation visualization using + eBPF tracepoints and matplotlib. + + This tool tracks memory allocation events and fragmentation indices + in real-time, providing insights that traditional methods like + /proc/pagetypeinfo cannot fully capture. + + Features: + - eBPF-based tracepoint tracking + - Real-time fragmentation index monitoring + - Page mobility tracking + - Matplotlib visualization of fragmentation data + + Requirements: + - Python 3 with python3-bpfcc + - Kernel with required tracepoint support + - Root privileges for eBPF attachment + + The tool is particularly useful for investigating whether Large Block + Size support in the kernel creates worse fragmentation. + +config MONITOR_FRAGMENTATION_DURATION + int "Fragmentation monitoring duration (seconds)" + output yaml + default 0 + depends on MONITOR_MEMORY_FRAGMENTATION + help + Duration to run fragmentation monitoring in seconds. + Set to 0 for continuous monitoring until workflow completion. + + The monitoring will automatically stop when the workflow + finishes or when this duration expires, whichever comes first. + +config MONITOR_FRAGMENTATION_OUTPUT_DIR + string "Fragmentation monitoring output directory" + output yaml + default "/root/monitoring/fragmentation" + depends on MONITOR_MEMORY_FRAGMENTATION + help + Directory where fragmentation monitoring data and plots will be stored. + This directory will be created if it doesn't exist. + + The collected data includes: + - Raw eBPF trace data + - Generated matplotlib plots + - JSON formatted fragmentation metrics + endif # MONITOR_DEVELOPMENTAL_STATS # Future monitoring options can be added here
playbooks/roles/fstests/tasks/install-deps/debian/main.yml +1 -0
@@ -73,6 +73,7 @@ - xfsdump - cifs-utils - duperemove + - python3-bpfcc state: present update_cache: true tags: ["fstests", "deps"]
playbooks/roles/fstests/tasks/install-deps/redhat/main.yml +1 -0
@@ -72,6 +72,7 @@ - gettext - ncurses - ncurses-devel + - python3-bcc - name: Install xfsprogs-xfs_scrub become: true
playbooks/roles/fstests/tasks/install-deps/suse/main.yml +1 -0
@@ -124,6 +124,7 @@ - libcap-progs - fio - parted + - python3-bcc state: present when: - repos_present|bool
playbooks/roles/monitoring/files/fragmentation_tracker.py new file +533 -0
533 lines not on this page · raw message
playbooks/roles/monitoring/files/fragmentation_visualizer.py new file +1161 -0
1,161 lines not on this page · raw message
playbooks/roles/monitoring/tasks/monitor_collect.yml +126 -0
129 lines not on this page · raw message
playbooks/roles/monitoring/tasks/monitor_run.yml +123 -0
126 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH 2/5 mmtests: add monitoring framework integration
In reply to Luis ChamberlainAdd support for the monitoring framework to mmtests workflow, matching the implementation in fstests. This allows mmtests to leverage all monitoring capabilities including the new eBPF fragmentation monitoring.
Changes:
- Import monitor_run tasks before test execution
- Import monitor_collect tasks after test completion
- Add monitor-results make target for interim data collection
- Make monitoring results path workflow-aware (fstests vs mmtests)
With these changes, users can simply enable monitoring options in menuconfig and mmtests will automatically start/stop monitoring during test execution.
--- .../roles/mmtests/tasks/install-deps/debian/main.yml | 1 + .../roles/mmtests/tasks/install-deps/redhat/main.yml | 1 + .../roles/mmtests/tasks/install-deps/suse/main.yml | 1 + playbooks/roles/mmtests/tasks/main.yaml | 12 ++++++++++++ playbooks/roles/monitoring/tasks/monitor_collect.yml | 11 ++++++++++- workflows/mmtests/Makefile | 8 ++++++++ 6 files changed, 33 insertions(+), 1 deletion(-)
playbooks/roles/mmtests/tasks/install-deps/debian/main.yml +1 -0
@@ -60,6 +60,7 @@ name: - trace-cmd - perf-tools-unstable + - python3-bpfcc state: present update_cache: true tags: ["deps"]
playbooks/roles/mmtests/tasks/install-deps/redhat/main.yml +1 -0
@@ -52,6 +52,7 @@ - kernel-tools - trace-cmd - perf + - python3-bcc state: present tags: ["deps"] ignore_errors: true
playbooks/roles/mmtests/tasks/install-deps/suse/main.yml +1 -0
@@ -52,6 +52,7 @@ - kernel-default-devel - trace-cmd - perf + - python3-bcc state: present tags: ["deps"] ignore_errors: true
playbooks/roles/mmtests/tasks/main.yaml +12 -0
@@ -217,6 +217,12 @@ ansible.builtin.debug: msg: "Kernel version on {{ inventory_hostname }} : {{ kernel_version.stdout }}" +# Start monitoring services before running tests +- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_run.yml + when: + - enable_monitoring|default(false)|bool + tags: ["run_tests", "monitoring", "monitor_run"] + - name: Run mmtests in background tags: ["run_tests"] become: true
@@ -239,6 +245,12 @@ retries: 1440 # 12 hours delay: 60 # check every 60 seconds +# Collect monitoring data after tests complete +- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_collect.yml + when: + - enable_monitoring|default(false)|bool + tags: ["run_tests", "monitoring", "monitor_collect"] + - name: Create local results directory delegate_to: localhost ansible.builtin.file:
playbooks/roles/monitoring/tasks/monitor_collect.yml +10 -1
@@ -110,7 +110,16 @@ - name: Set monitoring results path ansible.builtin.set_fact: - monitoring_results_path: "{{ monitoring_results_base_path | default(topdir_path + '/workflows/fstests/results/monitoring') }}" + monitoring_results_path: >- + {%- if monitoring_results_base_path is defined -%} + {{ monitoring_results_base_path }} + {%- elif kdevops_run_fstests|default(false)|bool -%} + {{ topdir_path }}/workflows/fstests/results/monitoring + {%- elif kdevops_workflow_enable_mmtests|default(false)|bool -%} + {{ topdir_path }}/workflows/mmtests/results/monitoring + {%- else -%} + {{ topdir_path }}/results/monitoring + {%- endif -%} - name: Create local monitoring results directory ansible.builtin.file:
workflows/mmtests/Makefile +8 -0
@@ -43,6 +43,12 @@ mmtests-compare: --tags deps,compare \ $(MMTESTS_ARGS) +monitor-results: $(KDEVOPS_EXTRA_VARS) + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + playbooks/monitor-results.yml \ + --extra-vars=@./extra_vars.yaml \ + $(MMTESTS_ARGS) + mmtests-clean: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ playbooks/mmtests.yml \
@@ -58,6 +64,7 @@ mmtests-help: @echo "mmtests-tests : Run mmtests tests" @echo "mmtests-results : Copy results from guests" @echo "mmtests-compare : Compare baseline and dev results (AB testing)" + @echo "monitor-results : Collect interim monitoring data without stopping monitoring" @echo "mmtests-clean : Clean up mmtests installation" @echo ""
@@ -69,6 +76,7 @@ PHONY +: mmtests-dev PHONY +: mmtests-tests PHONY +: mmtests-results PHONY +: mmtests-compare +PHONY +: monitor-results PHONY +: mmtests-clean PHONY +: mmtests-help .PHONY: $(PHONY)
Signature · 1 line
2.45.2
PATCH 3/5 sysbench: add monitoring framework integration
In reply to Luis ChamberlainAdd support for the monitoring framework to sysbench workflow, matching the implementation in other workflows. This allows sysbench to leverage all monitoring capabilities including the new eBPF fragmentation monitoring.
Changes:
- Import monitor_run tasks before test execution
- Import monitor_collect tasks after test completion
- Add monitor-results make target for interim data collection
- Add sysbench to monitoring results path detection
- Install python3-bpfcc/python3-bcc dependency across all distributions
With these changes, users can simply enable monitoring options in menuconfig and sysbench will automatically start/stop monitoring during test execution.
--- playbooks/roles/monitoring/tasks/monitor_collect.yml | 2 ++ .../sysbench/tasks/install-deps/debian/main.yml | 2 ++ .../sysbench/tasks/install-deps/redhat/main.yml | 1 + .../roles/sysbench/tasks/install-deps/suse/main.yml | 1 + playbooks/roles/sysbench/tasks/main.yaml | 12 ++++++++++++ workflows/sysbench/Makefile | 8 +++++++- 6 files changed, 25 insertions(+), 1 deletion(-)
playbooks/roles/monitoring/tasks/monitor_collect.yml +2 -0
@@ -117,6 +117,8 @@ {{ topdir_path }}/workflows/fstests/results/monitoring {%- elif kdevops_workflow_enable_mmtests|default(false)|bool -%} {{ topdir_path }}/workflows/mmtests/results/monitoring + {%- elif kdevops_workflow_enable_sysbench|default(false)|bool -%} + {{ topdir_path }}/workflows/sysbench/results/monitoring {%- else -%} {{ topdir_path }}/results/monitoring {%- endif -%}
playbooks/roles/sysbench/tasks/install-deps/debian/main.yml +2 -0
@@ -25,6 +25,7 @@ - docker.io - locales - rsync + - python3-bpfcc state: present update_cache: true tags: ["deps"]
@@ -72,6 +73,7 @@ name: - locales - rsync + - python3-bpfcc state: present update_cache: true when: "sysbench_type_postgresql_native|bool"
playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml +1 -0
@@ -22,3 +22,4 @@ vars: packages: - docker + - python3-bcc
playbooks/roles/sysbench/tasks/install-deps/suse/main.yml +1 -0
@@ -62,6 +62,7 @@ ansible.builtin.package: name: - docker + - python3-bcc state: present when: - repos_present|bool
playbooks/roles/sysbench/tasks/main.yaml +12 -0
@@ -30,6 +30,12 @@ name: create_data_partition tags: ["mkfs"] +# Start monitoring services before running tests +- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_run.yml + when: + - enable_monitoring|default(false)|bool + tags: ["run_sysbench", "monitoring", "monitor_run"] + - name: MySQL Docker ansible.builtin.import_tasks: mysql-docker/main.yaml when: sysbench_type_mysql_docker | bool
@@ -37,3 +43,9 @@ - name: PostgreSQL Native ansible.builtin.import_tasks: postgresql-native/main.yaml when: sysbench_type_postgresql_native | bool + +# Collect monitoring data after tests complete +- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_collect.yml + when: + - enable_monitoring|default(false)|bool + tags: ["run_sysbench", "monitoring", "monitor_collect"]
workflows/sysbench/Makefile +7 -1
@@ -1,4 +1,4 @@ -PHONY += sysbench sysbench-test sysbench-telemetry sysbench-help-menu +PHONY += sysbench sysbench-test sysbench-telemetry sysbench-help-menu monitor-results TAGS_SYSBENCH_RUN := db_start
@@ -47,6 +47,11 @@ sysbench-results: playbooks/sysbench.yml \ --tags $(subst $(space),$(comma),$(TAGS_SYSBENCH_RESULTS)) +monitor-results: $(KDEVOPS_EXTRA_VARS) + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + playbooks/monitor-results.yml \ + --extra-vars=@./extra_vars.yaml + sysbench-clean: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ playbooks/sysbench.yml \
@@ -65,6 +70,7 @@ sysbench-help-menu: @echo "sysbench-test - Run sysbench tests and collect results (with telemetry)" @echo "sysbench-telemetry - Gather sysbench telemetry data on each node" @echo "sysbench-results - Collect all sysbench results onto local host" + @echo "monitor-results - Collect interim monitoring data without stopping monitoring" @echo "sysbench-clean - Remove any previous results on node and host" @echo ""
Signature · 1 line
2.45.2
PATCH 4/5 ai milvus: add monitoring support
In reply to Luis ChamberlainAdd monitoring framework integration to the AI Milvus workflow to track performance during vector database benchmarks.
--- playbooks/ai_benchmark.yml | 14 ++++++++++++++ playbooks/roles/milvus/tasks/install_docker.yml | 2 ++ .../roles/monitoring/tasks/monitor_collect.yml | 2 ++ workflows/ai/Makefile | 5 +++++ 4 files changed, 23 insertions(+)
playbooks/ai_benchmark.yml +14 -0
@@ -3,6 +3,20 @@ hosts: ai vars: ai_vector_db_milvus_benchmark_enable: true + tasks: + # Start monitoring services before running benchmarks + - ansible.builtin.import_tasks: roles/monitoring/tasks/monitor_run.yml + when: + - enable_monitoring|default(false)|bool + tags: ["monitoring", "monitor_run"] + roles: - role: milvus tags: ['ai', 'vector_db', 'milvus', 'benchmark'] + + post_tasks: + # Collect monitoring data after benchmarks complete + - ansible.builtin.import_tasks: roles/monitoring/tasks/monitor_collect.yml + when: + - enable_monitoring|default(false)|bool + tags: ["monitoring", "monitor_collect"]
playbooks/roles/milvus/tasks/install_docker.yml +2 -0
@@ -14,6 +14,7 @@ - python3-pip - python3-setuptools - python3-packaging + - python3-bpfcc state: present become: true when:
@@ -35,6 +36,7 @@ - docker-compose - python3-pip - python3-setuptools + - python3-bcc state: present become: true when:
playbooks/roles/monitoring/tasks/monitor_collect.yml +2 -0
@@ -119,6 +119,8 @@ {{ topdir_path }}/workflows/mmtests/results/monitoring {%- elif kdevops_workflow_enable_sysbench|default(false)|bool -%} {{ topdir_path }}/workflows/sysbench/results/monitoring + {%- elif kdevops_workflow_enable_ai|default(false)|bool -%} + {{ topdir_path }}/workflows/ai/results/monitoring {%- else -%} {{ topdir_path }}/results/monitoring {%- endif -%}
workflows/ai/Makefile +5 -0
@@ -101,6 +101,11 @@ ai-results-baseline: ai-results-dev: $(Q)$(MAKE) ai-results HOSTS="dev" +monitor-results: $(KDEVOPS_EXTRA_VARS) + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + playbooks/monitor-results.yml \ + --extra-vars=@./extra_vars.yaml + ai-setup: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ -i hosts \
Signature · 1 line
2.45.2
PATCH 5/5 minio: add monitoring support
In reply to Luis ChamberlainAdd monitoring framework integration to the MinIO Warp workflow to track performance during S3 benchmarking tests.
--- playbooks/minio.yml | 15 ++++++++++++ playbooks/roles/minio_install/tasks/main.yml | 24 ++++++++++++++++++- .../monitoring/tasks/monitor_collect.yml | 4 ++++ workflows/minio/Makefile | 9 ++++++- 4 files changed, 50 insertions(+), 2 deletions(-)
playbooks/minio.yml +15 -0
@@ -25,9 +25,24 @@ become: true become_user: root tags: ['minio_warp'] + + pre_tasks: + # Start monitoring services before running benchmarks + - ansible.builtin.import_tasks: roles/monitoring/tasks/monitor_run.yml + when: + - enable_monitoring|default(false)|bool + tags: ["monitoring", "monitor_run"] + roles: - role: minio_warp_run + post_tasks: + # Collect monitoring data after benchmarks complete + - ansible.builtin.import_tasks: roles/monitoring/tasks/monitor_collect.yml + when: + - enable_monitoring|default(false)|bool + tags: ["monitoring", "monitor_collect"] + - name: Uninstall MinIO hosts: minio become: true
playbooks/roles/minio_install/tasks/main.yml +23 -1
@@ -6,13 +6,35 @@ - "../extra_vars.yaml" tags: vars -- name: Install Docker +- name: Install Docker and monitoring dependencies package: name: - docker.io - python3-docker + - python3-bpfcc state: present become: yes + when: ansible_os_family == "Debian" + +- name: Install Docker and monitoring dependencies (RedHat) + package: + name: + - docker + - python3-docker + - python3-bcc + state: present + become: yes + when: ansible_os_family == "RedHat" + +- name: Install Docker and monitoring dependencies (SUSE) + package: + name: + - docker + - python3-docker + - python3-bcc + state: present + become: yes + when: ansible_os_family == "SUSE" - name: Ensure Docker service is running systemd:
playbooks/roles/monitoring/tasks/monitor_collect.yml +4 -0
@@ -121,6 +121,10 @@ {{ topdir_path }}/workflows/sysbench/results/monitoring {%- elif kdevops_workflow_enable_ai|default(false)|bool -%} {{ topdir_path }}/workflows/ai/results/monitoring + {%- elif kdevops_workflow_enable_minio|default(false)|bool -%} + {{ topdir_path }}/workflows/minio/results/monitoring + {%- elif kdevops_workflow_enable_build_linux|default(false)|bool -%} + {{ topdir_path }}/workflows/build-linux/results/monitoring {%- else -%} {{ topdir_path }}/results/monitoring {%- endif -%}
workflows/minio/Makefile +8 -1
@@ -4,6 +4,7 @@ MINIO_DATA_TARGET_UNINSTALL := minio-uninstall MINIO_DATA_TARGET_DESTROY := minio-destroy MINIO_DATA_TARGET_RUN := minio-warp MINIO_DATA_TARGET_RESULTS := minio-results +MINIO_DATA_TARGET_MONITOR := monitor-results MINIO_PLAYBOOK := playbooks/minio.yml
@@ -49,6 +50,11 @@ $(MINIO_DATA_TARGET_RESULTS): echo "No results directory found. Run 'make minio-warp' first."; \ fi +$(MINIO_DATA_TARGET_MONITOR): $(KDEVOPS_EXTRA_VARS) + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + playbooks/monitor-results.yml \ + --extra-vars=@./extra_vars.yaml + minio-help: @echo "MinIO Warp S3 benchmarking targets:" @echo ""
@@ -58,6 +64,7 @@ minio-help: @echo "minio-destroy - Remove MinIO containers and clean up data" @echo "minio-warp - Run MinIO Warp benchmarks" @echo "minio-results - Collect and analyze benchmark results" + @echo "monitor-results - Collect monitoring data" @echo "" @echo "Example usage:" @echo " make defconfig-minio-warp # Configure for Warp benchmarking"
@@ -73,4 +80,4 @@ minio-help: .PHONY: $(MINIO_DATA_TARGET) $(MINIO_DATA_TARGET_INSTALL) $(MINIO_DATA_TARGET_UNINSTALL) .PHONY: $(MINIO_DATA_TARGET_DESTROY) $(MINIO_DATA_TARGET_RUN) $(MINIO_DATA_TARGET_RESULTS) -.PHONY: minio-help +.PHONY: $(MINIO_DATA_TARGET_MONITOR) minio-help
Signature · 1 line
2.45.2
Quoted 9 lines · Luis Chamberlain
This extends monitoring support on kdevops to leverage tracepoint analysis for automatic memory fragmentation analysis.
Luis Chamberlain (5):
monitoring: add memory fragmentation eBPF monitoring support
mmtests: add monitoring framework integration
sysbench: add monitoring framework integration
ai milvus: add monitoring support
minio: add monitoring support
Rebased, merged and pushed.
Luis