Skip to contentSkip to conversation

workflows: add sysbench MySQL TPS variability support

PATCH New Luis Chamberlain 1 participant 1 message Sep 14, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 workflows: add sysbench MySQL TPS variability support

Drives which support large power-fail safe writes above 4 KiB can benefit from a disabling database features which help increase TPS and reduce TPS variability by larger factors. Add support to help developers to test and experiment with this.

This adds initial support using Docker and MySQL but can easily be extended to support PostgreSQL and, can also leverage host side solutions without docker. This started out with scripts to help speed up testing [0], this is the conversion of proper automation support in kdevops.

Telemetry is supported by leveraging a MySQLsh plugin and some adhoc sysbench TPS json output scripts.

Support is added using LBS on XFS and also ext4 with bigalloc. The methodology adopted for filesystem support should make it *extremely* easy to extend this to add other filesystems and other filesystem
configurations: mostly kconfig edits. This helps showcase the value of the link between variables on kconfig and now the automatic ansible variables we generate. This shoudl simplify new workloads considerably.

[0] https://github.com/mcgrof/plot-sysbench

---

I already folded into kdevops support for the vfs tree and vfs.blocksize branch. This leverages that, and also is an example of what a new workflow looks like with the new selective yaml output. I've only gotten all make targets finally to work, so next will be to actually do the introspection and compare it to what I had on plot-sysbench. I also migrated the TPS parsing to leverage the sysbench json output, I haven't yet gotten to the full examination of how correct those scripts are yet.

Finally I've been trying to see how hard it would be for ChatGPT to do some work for us on kdevops [1], and although I've had mixed results I figured I'd share its a great primer for structure. It was in no way shape or form close to what was needed in the end, however it was very useful in oddball ansible quirks. It also did all the conversions from plot-sysbench to support sysbench json output, I haven't tested those yet, however they are pretty straight forward, and plotting TPS is not yet hooked up. Once I test them I'll hook the plot of the TPS as the last part of automation.

I tested with VMs, but I had tested plot-sysbench on the cloud with AWS too. Although initial cloud support is there, some more work would be required to ensure the right drive is used and symlinks used for tons of directories, as some cloud nodes come up with a pretty small primary partition.

[1] https://chatgpt.com/share/abab6b23-829c-4da0-889c-4e1ee96c084c

 .gitignore                                    |   2 +
 .../sysbench-mysql-atomic-tps-variability     |  29 +
 kconfigs/workflows/Kconfig                    |  26 +
 .../sysbench/sysbench-tps-compare.py          | 115 ++++
 .../workflows/sysbench/sysbench-tps-plot.py   |  92 +++
 .../sysbench/sysbench-tps-variance.py         | 108 ++++
 playbooks/roles/gen_hosts/tasks/main.yml      |  55 ++
 .../roles/gen_hosts/templates/sysbench.j2     |  23 +
 playbooks/roles/gen_nodes/defaults/main.yml   |   2 +
 playbooks/roles/gen_nodes/tasks/main.yml      |  86 +++
 playbooks/roles/sysbench/defaults/main.yml    |  52 ++
 .../tasks/install-deps/debian/main.yml        |  31 +
 .../sysbench/tasks/install-deps/main.yml      |  12 +
 .../tasks/install-deps/redhat/main.yml        |  43 ++
 .../sysbench/tasks/install-deps/suse/main.yml |  67 +++
 playbooks/roles/sysbench/tasks/main.yaml      | 530 ++++++++++++++++++
 .../roles/sysbench/templates/mysql.conf.j2    |  94 ++++
 .../0001-setup-sysbench-permissions.sh        |   3 +
 .../0002-install-mysql-shell-plugin-reqs.sh   |   3 +
 .../post-entrypoint-custom-bringup.sh         |  11 +
 playbooks/sysbench.yml                        |   4 +
 workflows/Makefile                            |   4 +
 workflows/sysbench/Kconfig                    | 127 +++++
 workflows/sysbench/Kconfig.docker             | 130 +++++
 workflows/sysbench/Kconfig.ext4               | 124 ++++
 workflows/sysbench/Kconfig.fs                 | 173 ++++++
 workflows/sysbench/Kconfig.xfs                | 162 ++++++
 workflows/sysbench/Makefile                   |  66 +++
 28 files changed, 2174 insertions(+)
 create mode 100644 defconfigs/sysbench-mysql-atomic-tps-variability
 create mode 100755 playbooks/python/workflows/sysbench/sysbench-tps-compare.py
 create mode 100755 playbooks/python/workflows/sysbench/sysbench-tps-plot.py
 create mode 100755 playbooks/python/workflows/sysbench/sysbench-tps-variance.py
 create mode 100644 playbooks/roles/gen_hosts/templates/sysbench.j2
 create mode 100644 playbooks/roles/sysbench/defaults/main.yml
 create mode 100644 playbooks/roles/sysbench/tasks/install-deps/debian/main.yml
 create mode 100644 playbooks/roles/sysbench/tasks/install-deps/main.yml
 create mode 100644 playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
 create mode 100644 playbooks/roles/sysbench/tasks/install-deps/suse/main.yml
 create mode 100644 playbooks/roles/sysbench/tasks/main.yaml
 create mode 100644 playbooks/roles/sysbench/templates/mysql.conf.j2
 create mode 100755 playbooks/roles/sysbench/templates/root-user/0001-setup-sysbench-permissions.sh
 create mode 100755 playbooks/roles/sysbench/templates/root-user/0002-install-mysql-shell-plugin-reqs.sh
 create mode 100755 playbooks/roles/sysbench/templates/root-user/post-entrypoint-custom-bringup.sh
 create mode 100644 playbooks/sysbench.yml
 create mode 100644 workflows/sysbench/Kconfig
 create mode 100644 workflows/sysbench/Kconfig.docker
 create mode 100644 workflows/sysbench/Kconfig.ext4
 create mode 100644 workflows/sysbench/Kconfig.fs
 create mode 100644 workflows/sysbench/Kconfig.xfs
 create mode 100644 workflows/sysbench/Makefile
.gitignore +2 -0
index ba88777b7829..9138399a8fbc 100644
@@ -65,6 +65,8 @@ workflows/gitr/results/
 workflows/ltp/results/
 workflows/nfstest/results/
 
+workflows/sysbench/results/
+
 playbooks/roles/linux-mirror/linux-mirror-systemd/*.service
 playbooks/roles/linux-mirror/linux-mirror-systemd/*.timer
 playbooks/roles/linux-mirror/linux-mirror-systemd/mirrors.yaml
defconfigs/sysbench-mysql-atomic-tps-variability new file +29 -0
new file mode 100644
index 000000000000..26ccca43e26f
@@ -0,0 +1,29 @@
+CONFIG_GUESTFS=y
+CONFIG_LIBVIRT=y
+
+CONFIG_WORKFLOWS=y
+CONFIG_WORKFLOW_LINUX_CUSTOM=y
+
+CONFIG_BOOTLINUX=y
+CONFIG_BOOTLINUX_9P=y
+CONFIG_BOOTLINUX_LINUS=y
+CONFIG_BOOTLINUX_TREE_VFS=y
+CONFIG_BOOTLINUX_TREE_VFS_REF_LBS=y
+CONFIG_BOOTLINUX_TREE_VFS_REF="vfs.blocksize"
+
+CONFIG_WORKFLOWS_TESTS=y
+CONFIG_WORKFLOWS_LINUX_TESTS=y
+CONFIG_WORKFLOWS_DEDICATED_WORKFLOW=y
+CONFIG_KDEVOPS_WORKFLOW_DEDICATE_SYSBENCH=y
+CONFIG_KDEVOPS_WORKFLOW_ENABLE_SYSBENCH=y
+
+CONFIG_SYSBENCH_DOCKER=y
+CONFIG_SYSBENCH_TYPE_MYSQL_DOCKER=y
+CONFIG_SYSBENCH_MYSQL_CONTAINER_IMAGE_8_0=y
+
+CONFIG_SYSBENCH_TEST_ATOMICS=y
+CONFIG_SYSBENCH_TEST_ATOMICS_TPS_VARIABILITY=y
+CONFIG_SYSBENCH_TEST_ATOMICS_XFS_16K_4KS_LBS=y
+CONFIG_SYSBENCH_TEST_ATOMICS_EXT4_4K_4KS_BIGALLOC_16K=y
+
+CONFIG_DEVCONFIG_ENABLE_SYSTEMD_JOURNAL_REMOTE=y
kconfigs/workflows/Kconfig +26 -0
index 6530ce3cf50e..c81e5bb524c4 100644
@@ -175,6 +175,13 @@ config KDEVOPS_WORKFLOW_DEDICATE_NFSTEST
 	  This will dedicate your configuration to running only the
 	  nfstest workflow in separate target nodes per testing group.
 
+config KDEVOPS_WORKFLOW_DEDICATE_SYSBENCH
+	bool "sysbench"
+	select KDEVOPS_WORKFLOW_ENABLE_SYSBENCH
+	help
+	  This will dedicate your configuration to running only the
+	  sysbench workflow.
+
 endchoice
 
 endif
@@ -256,6 +263,14 @@ config KDEVOPS_WORKFLOW_NOT_DEDICATED_ENABLE_NFSTEST
 	  Select this option if you want to provision nfstest on a
 	  single target node for by-hand testing.
 
+config KDEVOPS_WORKFLOW_NOT_DEDICATED_ENABLE_SYSBENCH
+	bool "sysbench"
+	select KDEVOPS_WORKFLOW_ENABLE_SYSBENCH
+	depends on LIBVIRT || TERRAFORM_PRIVATE_NET
+	help
+	  Select this option if you want to provision sysbench on a
+	  single target node for by-hand testing.
+
 endif # !WORKFLOWS_DEDICATED_WORKFLOW
 
 config KDEVOPS_WORKFLOW_ENABLE_FSTESTS
@@ -347,6 +362,17 @@ source "workflows/nfstest/Kconfig"
 endmenu
 endif # KDEVOPS_WORKFLOW_ENABLE_NFSTEST
 
+config KDEVOPS_WORKFLOW_ENABLE_SYSBENCH
+	bool
+	output yaml
+	default y if KDEVOPS_WORKFLOW_NOT_DEDICATED_ENABLE_SYSBENCH || KDEVOPS_WORKFLOW_DEDICATE_SYSBENCH
+
+if KDEVOPS_WORKFLOW_ENABLE_SYSBENCH
+menu "Configure and run the sysbench tests"
+source "workflows/sysbench/Kconfig"
+endmenu
+endif # KDEVOPS_WORKFLOW_ENABLE_SYSBENCH
+
 config KDEVOPS_WORKFLOW_GIT_CLONES_KDEVOPS_GIT
 	bool
 	default y if KDEVOPS_WORKFLOW_ENABLE_FSTESTS || KDEVOPS_WORKFLOW_ENABLE_BLKTESTS
playbooks/python/workflows/sysbench/sysbench-tps-compare.py new file +115 -0

115 lines not on this page · raw message

playbooks/python/workflows/sysbench/sysbench-tps-plot.py new file +92 -0

92 lines not on this page · raw message

playbooks/python/workflows/sysbench/sysbench-tps-variance.py new file +108 -0

108 lines not on this page · raw message

playbooks/roles/gen_hosts/tasks/main.yml +55 -0

58 lines not on this page · raw message

playbooks/roles/gen_hosts/templates/sysbench.j2 new file +23 -0
new file mode 100644
index 000000000000..76503ab76176
@@ -0,0 +1,23 @@
+[all]
+{% for test_type in enabled_sysbench_tests %}
+{{ kdevops_host_prefix }}-{{ test_type }}
+{% if kdevops_baseline_and_dev %}
+{{ kdevops_host_prefix }}-{{ test_type }}-dev
+{% endif %}
+{% endfor %}
+[all:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
+[baseline]
+{% for test_type in enabled_sysbench_tests %}
+{{ kdevops_host_prefix }}-{{ test_type }}
+{% endfor %}
+[baseline:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
+[dev]
+{% if kdevops_baseline_and_dev %}
+  {% for test_type in enabled_sysbench_tests %}
+{{ kdevops_host_prefix }}-{{ test_type }}-dev
+  {% endfor %}
+{% endif %}
+[dev:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_nodes/defaults/main.yml +2 -0
index 9955135594cb..00971e293d12 100644
@@ -103,6 +103,8 @@ bootlinux_9p_driver: "virtio-9p-pci"
 
 guestfs_requires_uefi: False
 
+kdevops_workflow_enable_sysbench: False
+
 pcie_passthrough_enable: False
 pcie_passthrough_target_type_first_guest: False
 pcie_passthrough_target_type_all_one_guest_name: False
playbooks/roles/gen_nodes/tasks/main.yml +86 -0

98 lines not on this page · raw message

playbooks/roles/sysbench/defaults/main.yml new file +52 -0

52 lines not on this page · raw message

playbooks/roles/sysbench/tasks/install-deps/debian/main.yml new file +31 -0
new file mode 100644
index 000000000000..90837a167eab
@@ -0,0 +1,31 @@
+---
+- name: Import optional extra_args file
+  include_vars: "{{ item }}"
+  ignore_errors: yes
+  with_first_found:
+    - files:
+      - "../extra_vars.yml"
+      - "../extra_vars.yaml"
+      - "../extra_vars.json"
+      skip: true
+  tags: vars
+
+- name: Update apt cache
+  become: yes
+  become_method: sudo
+  apt:
+    update_cache: yes
+  tags: deps
+
+- name: Install sysbench deps
+  become: yes
+  become_method: sudo
+  apt:
+    name:
+      - docker
+      - docker.io
+      - locales
+      - rsync
+    state: present
+    update_cache: yes
+  tags: [ 'deps' ]
playbooks/roles/sysbench/tasks/install-deps/main.yml new file +12 -0
new file mode 100644
index 000000000000..4e01d57dc38b
@@ -0,0 +1,12 @@
+---
+- include_role:
+    name: pkg
+
+# tasks to install dependencies for oscheck
+- name: oscheck distribution ospecific setup
+  import_tasks: tasks/install-deps/debian/main.yml
+  when: ansible_facts['os_family']|lower == 'debian'
+- import_tasks: tasks/install-deps/suse/main.yml
+  when: ansible_facts['os_family']|lower == 'suse'
+- import_tasks: tasks/install-deps/redhat/main.yml
+  when: ansible_facts['os_family']|lower == 'redhat'
playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml new file +43 -0

43 lines not on this page · raw message

playbooks/roles/sysbench/tasks/install-deps/suse/main.yml new file +67 -0

67 lines not on this page · raw message

playbooks/roles/sysbench/tasks/main.yaml new file +530 -0

530 lines not on this page · raw message

playbooks/roles/sysbench/templates/mysql.conf.j2 new file +94 -0

94 lines not on this page · raw message

playbooks/roles/sysbench/templates/root-user/0001-setup-sysbench-permissions.sh new file +3 -0
new file mode 100755
index 000000000000..4711c244afc4
@@ -0,0 +1,3 @@
+#!/bin/bash
+mysql -u root -p{{ sysbench_db_password }} -e \
+	"CREATE USER {{ sysbench_db_name }}@'%' IDENTIFIED BY '{{ sysbench_root_db_password }}'; GRANT ALL PRIVILEGES ON {{ sysbench_db_name }}.* to {{ sysbench_db_username }}@'%';"
playbooks/roles/sysbench/templates/root-user/0002-install-mysql-shell-plugin-reqs.sh new file +3 -0
new file mode 100755
index 000000000000..961de4e601f4
@@ -0,0 +1,3 @@
+#!/bin/bash
+microdnf install -y python-pip
+pip install pandas matplotlib
playbooks/roles/sysbench/templates/root-user/post-entrypoint-custom-bringup.sh new file +11 -0
new file mode 100755
index 000000000000..f67b0b642c5e
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+for i in /root/*.sh; do
+        BASENAME=$(basename "$i")
+        if [[ ! "$BASENAME" =~ ^[0-9] ]]; then
+                continue
+        fi
+        if [[ -x "$i" ]]; then
+                "$i"
+        fi
+done
playbooks/sysbench.yml new file +4 -0
new file mode 100644
index 000000000000..61026356edc7
@@ -0,0 +1,4 @@
+---
+- hosts: all
+  roles:
+    - role: sysbench
workflows/Makefile +4 -0
index 34afb9af3f9b..d2b31d1a4e92 100644
@@ -50,6 +50,10 @@ ifeq (y,$(CONFIG_KDEVOPS_WORKFLOW_ENABLE_NFSTEST))
 include workflows/nfstest/Makefile
 endif # CONFIG_KDEVOPS_WORKFLOW_ENABLE_NFSTEST == y
 
+ifeq (y,$(CONFIG_KDEVOPS_WORKFLOW_ENABLE_SYSBENCH))
+include workflows/sysbench/Makefile
+endif # CONFIG_KDEVOPS_WORKFLOW_ENABLE_SYSBENCH == y
+
 ANSIBLE_EXTRA_ARGS += $(WORKFLOW_ARGS)
 ANSIBLE_EXTRA_ARGS_SEPARATED += $(WORKFLOW_ARGS_SEPARATED)
 ANSIBLE_EXTRA_ARGS_DIRECT += $(WORKFLOW_ARGS_DIRECT)
workflows/sysbench/Kconfig new file +127 -0

127 lines not on this page · raw message

workflows/sysbench/Kconfig.docker new file +130 -0

130 lines not on this page · raw message

workflows/sysbench/Kconfig.ext4 new file +124 -0

124 lines not on this page · raw message

workflows/sysbench/Kconfig.fs new file +173 -0

173 lines not on this page · raw message

workflows/sysbench/Kconfig.xfs new file +162 -0

162 lines not on this page · raw message

workflows/sysbench/Makefile new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.45.2