An open API service indexing awesome lists of open source software.

https://github.com/engineersbox/database-benchmarking

Database Benchmarking Utilities
https://github.com/engineersbox/database-benchmarking

Last synced: 5 months ago
JSON representation

Database Benchmarking Utilities

Awesome Lists containing this project

README

          

# cassandra-benchmarking

Cassandra Benchmarking Utilities

## Build

### Cassandra

In order to create a cassandra image, run the following

```bash
docker build -t ghcr.io/engineersbox/cassandra:5.0 -f docker/instance/cassandra.dockerfile .
```

You can optionally supply a repo and commit-ish marker to build from:

* `--build-arg="REPOSITORY="` defaulting to
* `--build-arg="COMMIT_ISH="` defaulting to `cassandra-5.0`
* `--build-arg="UID="` defaulting to `1000`
* `--build-arg="GID="` defaulting to `1000`
* `--build-arg="OTEL_COLLECTOR_JAR_VERSION="` defaulting to `v2.2.0`
* `--build-arg="OTEL_JMX_JAR_VERSION="` defaulting to `v1.32.0`

The image can then be pushed to the GitHub container repository

```bash
docker push ghcr.io/engineersbox/cassandra:5.0
```

## OpenTelemetry Collector

```bash
docker build -t ghcr.io/engineersbox/otel-collector:latest -f docker/collector/otel.dockerfile .
```

* `--build-arg="OTEL_JMX_JAR_VERSION="` defaulting to `v1.32.0`

```bash
docker push ghcr.io/engineersbox/otel-collector:latest
```

## Startup

### Configuration

1. Ensure you set the values of any templates within the following config files:
* `config/otel/otel-collector.properties`
* `config/otel/otel-collector-config.yaml`
* `config/otel/otel-instance.properties`
* `config/otel/otel-instance-config.yaml`
* `docker/instance/.env`
2. Choose any additional appropriate configurations for Cassandra within the `config/cassandra`
directory.
3. This repo relies on the `vmprobe` utility, so make sure that is installed with your favourite
package manager.
4. Set up the desired keyspace and table mappings for metrics to be collected in `config/otel/jmx/jmx.groovy`
in the last part of the `__instrumentCassandra()` function.
5. Ensure you use the `scripts/apply_iptables_rules.sh` script to set up the required port access
between servers if you are using a remote configuration.
6. Configure the RMI server host in `config/cassandra/cassandra-env.sh` according to the isntructions in
the template parameter

### Casandra

Starting cassandra is straightforward, it requires the usage of the following and a parameter
denoting whether to remove all data and flush page cache. It can also be supplimented with
additional arguments to the `docker run` command.

```bash
sudo ./scripts/run_cassandra.sh
```

### OpenTelemetry Collector

Similarly for the OTEL collector with:

```bash
sudo ./scripts/run_otel.sh
```

## Remote Access

Deploying the collector or cassandra on a remote instance will require you to access the services
by forwarding the relevant port to your local machine via SSH (if it is not publically visible).

```bash
ssh -L :localhost:
```

## User Permissions

Using a normal docker configuration (not rootless) is simple to set user permissions for. Make sure
that any files and directories mounted into `cassandra` container are owned as `1000:1000` for the
`uid:gid` bits.

### Rootless Docker

Assuming that you have the container user congiured as `1000:1000` and your user on the host mapped
as `:100000:65536` in both `/etc/subuid` and `/etc/subgid`, then you will need ensure that any
directories/files mounted into the container used by the cassandra user are owned by `100999:100999`.

The reason for this is that the mapping will move any host users from 0 to 100000 up by 100000. As such
a host uid:gid binding of `1000:1000` corresponds to `100999:100999`. To do this, just run the following
over anything you intend to mount into the Cassandra container:

```bash
sudo chmod -R 100999:100999
```

## Collector

![OTEL, Loki, Prometheus, Tempo, Grafana](./docs/otel_lgtm.png)