Proposed change
We publish zeroes here:
|
buffer := make([]byte, msgSize) |
This may skew the results because of compression usage, etc.
Should probably use https://pkg.go.dev/crypto/rand#Read
Also related, when --payload is used:
|
buffer, err := os.ReadFile(c.payloadFilename) |
|
if err != nil { |
|
return nil, fmt.Errorf("reading the payload file: %w", err) |
|
} |
It problably makes sense to read the file only once, not once per client, to make this work:
nats bench pub hello --clients=30 --msgs=30 --payload <(head --bytes=1M /dev/urandom)
Otherwise, the named pipe that bash creates is "split" across N goroutines reading it concurrently. So total published size will be 1M, not 30M in this case.
Use case
Benchmarks that are closer resemble real workloads.
Contribution
No response
Proposed change
We publish zeroes here:
natscli/cli/bench_command.go
Line 1757 in f479ef0
This may skew the results because of compression usage, etc.
Should probably use https://pkg.go.dev/crypto/rand#Read
Also related, when
--payloadis used:natscli/cli/bench_command.go
Lines 1749 to 1752 in f479ef0
It problably makes sense to read the file only once, not once per client, to make this work:
Otherwise, the named pipe that bash creates is "split" across N goroutines reading it concurrently. So total published size will be 1M, not 30M in this case.
Use case
Benchmarks that are closer resemble real workloads.
Contribution
No response