Skip to content

Conversation

@AlanRostem
Copy link
Collaborator

@AlanRostem AlanRostem commented Jan 17, 2025

Fixes #168

Previously, the --hosts cli flag was omitted when integrating Cue. Now I have introduced --client-hosts and --replica-hosts to the cli so that things can work like before and be compatible with Cue if the user chooses to.

Both Cue and Viper (.toml) are compatible with the framework.

The code has also been adapted to support the following:

  • Multiple config formats
  • One standardized ExperimentConfig struct that holds all possible parameters
  • Simpler code for experiment/test setup, independent of config format
  • CLI flags, .toml, and .cue configs can work in tandem

This PR also solves #150, #159, and #174

@AlanRostem AlanRostem linked an issue Jan 17, 2025 that may be closed by this pull request
AlanRostem and others added 7 commits January 17, 2025 10:42
This just reorganizes the placement of some types and methods
to make the ExperimentConfig appear at the top of the file and
make the order of methods more consistent. Also adds a few doc
comments, and makes the receiver variable consistent across all
methods on ExperimentConfig.
The old implementation of iago did a hacky solution to assign
ports to docker containers that have been fixed recently. This
commit bring this updated version of iago into go.mod.
@AlanRostem AlanRostem mentioned this pull request Jan 21, 2025
AlanRostem and others added 3 commits January 21, 2025 09:10
The math/rand/v2 package was added in Go 1.22 and we should use it.
Moreover, we should not use reflect.Swapper(); see code for the
very simple func()-based alternative.

This also moves the source of random values to the package level
so that we don't create a new source for every call to tree.Shuffle.

This does improve performance a bit, especially for smaller slices:

```shell
$ benchstat reflect.txt func.txt
goos: darwin
goarch: arm64
pkg: github.com/relab/hotstuff/internal/tree
cpu: Apple M2 Max
                        │  reflect.txt  │              func.txt               │
                        │    sec/op     │    sec/op     vs base               │
Randomize/size=10-12      103.70n ± ∞ ¹   66.48n ± ∞ ¹  -35.89% (p=0.008 n=5)
Randomize/size=100-12      529.8n ± ∞ ¹   493.5n ± ∞ ¹   -6.85% (p=0.008 n=5)
Randomize/size=1000-12     4.451µ ± ∞ ¹   4.426µ ± ∞ ¹        ~ (p=0.222 n=5)
Randomize/size=10000-12    43.16µ ± ∞ ¹   43.17µ ± ∞ ¹        ~ (p=0.841 n=5)
geomean                    1.802µ         1.582µ        -12.21%
¹ need >= 6 samples for confidence interval at level 0.95
```

```shell
$ benchstat func.txt single-rnd.txt
goos: darwin
goarch: arm64
pkg: github.com/relab/hotstuff/internal/tree
cpu: Apple M2 Max
                        │   func.txt   │           single-rnd.txt            │
                        │    sec/op    │    sec/op     vs base               │
Randomize/size=10-12      66.48n ± ∞ ¹   47.59n ± ∞ ¹  -28.41% (p=0.008 n=5)
Randomize/size=100-12     493.5n ± ∞ ¹   470.6n ± ∞ ¹   -4.64% (p=0.008 n=5)
Randomize/size=1000-12    4.426µ ± ∞ ¹   4.411µ ± ∞ ¹        ~ (p=0.175 n=5)
Randomize/size=10000-12   43.17µ ± ∞ ¹   43.18µ ± ∞ ¹        ~ (p=0.548 n=5)
geomean                   1.582µ         1.437µ         -9.18%
¹ need >= 6 samples for confidence interval at level 0.95
```

```shell
$ benchstat reflect.txt single-rnd.txt
goos: darwin
goarch: arm64
pkg: github.com/relab/hotstuff/internal/tree
cpu: Apple M2 Max
                        │  reflect.txt  │           single-rnd.txt            │
                        │    sec/op     │    sec/op     vs base               │
Randomize/size=10-12      103.70n ± ∞ ¹   47.59n ± ∞ ¹  -54.11% (p=0.008 n=5)
Randomize/size=100-12      529.8n ± ∞ ¹   470.6n ± ∞ ¹  -11.17% (p=0.008 n=5)
Randomize/size=1000-12     4.451µ ± ∞ ¹   4.411µ ± ∞ ¹   -0.90% (p=0.032 n=5)
Randomize/size=10000-12    43.16µ ± ∞ ¹   43.18µ ± ∞ ¹        ~ (p=0.841 n=5)
geomean                    1.802µ         1.437µ        -20.27%
¹ need >= 6 samples for confidence interval at level 0.95
```
Just moved the output check first:
- allows faster error out, if the output path is bad
- avoids cfg.Output assignments
… intended to be used in tests. This is what caused the test fails.
@meling meling linked an issue Jan 23, 2025 that may be closed by this pull request
This replaces the string-based byzantine specification of things
like silent:1 and slow:1. This is more specific and cannot result
in parse errors.
@meling meling linked an issue Jan 23, 2025 that may be closed by this pull request
@AlanRostem AlanRostem changed the title Simplify config handling Simplify config handling and other fixes to orchestration Jan 24, 2025
@AlanRostem AlanRostem merged commit 205648a into master Jan 24, 2025
4 checks passed
@AlanRostem AlanRostem deleted the 168-simplify-cfg-handling branch January 24, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: TestDeployment fails on Linux (docker issue) Simplify the configuration handling code Refactor: Simplify the experiment framework

3 participants