Skip to content

Commit

Permalink
update all help, cleanup some typos etc
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Sep 27, 2024
1 parent f1e6061 commit 36a6493
Show file tree
Hide file tree
Showing 15 changed files with 191 additions and 270 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
./hperf
dist
hperf
cmd/hperf/hperf
3 changes: 1 addition & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ builds:
- --tags=kqueue
ldflags:
- "-s -w -X main.version={{.Version}}"
dir: .
main: ./cmd/cli
main: ./cmd/hperf

archives:
-
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@ a long period of time.
### Download
[Download Binary Releases](https://github.com/minio/hperf/releases) for various platforms.

You can also install via source

```
go install github.com/minio/hperf/cmd/hperf@latest
```

### Server
1. Download hperf and place it in a directory of your choosing
- This can be automated with deployment tools, hperf is just a single binary

2. Run hperf help to see a list of available server commands flags and example

```bash
$ ./hperf server --help
```

3. Run the server with your preferred settings

### Client
1. Download hperf

2. Run hperf help to see available commands, flags and examples
- The `--hosts` and `--id` flags are especially important to understand

```bash
$ ./hperf --help
$ ./hperf [command] --help
Expand Down
62 changes: 0 additions & 62 deletions cmd/cli/get.go

This file was deleted.

54 changes: 25 additions & 29 deletions cmd/cli/bandwidth.go → cmd/hperf/bandwidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,53 +24,49 @@ import (
)

var bandwidthCMD = cli.Command{
Name: "bandwidth",
HelpName: "bandwidth",
Prompt: "hperf",
Usage: "A test which focuses on measuring bandwidth, It will open up a single socket(x --concurrency) and write as much data as possible for the configured --duration",
Action: runBandwidthCMD,
Name: "bandwidth",
Usage: "start a test to measure bandwidth, open --concurrency number of sockets, write data upto --duration",
Action: runBandwidth,
Flags: []cli.Flag{
dnsServerFlag,
hostsFlag,
portFlag,
testIDFlag,
insecureFlag,
concurrencyFlag,
durationFlag,
testIDFlag,
bufferSizeFlag,
payloadSizeFlag,
insecureFlag,
restartOnErrorFlag,
dnsServerFlag,
saveTestFlag,
},
CustomHelpTemplate: `
NAME: {{.HelpName}}
{{.Usage}}
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
01. Run a basic test
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
02. Run a test with custom concurrency
- Matching concurrency with your thread count can often lead to improved performance
- Sometimes it's even better to run concurrency at thread_count/2
USAGE:
{{.HelpName}} [FLAGS]
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --concurrency 24
NOTE:
Matching concurrency with your thread count can often lead to
improved performance, it is even better to run concurrency at
50% of the GOMAXPROCS.
03. Run a test with custom buffer sizes
- This can be handy when testing MTU and other parameters for optimizations
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Run a basic test:
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --bufferSize 8192 --payloadSize 8192
2. Run a test with custom concurrency:
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --concurrency 24
3. Run a test with custom buffer sizes, for MTU specific testing:
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --bufferSize 9000 --payloadSize 9000
`,
}

func runBandwidthCMD(ctx *cli.Context) error {
func runBandwidth(ctx *cli.Context) error {
config, err := parseConfig(ctx)
if err != nil {
return err
Expand Down
37 changes: 16 additions & 21 deletions cmd/cli/delete.go → cmd/hperf/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,34 @@ import (
)

var deleteCMD = cli.Command{
Name: "delete",
HelpName: "delete",
Prompt: "hperf",
Usage: "Deletes one or all tests on the selected hosts",
Action: runDeleteCMD,
Name: "delete",
Usage: "deletes one or all tests on the selected hosts",
Action: runDelete,
Flags: []cli.Flag{
dnsServerFlag,
hostsFlag,
portFlag,
testIDFlag,
},
CustomHelpTemplate: `
NAME: {{.HelpName}}
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
{{.Usage}}
USAGE:
{{.HelpName}} [FLAGS]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
01. Delete all tests on hosts .1 and .2
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2
02. Delete test by ID on hosts .1 and .2
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --id my_test_id
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Delete all tests on hosts '10.10.10.1' and '10.10.10.2':
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2
2. Delete test by ID on hosts '10.10.10.1' and '10.10.10.2':
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --id my_test_id
`,
}

func runDeleteCMD(ctx *cli.Context) error {
func runDelete(ctx *cli.Context) error {
config, err := parseConfig(ctx)
if err != nil {
return err
Expand Down
37 changes: 16 additions & 21 deletions cmd/cli/latency.go → cmd/hperf/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ import (
)

var latencyCMD = cli.Command{
Name: "latency",
HelpName: "latency",
Prompt: "hperf",
Usage: "A test to measure latency at the application level, it will send 1*Request*(--concurrency) waiting for (--delay) between requests, until the end of (--duration)",
Action: runLatencyCMD,
Name: "latency",
Usage: "start a test to measure latency at the application level",
Action: runLatency,
Flags: []cli.Flag{
hostsFlag,
portFlag,
Expand All @@ -43,28 +41,25 @@ var latencyCMD = cli.Command{
saveTestFlag,
dnsServerFlag,
},
CustomHelpTemplate: `
NAME: {{.HelpName}}
{{.Usage}}
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
USAGE:
{{.HelpName}} [FLAGS]
01. Run a basic test
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2
02. Run a slow moving test to probe latency
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --delay 100
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Run a basic test:
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2
2. Run a slow moving test to probe latency:
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1,10.10.10.2 --delay 100
`,
}

func runLatencyCMD(ctx *cli.Context) error {
func runLatency(ctx *cli.Context) error {
config, err := parseConfig(ctx)
if err != nil {
return err
Expand Down
36 changes: 16 additions & 20 deletions cmd/cli/list.go → cmd/hperf/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,31 @@ import (
)

var listTestsCMD = cli.Command{
Name: "list",
HelpName: "list",
Prompt: "hperf",
Usage: "List all tests on the selected hosts",
Action: runListCMD,
Name: "list",
Usage: "list all tests on the selected hosts",
Action: runList,
Flags: []cli.Flag{
dnsServerFlag,
hostsFlag,
portFlag,
testIDFlag,
},
CustomHelpTemplate: `
NAME: {{.HelpName}}
{{.Usage}}
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
01. List all test on the server
{{.Prompt}} {{.HelpName}} --hosts 1.1.1.1
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. List all test on the '10.10.10.1':
{{.Prompt}} {{.HelpName}} --hosts 10.10.10.1
`,
}

func runListCMD(ctx *cli.Context) error {
func runList(ctx *cli.Context) error {
config, err := parseConfig(ctx)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 36a6493

Please sign in to comment.