Skip to content

Commit bcbf610

Browse files
authored
fixes #76 (#77)
1 parent 229a21d commit bcbf610

File tree

10 files changed

+88
-16
lines changed

10 files changed

+88
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ vet
2222
.vagrant/
2323
local/
2424
tls-gen/
25+
dist/
2526

2627
perfTest/perfTest

.goreleaser.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This is an example .goreleaser.yml file with some sane defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
7+
builds:
8+
- id: perf-test
9+
binary: stream-perf-test
10+
main: ./perfTest
11+
env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
goarch:
18+
- amd64
19+
- arm64
20+
goarm:
21+
- 7
22+
archives:
23+
- name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ .Arm }}"
24+
format: tar.gz
25+
format_overrides:
26+
- goos: windows
27+
format: zip
28+
checksum:
29+
name_template: 'checksums.txt'
30+
snapshot:
31+
name_template: "{{ incpatch .Version }}-next"
32+
changelog:
33+
sort: asc
34+
filters:
35+
exclude:
36+
- "README.md"
37+
- ".gitignore"
38+
- "^examples:"
39+
- Merge pull request
40+
- Merge branch

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ COPY Makefile Makefile
77
COPY perfTest perfTest
88

99
RUN mkdir /stream_perf_test
10-
RUN VERSION=$(cat VERSION) && go build -ldflags "-X main.Version=$VERSION" -o /stream_perf_test/perfTest perfTest/perftest.go
10+
RUN VERSION=$(cat VERSION) && go build -ldflags "-X main.Version=$VERSION" -o /stream_perf_test/stream-perf-test perfTest/perftest.go
1111

1212
FROM ubuntu:20.04
1313

@@ -26,4 +26,4 @@ RUN rm -rf /var/lib/apt/lists/*; \
2626
locale-gen en_US.UTF-8
2727

2828

29-
ENTRYPOINT ["perfTest"]
29+
ENTRYPOINT ["stream-perf-test"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ perf-test-help: perf-test-build
4545
go run perfTest/perftest.go help
4646

4747
perf-test-build: vet fmt check
48-
go build -ldflags=$(LDFLAGS) -o bin/perfTest perfTest/perftest.go
48+
go build -ldflags=$(LDFLAGS) -o bin/stream-perf-test perfTest/perftest.go
4949

5050
perf-test-docker-build: perf-test-build
5151
docker build -t pivotalrabbitmq/go-stream-perf-test:$(VERSION) .

README.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Experimental client for [RabbitMQ Stream Queues](https://github.com/rabbitmq/rab
4343
### Installing
4444

4545
```shell
46-
go get -u github.com/rabbitmq/rabbitmq-stream-go-client@v0.12-alpha
46+
go get -u github.com/rabbitmq/rabbitmq-stream-go-client@v0.1.0-beta
4747
```
4848

4949
imports:
@@ -327,15 +327,37 @@ func consumerClose(channelClose stream.ChannelClose) {
327327
```
328328
In this way it is possible to handle fail-over
329329
330-
### Perfomance test tool
330+
### Performance test tool
331331
332-
With the client there is also a performace tool:
332+
Performance test tool it is useful to execute tests.
333+
See also the [Java Performance](https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle/#the-performance-tool) tool
334+
335+
336+
To install you can download the version from github:
337+
338+
Mac:
339+
```
340+
https://github.com/rabbitmq/rabbitmq-stream-go-client/releases/latest/download/stream-perf-test_darwin_amd64.tar.gz
341+
```
342+
343+
Linux:
344+
```
345+
https://github.com/rabbitmq/rabbitmq-stream-go-client/releases/latest/download/stream-perf-test_linux_amd64.tar.gz
346+
```
347+
348+
Windows
349+
```
350+
https://github.com/rabbitmq/rabbitmq-stream-go-client/releases/latest/download/stream-perf-test_windows_amd64.zip
351+
```
352+
353+
execute `stream-perf-test --help` to see the parameters. By default it executes a test with one producer, one consumer.
354+
355+
here an example:
333356
```shell
334-
bin/perfTest -h
357+
stream-perf-test --publishers 3 --consumers 2 --streams my_stream --max-length-bytes 2GB --uris rabbitmq-stream://guest:guest@localhost:5552/ --fixed-body 400 --time 10
335358
```
336-
It is usefull to execute some test. See also the [Java Performance](https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle/#the-performance-tool) tool
337359
338-
### Perfomance test tool Docker
360+
### Performance test tool Docker
339361
A docker image is available: `pivotalrabbitmq/go-stream-perf-test`, to test it:
340362
341363
Run the server is host mode:
@@ -349,7 +371,7 @@ enable the plugin:
349371
```
350372
then run the docker image:
351373
```shell
352-
docker run -it --network host pivotalrabbitmq/go-stream-perf-test silent
374+
docker run -it --network host pivotalrabbitmq/go-stream-perf-test
353375
```
354376
355377
To see all the parameters:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.13-alpha
1+
0.1.0-beta

perfTest/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
dist/

perfTest/cmd/commands.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ func setupCli(baseCmd *cobra.Command) {
7474

7575
//Execute is the entrypoint of the commands
7676
func Execute() {
77+
cmd, _, err := rootCmd.Find(os.Args[1:])
78+
if err == nil && cmd.Use == rootCmd.Use {
79+
args := append([]string{"silent"}, os.Args[1:]...)
80+
rootCmd.SetArgs(args)
81+
}
82+
7783
if err := rootCmd.Execute(); err != nil {
7884
_, _ = fmt.Fprintln(os.Stderr, err)
7985
os.Exit(1)

perfTest/cmd/silent.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ var wg sync.WaitGroup
2121
func newSilent() *cobra.Command {
2222
var silentCmd = &cobra.Command{
2323
Use: "silent",
24-
Short: "NewProducer a silent simulation",
24+
Short: "Start the performance test (default command)",
25+
2526
RunE: func(cmd *cobra.Command, args []string) error {
2627
wg.Add(1)
2728
err := startSimulation()
@@ -56,7 +57,7 @@ func checkRunDuration() {
5657
case _ = <-ticker.C:
5758
v := time.Now().Sub(start).Seconds()
5859
if v >= float64(runDuration) {
59-
logInfo("Stopping after %s seconds", runDuration)
60+
logInfo("Stopping after %d seconds", runDuration)
6061
os.Exit(0)
6162
}
6263
}
@@ -79,8 +80,8 @@ func printStats() {
7980
CMessagesPerSecond := float64(atomic.LoadInt32(&consumerMessageCount)) / float64(v) * 1000
8081
ConfirmedMessagesPerSecond := float64(atomic.LoadInt32(&confirmedMessageCount)) / float64(v) * 1000
8182

82-
logInfo("Published %8.2f msg/s | Confirmed %8.2f msg/s | Consumed %8.2f msg/s | Cons. closed %3v | Pub errors %3v | %3v | %3v | msg sent: %3v |",
83-
PMessagesPerSecond, ConfirmedMessagesPerSecond, CMessagesPerSecond, consumersCloseCount, publishErrors, decodeRate(), decodeBody(), atomic.LoadInt64(&messagesSent))
83+
logInfo("Published %8.1f msg/s | Confirmed %8.1f msg/s | Consumed %8.1f msg/s | Pub errors %3v | %3v | %3v | msg sent: %3v |",
84+
PMessagesPerSecond, ConfirmedMessagesPerSecond, CMessagesPerSecond, publishErrors, decodeRate(), decodeBody(), atomic.LoadInt64(&messagesSent))
8485
}
8586
}
8687

pkg/stream/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const (
9090
defaultBatchSize = 100
9191
defaultBatchPublishingDelay = 100
9292
//
93-
ClientVersion = "0.13-alpha"
93+
ClientVersion = "0.1.0-beta"
9494

9595
StreamTcpPort = "5552"
9696
)

0 commit comments

Comments
 (0)