forked from Deuxfleurs/mknet
Scenario based benchmarks will be ready soon
This commit is contained in:
parent
c75b239018
commit
f0db8ba560
9 changed files with 125 additions and 102 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
|||
[submodule "benchmarks/warp"]
|
||||
path = benchmarks/warp
|
||||
url = https://github.com/minio/warp
|
||||
[submodule "analysis/quentin"]
|
||||
path = analysis/quentin
|
||||
url = https://git.deuxfleurs.fr/quentin/benchmarks
|
||||
|
|
58
README.md
58
README.md
|
@ -1,43 +1,49 @@
|
|||
# mknet
|
||||
|
||||
## Installation
|
||||
mknet is a tool to simulate various network topologies
|
||||
locally thanks to network namespaces and traffic control (tc).
|
||||
|
||||
## Prepare your environment
|
||||
|
||||
Get the repository and its submodules:
|
||||
|
||||
```bash
|
||||
sudo pip3 install git+https://git.deuxfleurs.fr/trinity-1686a/mknet
|
||||
git clone https://git.deuxfleurs.fr/Deuxfleurs/mknet.git
|
||||
cd mknet
|
||||
git submodule update --init
|
||||
```
|
||||
|
||||
## Usage
|
||||
Compile benchmark tools:
|
||||
|
||||
```bash
|
||||
sudo rm -rf /tmp/garage-testnet/ # always start by deleting previous run
|
||||
sudo mknet create ./config.yml
|
||||
sudo mknet run-all example/deploy_garage.sh
|
||||
sudo mknet run dc1:dc1s1 garage -c /tmp/garage-testnet/dc1/dc1s1/garage.toml status
|
||||
sudo mknet destroy
|
||||
( cd benchmarks/warp && go build )
|
||||
( cd benchmarks/s3concurrent && go build )
|
||||
( cd benchmarks/s3lat && go build )
|
||||
```
|
||||
|
||||
## Instrumented daemons
|
||||
|
||||
If you want to use the scripts provided in the `example` folder,
|
||||
you must add to your path some tools.
|
||||
|
||||
### Garage (`deploy_garage.sh`)
|
||||
Switch to root as it is required by our tool,
|
||||
and setup your python environment.
|
||||
|
||||
```bash
|
||||
# see versions on https://garagehq.deuxfleurs.fr/_releases.html
|
||||
export GRG_ARCH=x86_64-unknown-linux-musl
|
||||
export GRG_VERSION=v0.5.0
|
||||
|
||||
sudo wget https://garagehq.deuxfleurs.fr/_releases/${GRG_VERSION}/${GRG_ARCH}/garage -O /usr/local/bin/garage
|
||||
sudo chmod +x /usr/local/bin/garage
|
||||
|
||||
garage help
|
||||
sudo -i
|
||||
pip3 install --user .
|
||||
( cd scenarios && pip3 install -r requirements.txt )
|
||||
```
|
||||
|
||||
### Minio (`deploy_minio.py`)
|
||||
## Run a test
|
||||
|
||||
```
|
||||
sudo wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio
|
||||
sudo chmod +x /usr/local/bin/minio
|
||||
(Not yet implemented)
|
||||
|
||||
```bash
|
||||
./mknet scenario ./benchmarks/garage-s3lat ./topo/single-dc.yml
|
||||
```
|
||||
|
||||
## Manual usage
|
||||
|
||||
```bash
|
||||
./mknet create ./topo/with-vdsl.yml
|
||||
./mknet run-all ./scenarios/garage-manual
|
||||
./mknet run dc1:dc1s1 /tmp/mknet-bin/garage* -c /tmp/mknet-store/garage/dc1/dc1s1/garage.toml status
|
||||
./mknet run-all ./scenarios/clean
|
||||
./mknet destroy
|
||||
|
||||
|
|
1
analysis/quentin
Submodule
1
analysis/quentin
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 902555b9d5db594fdad927f51c2d8984d6e9f6a5
|
1
benchmarks/s3concurrent/.gitignore
vendored
Normal file
1
benchmarks/s3concurrent/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
s3concurrent
|
|
@ -9,9 +9,9 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func buildMc() (*minio.Client, error) {
|
||||
|
@ -36,6 +36,7 @@ func buildMc() (*minio.Client, error) {
|
|||
type PRNG struct {
|
||||
rem int64
|
||||
}
|
||||
|
||||
func (r *PRNG) Read(p []byte) (n int, err error) {
|
||||
//log.Printf("rem=%d, buf=%d\n", r.rem, len(p))
|
||||
if int64(len(p)) > r.rem {
|
||||
|
@ -75,7 +76,7 @@ func putObj(buck string, size int64) error {
|
|||
key,
|
||||
prng,
|
||||
size,
|
||||
minio.PutObjectOptions{ContentType:"application/octet-stream"},
|
||||
minio.PutObjectOptions{ContentType: "application/octet-stream"},
|
||||
)
|
||||
|
||||
return err
|
||||
|
@ -91,7 +92,7 @@ func main() {
|
|||
|
||||
// Create Bucket
|
||||
buck := uuid.New().String()
|
||||
err = mc.MakeBucket(context.Background(), buck, minio.MakeBucketOptions{ })
|
||||
err = mc.MakeBucket(context.Background(), buck, minio.MakeBucketOptions{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
|
@ -104,7 +105,7 @@ func main() {
|
|||
syn := make(chan error)
|
||||
for j := 1; j <= i; j++ {
|
||||
go func() {
|
||||
syn <- putObj(buck, 1024 * 1024)
|
||||
syn <- putObj(buck, 1024*1024)
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
1
benchmarks/s3lat/.gitignore
vendored
Normal file
1
benchmarks/s3lat/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
s3lat
|
Binary file not shown.
|
@ -30,7 +30,7 @@ keys = key_api.KeyApi(api)
|
|||
|
||||
# Setup, launch on import
|
||||
storage_path = Path(shared.storage_path) / "garage" / env['HOST']
|
||||
if 'ZONE' in env:
|
||||
if 'ZONE' in env and env['ZONE'] != "":
|
||||
storage_path = Path(shared.storage_path) / "garage" / env['ZONE'] / env['HOST']
|
||||
config = storage_path / "garage.toml"
|
||||
env['GARAGE_CONFIG_FILE'] = str(config)
|
||||
|
@ -117,14 +117,17 @@ admin_token = "{admin}"
|
|||
f.write(json.dumps({
|
||||
"node_addr": f"{node_id}@{env['IP']}:3901",
|
||||
"node_id": node_id,
|
||||
"zone": env['ZONE'],
|
||||
"zone": env['ZONE'] if 'ZONE' in env and env['ZONE'] != "" else env['HOST'],
|
||||
"host": env['HOST'],
|
||||
}))
|
||||
|
||||
def destroy():
|
||||
dpid = Path(storage_path) / "daemon.pid"
|
||||
if exists(dpid):
|
||||
try:
|
||||
shared.exec(f"kill -9 $(cat {dpid})")
|
||||
except:
|
||||
pass
|
||||
shared.exec(f"rm -f {dpid}")
|
||||
if len(str(storage_path)) < 8: # arbitrary, stupid safe guard
|
||||
print(storage_path)
|
||||
|
|
7
scenarios/garage-manual
Executable file
7
scenarios/garage-manual
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
from fragments import garage, s3lat, shared
|
||||
|
||||
if shared.id() == 1:
|
||||
garage.deploy_coord()
|
||||
else:
|
||||
garage.deploy_follow()
|
Loading…
Reference in a new issue