Skip to content

Commit

Permalink
feat(GODT-1715): Add ImapTest scripts
Browse files Browse the repository at this point in the history
Add ImapTest scripts which can be used to evaluate the compliance of and
profile Gluon.

This patch also add some Documentation on how to use the scripts.
  • Loading branch information
LBeernaertProton committed Jul 18, 2022
1 parent 5a8ca73 commit a5a0edc
Show file tree
Hide file tree
Showing 5 changed files with 256,173 additions and 0 deletions.
43 changes: 43 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Gluon Benchmarks

Collection of benchmarks and/or tools to test and/or profile Gluon performance. See each folder's `README.md` for more information.


## Capturing Profiles

You can use the gluon demo binary as a way to profile Gluon. Be sure to build the binary with `go build`.

You need to run the benchmark for each type of profile you wish to generate as it is not possible to profile
multiple items at the same time.

Example:
```bash
./demo -profile-cpu -profile-path=$PWD # Generates $PWD/cpu.pprof - CPU Profiling.
./demo -profile-mem -profile-path=$PWD # Generates $PWD/mem.pprof - Memory Profiling.
./demo -profile-lock -profile-path=$PWD # Generates $PWD/block.pprof - Locking/blocking profiling.
```

When the benchmark has finished execution kill the demo binary and the profile data will be written out.

## Analysing the data

You need to install the pprof tool (`go install github.com/google/pprof`) to analyse the generated data.

After the tool is installed you can analyse the data with `pprof <path to .pprof file>`. See [this blog post](1) and
[this tutorial](2) for an introduction to pprof.

For a more comprehensible overview you can also launch pprof's web interface which includes many additions
such as a flamegraph.

```bash
pprof -http 127.0.0.1:8080 <path to .pprof file>
```

## Available Benchmarks/Tools
* [imaptest](imaptest)

## References

[1]: https://www.youtube.com/watch?v=N3PWzBeLX2M

[2]: https://go.dev/blog/pprof
41 changes: 41 additions & 0 deletions benchmarks/imaptest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ImapTest - Profiling & Compliance

This "benchmark" uses [Dovecot's ImapTest tool](https://imapwiki.org/ImapTest) to profile the performance of Gluon. The
information present here can also be used to verify the compliance of Gluon with the IMAP protocol.

## Installation

Follow the instructions outlined in [the tools' installation page](https://imapwiki.org/ImapTest/Installation)
to build the binary. The test mailbox is already present in this folder.

## Running ImapTest

The bare minimum required for running ImapTest is a username and a password:

```bash
imaptest host=127.0.0.1 port=1143 [email protected] pass=password1
```

For convenience, we have provided a few test scripts to quickly test Gluon with the demo binary present in this
repository.

* **default.sh**: Runs the default ImapTest benchmarks.
* **full.sh**: Runs every available ImapTest operation.

Both of these scripts can be customized with the following environment variables:

* **IMAPTEST_BIN**: Location of the ImapTest binary.
* **SECS**: Number of seconds for which to run ImapTest.
* **CLIENTS**: Number of concurrent clients used by ImapTest.

Example:
```bash
# Run imaptest for 60s with one conccurent client connection.
IMAPTEST_BIN=/bin/imaptest SECS=60 CLIENTS=1 ./default.sh
```

## Note about this tool
The execution of this tool is non-deterministic, this means it can't be used to compare profile runs of two different
versions.

It should be only be used to profile and/or stress the codebase in an isolation.
10 changes: 10 additions & 0 deletions benchmarks/imaptest/default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#/bin/bash

CLIENTS=${CLIENTS:-"200"}
SECS=${SECS:-"60"}
IMAPTEST_BIN=${IMAPTEST_BIN:-imaptest}

${IMAPTEST_BIN} host=127.0.0.1 port=1143 \
[email protected] pass=password1 \
mbox=dovecot-crlf \
no_pipelining secs=${SECS} clients=${CLIENTS}
Loading

0 comments on commit a5a0edc

Please sign in to comment.