Skip to content

Commit

Permalink
Add s3zip benchmark (#236)
Browse files Browse the repository at this point in the history
The `zip` command benchmarks the MinIO [s3zip](https://blog.min.io/small-file-archives/) 
extension that allows

This will upload a single zip file with 10000 individual files (change with `--files`) of 10KiB 
each (changed with `--obj.size`).

The benchmark will then download individual files concurrently and present the 
result as a GET benchmark.

Example:
```
λ warp zip --obj.size=1MiB -duration=1m
warp: Benchmark data written to "warp-zip-2022-12-02[150109]-xmXj.csv.zst"

----------------------------------------
Operation: GET
* Average: 728.78 MiB/s, 728.78 obj/s

Throughput, split into 59 x 1s:
 * Fastest: 757.0MiB/s, 756.96 obj/s
 * 50% Median: 732.7MiB/s, 732.67 obj/s
 * Slowest: 662.7MiB/s, 662.65 obj/s
```

This will only work on recent MinIO versions, from 2022 and going forward.
  • Loading branch information
klauspost authored Dec 2, 2022
1 parent 5b37f37 commit 04ce94a
Show file tree
Hide file tree
Showing 9 changed files with 409 additions and 53 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,41 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.17.x, 1.18.x]
os: [ubuntu-latest]
go-version: [1.18.x, 1.19.x]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
run: go test -v -race ./...

lint:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.x

- name: Checkout code
uses: actions/checkout@v2

- name: Vet
run: go vet ./...

- name: fmt
run: diff <(gofmt -d .) <(printf "")

- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
$(go env GOPATH)/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
go test -v -race ./...
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17.x
go-version: 1.19.x
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@53acad1befee355d46f71cccf6ab4d885eb4f77f
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,32 @@ warp: Cleanup done.
```


## ZIP

The `zip` command benchmarks the MinIO [s3zip](https://blog.min.io/small-file-archives/) extension
that allows

This will upload a single zip file with 10000 individual files (change with `--files`) of 10KiB each (changed with `--obj.size`).

The benchmark will then download individual files concurrently and present the result as a GET benchmark.

Example:
```
λ warp zip --obj.size=1MiB -duration=1m
warp: Benchmark data written to "warp-zip-2022-12-02[150109]-xmXj.csv.zst"
----------------------------------------
Operation: GET
* Average: 728.78 MiB/s, 728.78 obj/s
Throughput, split into 59 x 1s:
* Fastest: 757.0MiB/s, 756.96 obj/s
* 50% Median: 732.7MiB/s, 732.67 obj/s
* Slowest: 662.7MiB/s, 662.65 obj/s
```

This will only work on recent MinIO versions, from 2022 and going forward.

# Analysis

When benchmarks have finished all request data will be saved to a file and an analysis will be shown.
Expand Down
1 change: 1 addition & 0 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func init() {
versionedCmd,
retentionCmd,
multipartCmd,
zipCmd,
}
b := []cli.Command{
analyzeCmd,
Expand Down
8 changes: 8 additions & 0 deletions cli/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ var putFlags = []cli.Flag{
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.StringFlag{
Name: "part.size",
Value: "",
Usage: "Multipart part size. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
Hidden: true,
},
}

// Put command.
Expand Down Expand Up @@ -70,11 +76,13 @@ func mainPut(ctx *cli.Context) error {

// putOpts retrieves put options from the context.
func putOpts(ctx *cli.Context) minio.PutObjectOptions {
pSize, _ := toSize(ctx.String("part.size"))
return minio.PutObjectOptions{
ServerSideEncryption: newSSE(ctx),
DisableMultipart: ctx.Bool("disable-multipart"),
SendContentMd5: ctx.Bool("md5"),
StorageClass: ctx.String("storage-class"),
PartSize: pSize,
}
}

Expand Down
97 changes: 97 additions & 0 deletions cli/zip.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Warp (C) 2019-2022 MinIO, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package cli

import (
"fmt"
"time"

"github.com/minio/cli"
"github.com/minio/pkg/console"
"github.com/minio/warp/pkg/bench"
)

var zipFlags = []cli.Flag{
cli.IntFlag{
Name: "files",
Value: 10000,
Usage: "Number of files to upload in the zip file.",
},
cli.StringFlag{
Name: "obj.size",
Value: "10KiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.StringFlag{
Name: "part.size",
Value: "",
Usage: "Multipart part size. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
Hidden: true,
},
}

var zipCmd = cli.Command{
Name: "zip",
Usage: "benchmark minio s3zip",
Action: mainZip,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, zipFlags, genFlags, benchFlags, analyzeFlags),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS]
-> see https://github.com/minio/warp#zip
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}`,
}

// mainGet is the entry point for get command.
func mainZip(ctx *cli.Context) error {
checkZipSyntax(ctx)
ctx.Set("noprefix", "true")
src := newGenSource(ctx, "obj.size")
b := bench.S3Zip{
Common: bench.Common{
Client: newClient(ctx),
Concurrency: ctx.Int("concurrent"),
Source: src,
Bucket: ctx.String("bucket"),
Location: "",
PutOpts: putOpts(ctx),
Locking: true,
},
CreateFiles: ctx.Int("files"),
ZipObjName: fmt.Sprintf("%d.zip", time.Now().UnixNano()),
}
return runBench(ctx, &b)
}

func checkZipSyntax(ctx *cli.Context) {
if ctx.NArg() > 0 {
console.Fatal("Command takes no arguments")
}
if ctx.Int("files") <= 0 {
console.Fatal("There must be more than 0 objects.")
}

checkAnalyze(ctx)
checkBenchmark(ctx)
}
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module github.com/minio/warp

go 1.17
go 1.18

require (
github.com/bygui86/multi-profile/v2 v2.1.0
github.com/cheggaaa/pb v1.0.29
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.13.0
github.com/gorilla/websocket v1.5.0
github.com/klauspost/compress v1.15.8
github.com/klauspost/compress v1.15.12
github.com/minio/cli v1.22.0
github.com/minio/madmin-go v1.4.1
github.com/minio/madmin-go v1.7.5
github.com/minio/mc v0.0.0-20220628120902-bf1145af1e48
github.com/minio/md5-simd v1.1.2
github.com/minio/minio-go/v7 v7.0.31
github.com/minio/minio-go/v7 v7.0.45
github.com/minio/pkg v1.1.26
github.com/posener/complete v1.2.3
github.com/secure-io/sio-go v0.3.1
golang.org/x/net v0.0.0-20220630215102-69896b714898
golang.org/x/net v0.0.0-20221017152216-f25eb7ecb193
)

require (
Expand All @@ -28,14 +28,14 @@ require (
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.14 // indirect
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx v1.2.25 // indirect
github.com/lestrrat-go/option v1.0.0 // indirect
github.com/lufia/plan9stats v0.0.0-20220517141722-cf486979b281 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
Expand All @@ -45,19 +45,19 @@ require (
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/shirou/gopsutil/v3 v3.22.5 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/shirou/gopsutil/v3 v3.22.9 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/tinylib/msgp v1.1.6 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.5.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect
golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Loading

0 comments on commit 04ce94a

Please sign in to comment.