Charmed Sysbench Documentation
Charmed Sysbench is a multipurpose tool for benchmarking database applications with complex workloads. It can be deployed and used in both K8s and VM installations. To get started, integrate it with your database charm to begin running performance tests and visualize results.
Sysbench is an industry standard benchmarking tool which uses the Percona Lab implementation of the TPC-C standard.
This charm currently supports:
- MySQL databases via the
mysql_client
interface - PostgreSQL databases via the
postgresql_client
.
The legacy interfaces mysql
and pgsql
are not supported. For more information about modern charm interfaces, see this reference.
Contact us if you have any issues or questions about your use case.
Summary
Quickstart
Deploy sysbench:juju deploy sysbench
Integrate it with your charm:
juju integrate sysbench <your_db_charm>
Prepare the test database and run a performance test:
juju run sysbench/leader prepare
juju run sysbench/leader run
Stop the test:
juju run sysbench/leader stop
Clean/remove the test database:
juju run sysbench/leader clean
Configure
You can specify certain parameters for your test runs like threads and duration:juju config sysbench threads=<num_threads> duration=<seconds>
For a full list of the available config parameters, see the Configuration tab.
Monitoring
The sysbench charm supports COS integration.To use COS, integrate this charm with the grafana-agent
or grafana-agent-k8s
charm. It will open a scrape endpoint for the agent to collect metrics:
juju deploy grafana-agent grafana-sysbench # use grafana-agent-k8s for K8s!
juju relate grafana-sysbench sysbench
juju consume <cos_k8s>:admin/cos.prometheus
juju consume <cos_k8s>:admin/cos.grafana
juju consume <cos_k8s>:admin/cos.loki
juju relate grafana-sysbench prometheus
juju relate grafana-sysbench grafana
juju relate grafana-sysbench loki
There are currently no supported Grafana dashboards, but the data can be accessed directly on Prometheus:
Otherwise, it is possible to retrieve in-progress test results from the Prometheus exporter manually:
curl http://<sysbench_unit_ip>:8088
See all exposed metrics in the dedicated reference page.
Measure CPU/RAM/IO performance
The charm can be used as a tool to measure HW performance, e.g. CPU/RAM/IO:
juju deploy sysbench --to 0 # where 0 is the Juju id for VM/HW to load
juju ssh sysbench/0 bash
# CPU Benchmark
sysbench cpu run
sysbench cpu run --threads=$(nproc)
# MEMORY Benchmark
sysbench memory run --memory-block-size=1M --memory-total-size=16G
# IO Benchmark
sysbench fileio run --file-test-mode=seqwr --file-total-size=10G --file-num=5 --time=600
ls -lah test_file.*
> -rw------- 1 user user 2.0G May 1 18:20 test_file.0
> -rw------- 1 user user 2.0G May 1 18:20 test_file.1
> -rw------- 1 user user 2.0G May 1 18:20 test_file.2
> -rw------- 1 user user 2.0G May 1 18:19 test_file.3
> -rw------- 1 user user 2.0G May 1 18:19 test_file.4
sudo sh -c "sync && echo 3 > /proc/sys/vm/drop_caches"
sysbench fileio run --file-test-mode=rndrd --file-total-size=2G --file-num=5
sysbench fileio cleanup
Project and community
Charmed Sysbench is an open source project based on sysbench that warmly welcomes community contributions, suggestions, fixes and constructive feedback.
- Check our Code of Conduct
- Raise software issues or feature requests in GitHub
- Report security issues through LaunchPad.
- Meet the community and chat with us on Matrix
- Contribute to the code