Skip to content

Commit

Permalink
Add YAML configuration option (#325)
Browse files Browse the repository at this point in the history
You can use an on-disk YAML configuration file as an alternative configuration option.

See [yml-samples](https://github.com/minio/warp/tree/master/yml-samples) for a collection of
configuration files for each benchmark type.

To run a benchmark, use `λ warp run <file.yml>`.

Values can be injected from the command line using one or multiple `-var VarName=Value`.
These values can be referenced inside YAML files with `{{.VarName}}`.
Go [text templates](https://pkg.go.dev/text/template) are used for this.
  • Loading branch information
klauspost committed Jul 26, 2024
1 parent c5d1f17 commit b3452c3
Show file tree
Hide file tree
Showing 26 changed files with 2,174 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ jobs:
args: release --clean --skip=publish --snapshot
-
name: Upload Win64 Binaries
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: success()
with:
name: Warp-Snapshot-Build-Win64
path: dist/warp_windows_amd64_v1
-
name: Upload Linux Binaries
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: success()
with:
name: Warp-Snapshot-Build-Linux-amd64
path: dist/warp_linux_amd64_v1
-
name: Upload MacOS Binaries
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: success()
with:
name: Warp-Snapshot-Build-MacOSX-amd64
Expand Down
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ S3 benchmarking tool.

## Build with source

Warp require minimum version is `go1.22`, please ensure you have compatible version for this build.
Warp requires minimum Go `go1.21`, please ensure you have compatible version for this build.

You can follow easy step below to build project
- Clone project
```
git clone https://github.com/minio/warp.git
λ git clone https://github.com/minio/warp.git
```
- Change directory and build
```
cd warp && go build
λ cd warp && go build
```
- To run a test, please run
```
./warp [options]
λ ./warp [options]
```
# Configuration

Expand All @@ -49,15 +49,28 @@ If your server is incompatible with [AWS v4 signatures](https://docs.aws.amazon.

# Usage

`warp command [options]`
`λ warp command [options]`

Example running a mixed type benchmark against 8 servers named `s3-server-1` to `s3-server-8`
on port 9000 with the provided keys:

`warp mixed --host=s3-server{1...8}:9000 --access-key=minio --secret-key=minio123 --autoterm`
`λ warp mixed --host=s3-server{1...8}:9000 --access-key=minio --secret-key=minio123 --autoterm`

This will run the benchmark for up to 5 minutes and print the results.

## YAML configuration

As an alternative configuration option you can use an on-disk YAML configuration file.

See [yml-samples](https://github.com/minio/warp/tree/master/yml-samples) for a collection of
configuration files for each benchmark type.

To run a benchmark use `λ warp run <file.yml>`.

Values can be injected from the commandline using one or multiple `-var VarName=Value`.
These values can be referenced inside YAML files with `{{.VarName}}`.
Go [text templates](https://pkg.go.dev/text/template) are used for this.

# Benchmarks

All benchmarks operate concurrently. By default, 20 operations will run concurrently.
Expand Down Expand Up @@ -110,7 +123,7 @@ WARNING: Never run warp clients on a publicly exposed port. Clients have the pot
Clients are started with

```
warp client [listenaddress:port]
λ warp client [listenaddress:port]
```

`warp client` Only accepts an optional host/ip to listen on, but otherwise no specific parameters.
Expand Down Expand Up @@ -141,7 +154,7 @@ If no host port is specified the default is added.
Example:

```
warp get --duration=3m --warp-client=client-{1...10} --host=minio-server-{1...16} --access-key=minio --secret-key=minio123
λ warp get --duration=3m --warp-client=client-{1...10} --host=minio-server-{1...16} --access-key=minio --secret-key=minio123
```

Note that parameters apply to *each* client.
Expand Down Expand Up @@ -309,8 +322,6 @@ will attempt to run `--concurrent` concurrent downloads.

The analysis will include the upload stats as `PUT` operations and the `GET` operations.



```
Operation: GET
* Average: 94.10 MiB/s, 9866.97 obj/s
Expand Down Expand Up @@ -407,7 +418,7 @@ Since the object size is of little importance, only objects per second is report

Example:
```
$ warp stat --autoterm
λ warp stat --autoterm
[...]
-------------------
Operation: STAT
Expand Down Expand Up @@ -735,7 +746,7 @@ These are the data fields exported:
| `ops_started` | Operations started within segment |
| `ops_ended` | Operations ended within the segment |
| `errors` | Errors logged on operations ending within the segment |
| `mb_per_sec` | MiB/s of operations within the segment (*distributed*) |
| `mb_per_sec` | MiB/s of operations within the segment (*distributed*) |
| `ops_ended_per_sec` | Operations that ended within the segment per second |
| `objs_per_sec` | Objects per second processed in the segment (*distributed*) |
| `start_time` | Absolute start time of the segment |
Expand Down Expand Up @@ -783,7 +794,7 @@ The usual analysis parameters can be applied to define segment lengths.

## Merging Benchmarks

It is possible to merge runs from several clients using the `warp merge (file1) (file2) [additional files...]` command.
It is possible to merge runs from several clients using the `λ warp merge (file1) (file2) [additional files...]` command.

The command will output a combined data file with all data that overlap in time.

Expand Down
6 changes: 6 additions & 0 deletions cli/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ func writeSegs(ctx *cli.Context, wrSegs io.Writer, ops bench.Operations, allThre

// Write segments per endpoint
eps := ops.SortSplitByEndpoint()
if len(eps) == 1 {
cl := ops.SortSplitByClient()
if len(cl) > 1 {
eps = cl
}
}
epsSorted := stringKeysSorted(eps)
if details && len(eps) > 1 {
for _, ep := range epsSorted {
Expand Down
2 changes: 2 additions & 0 deletions cli/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ func checkBenchmark(ctx *cli.Context) {
madmin.ProfilerBlock,
madmin.ProfilerMutex,
madmin.ProfilerTrace,
madmin.ProfilerCPUIO,
madmin.ProfilerThreads,
}

_, err := parseInfluxURL(ctx)
Expand Down
3 changes: 2 additions & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func init() {
cmpCmd,
mergeCmd,
clientCmd,
runCmd,
}
appCmds = append(append(appCmds, a...), b...)
benchCmds = a
Expand Down Expand Up @@ -214,7 +215,7 @@ func registerApp(name string, appCmds []cli.Command) *cli.App {
app.Commands = commands
app.Author = "MinIO, Inc."
app.Version = pkg.Version + " - " + pkg.ShortCommitID
app.Copyright = "(c) 2020-2023 MinIO, Inc."
app.Copyright = "(c) 2020-2024 MinIO, Inc."
app.Compiled, _ = time.Parse(time.RFC3339, pkg.ReleaseTime)
app.Flags = append(app.Flags, profileFlags...)
app.Flags = append(app.Flags, globalFlags...)
Expand Down
2 changes: 1 addition & 1 deletion cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func clientTransport(ctx *cli.Context) http.RoundTripper {
}).DialContext,
MaxIdleConnsPerHost: ctx.Int("concurrent"),
WriteBufferSize: ctx.Int("sndbuf"), // Configure beyond 4KiB default buffer size.
ReadBufferSize: ctx.Int("sndbuf"), // Configure beyond 4KiB default buffer size.
ReadBufferSize: ctx.Int("rcvbuf"), // Configure beyond 4KiB default buffer size.
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 15 * time.Second,
ExpectContinueTimeout: 10 * time.Second,
Expand Down
3 changes: 3 additions & 0 deletions cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func mainDelete(ctx *cli.Context) error {
ListFlat: ctx.Bool("list-flat"),
ListPrefix: ctx.String("prefix"),
}
if b.ListExisting && !ctx.IsSet("objects") {
b.CreateObjects = 0
}
return runBench(ctx, &b)
}

Expand Down
21 changes: 14 additions & 7 deletions cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ var globalWG sync.WaitGroup

// Set global states. NOTE: It is deliberately kept monolithic to ensure we dont miss out any flags.
func setGlobalsFromContext(ctx *cli.Context) error {
quiet := ctx.IsSet("quiet")
debug := ctx.IsSet("debug")
json := ctx.IsSet("json")
noColor := ctx.IsSet("no-color")
quiet := ctx.Bool("quiet")
debug := ctx.Bool("debug")
json := ctx.Bool("json")
noColor := ctx.Bool("no-color")
setGlobals(quiet, debug, json, noColor)
return nil
}
Expand Down Expand Up @@ -209,9 +209,16 @@ var ioFlags = []cli.Flag{
Usage: "Run this many concurrent operations per warp client",
},
cli.IntFlag{
Name: "sndbuf",
Value: 32 * 1024, // 32KiB up from 4KiB default
Usage: "specify custom read/write socket buffer size in bytes",
Name: "sndbuf",
Value: 32 * 1024, // 32KiB up from 4KiB default
Usage: "specify custom write socket buffer size in bytes",
Hidden: true,
},
cli.IntFlag{
Name: "rcvbuf",
Value: 32 * 1024, // 32KiB up from 4KiB default
Usage: "specify custom read socket buffer size in bytes",
Hidden: true,
},
cli.BoolFlag{
Name: "noprefix",
Expand Down
3 changes: 3 additions & 0 deletions cli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ func mainGet(ctx *cli.Context) error {
ListFlat: ctx.Bool("list-flat"),
ListPrefix: ctx.String("prefix"),
}
if b.ListExisting && !ctx.IsSet("objects") {
b.CreateObjects = 0
}
return runBench(ctx, &b)
}

Expand Down
2 changes: 1 addition & 1 deletion cli/mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var mixedFlags = []cli.Flag{
},
cli.Float64Flag{
Name: "delete-distrib",
Usage: "The amount of DELETE operations. Must be at least the same as PUT.",
Usage: "The amount of DELETE operations. Must be same or lower than -put-distrib",
Value: 10,
},
}
Expand Down
Loading

0 comments on commit b3452c3

Please sign in to comment.