---
title: Charmhub | Deploy Charmed Sysbench using Charmhub - The Open Operator Collection
description: Deploy the latest version of Charmed Sysbench on any cloud. Generates
  a load against your workload and collect metrics in Prometheus.
url: https://charmhub.io/sysbench
---

# Charmed Sysbench

[Canonical](https://charmhub.io/publisher/data-platform "View all packages from Canonical")

* [Canonical](https://charmhub.io/publisher/data-platform "View all packages from Canonical")

Platform:

22.04

stable 314

```
juju deploy sysbench
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Homepage](https://charmhub.io/sysbench)
* [Contact](mailto:Canonical Data Platform <data-platform@lists.launchpad.net>)

---

#### Contacts

##### Maintainers

+ [Canonical Data Platform](mailto:data-platform@lists.launchpad.net)

* [Submit a bug](https://github.com/canonical/sysbench-operator/issues)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

# 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](https://github.com/akopytov/sysbench) is an industry standard benchmarking tool which uses [the Percona Lab](https://github.com/Percona-Lab/sysbench-tpcc) implementation of the [TPC-C standard](https://www.tpc.org/tpcc/).

This charm currently supports:

* **MySQL** databases via the [`mysql_client`](https://github.com/canonical/charm-relation-interfaces/tree/main/interfaces/mysql_client/v0) interface
* **PostgreSQL** databases via the [`postgresql_client`](https://github.com/canonical/charm-relation-interfaces/blob/main/interfaces/postgresql_client/v0/README.md).

The legacy interfaces `mysql` and `pgsql` are **not** supported. For more information about modern charm interfaces, see [this reference](https://canonical.github.io/charm-relation-interfaces/).

[Contact us](https://charmhub.io/sysbench#heading--community) if you have any issues or questions about your use case.

## [Summary](https://charmhub.io/sysbench#p-31185-summary)

* [Quickstart](https://charmhub.io/sysbench#heading--quickstart)
* [Configure](https://charmhub.io/sysbench#heading--configure)
* [Monitor](https://charmhub.io/sysbench#heading--monitoring)
* [Metrics](https://discourse.charmhub.io/t/14028)

---

## [Quickstart](https://charmhub.io/sysbench#heading--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](https://charmhub.io/sysbench#heading--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](https://charmhub.io/sysbench#heading--monitoring)

The sysbench charm supports [COS](https://charmhub.io/topics/canonical-observability-stack) integration.

To use COS, integrate this charm with the [`grafana-agent`](https://charmhub.io/grafana-agent) or [`grafana-agent-k8s`](https://charmhub.io/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](https://discourse.charmhub.io/t/14028).

## [Measure CPU/RAM/IO performance](https://charmhub.io/sysbench#heading--configure)

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](https://charmhub.io/sysbench#heading--community)

Charmed Sysbench is an open source project based on [sysbench](https://github.com/akopytov/sysbench) that warmly welcomes community contributions, suggestions, fixes and constructive feedback.

* Check our [Code of Conduct](https://ubuntu.com/community/ethos/code-of-conduct)
* Raise software issues or feature requests in [GitHub](https://github.com/canonical/sysbench-operator/issues)
* Report security issues through [LaunchPad](https://wiki.ubuntu.com/DebuggingSecurity#How%20to%20File).
* Meet the community and chat with us on [Matrix](https://matrix.to/#/#charmhub-data-platform:ubuntu.com)
* [Contribute](https://github.com/canonical/sysbench-operator/blob/main/CONTRIBUTING.md) to the code

---

[Help improve this document in the forum](https://discourse.charmhub.io/t/charmed-sysbench-documentation-home/13945) ([guidelines](https://discourse.charmhub.io/t/how-to-write-docs-our-documentation-guidelines-for-contributors/1245)). Last updated 2 years ago.
