Skip to content

Commit eca259f

Browse files
committed
[add] added Readme with overall usage information
1 parent ef2dcbf commit eca259f

File tree

3 files changed

+66
-5
lines changed

3 files changed

+66
-5
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,8 @@ Thumbs.db
8686

8787
# Json Results #
8888
################
89-
*.json
89+
*.json
90+
91+
# Coverage Results #
92+
####################
93+
coverage.txt

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
## Overview
3+
4+
When benchmarking a Pub/Sub Systems, we specifically require two distinct roles ( publishers and subscribers ) as benchmark participants - this repo contains code to mimic the subscriber workload on Redis Pub/Sub.
5+
6+
Several aspects can dictate the overall system performance, like the:
7+
- Payload size (controlled on publisher)
8+
- Number of Pub/Sub channels (controlled on publisher)
9+
- Total message traffic per channel (controlled on publisher)
10+
- Number of subscribers per channel (controlled on subscriber)
11+
- Subscriber distribution per shard and channel (controlled on subscriber)
12+
13+
## Installation
14+
15+
The easiest way to get and install the Subscriber Go program is to use
16+
`go get` and then `go install`:
17+
```bash
18+
# Fetch this repo
19+
go get github.com/filipecosta90/pubsub-sub-bench
20+
cd $GOPATH/src/github.com/filipecosta90/pubsub-sub-bench
21+
go get ./...
22+
go build .
23+
```
24+
25+
## Usage of pubsub-sub-bench
26+
27+
```
28+
Usage of pubsub-sub-bench:
29+
-channel-maximum int
30+
channel ID maximum value ( each channel has a dedicated thread ). (default 100)
31+
-channel-minimum int
32+
channel ID minimum value ( each channel has a dedicated thread ). (default 1)
33+
-client-output-buffer-limit-pubsub string
34+
Specify client output buffer limits for clients subscribed to at least one pubsub channel or pattern. If the value specified is different that the one present on the DB, this setting will apply.
35+
-client-update-tick int
36+
client update tick. (default 1)
37+
-host string
38+
redis host. (default "127.0.0.1")
39+
-json-out-file string
40+
Name of json output file, if not set, will not print to json.
41+
-messages int
42+
Number of total messages per subscriber per channel.
43+
-oss-cluster-api-distribute-subscribers
44+
read cluster slots and distribute subscribers among them.
45+
-port string
46+
redis port. (default "6379")
47+
-print-messages
48+
print messages.
49+
-subscriber-prefix string
50+
prefix for subscribing to channel, used in conjunction with key-minimum and key-maximum. (default "channel-")
51+
-subscribers-per-channel int
52+
number of subscribers per channel. (default 1)
53+
-subscribers-placement-per-channel string
54+
(dense,sparse) dense - Place all subscribers to channel in a specific shard. sparse- spread the subscribers across as many shards possible, in a round-robin manner. (default "dense")
55+
-test-time int
56+
Number of seconds to run the test, after receiving the first message.
57+
```

subscriber.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ func subscriberRoutine(addr string, subscriberName string, channel string, print
5757
func bootstrapPubSub(addr string, subscriberName string, channel string) (radix.Conn, error, radix.PubSubConn, chan radix.PubSubMessage, *time.Ticker) {
5858
// Create a normal redis connection
5959
conn, err := radix.Dial("tcp", addr)
60-
61-
err = conn.Do(radix.FlatCmd(nil, "CLIENT", "SETNAME", subscriberName))
6260
if err != nil {
6361
log.Fatal(err)
6462
}
6563

64+
err = conn.Do(radix.FlatCmd(nil, "CLIENT", "SETNAME", subscriberName))
6665
if err != nil {
67-
panic(err)
66+
log.Fatal(err)
6867
}
68+
6969
// Pass that connection into PubSub, conn should never get used after this
7070
ps := radix.PubSub(conn)
7171

7272
msgCh := make(chan radix.PubSubMessage)
7373
err = ps.Subscribe(msgCh, channel)
7474
if err != nil {
75-
panic(err)
75+
log.Fatal(err)
7676
}
7777

7878
return conn, err, ps, msgCh, nil

0 commit comments

Comments
 (0)