Skip to content

Commit 4aaad89

Browse files
authored
Add initial-credits flag to perfTest (#199)
For small message sizes, the default initial credit value of 10 is too low, resulting in decreased consumer performance. This exposes the initial credit configuration, so users can decide on what values works best for them.
1 parent 8819080 commit 4aaad89

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

perfTest/cmd/commands.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var (
4545
debugLogs bool
4646
crcCheck bool
4747
runDuration int
48+
initialCredits int
4849
)
4950

5051
func init() {
@@ -74,6 +75,7 @@ func setupCli(baseCmd *cobra.Command) {
7475
baseCmd.PersistentFlags().IntVarP(&maxAge, "max-age", "", 0, "Stream Age in hours, e.g. 1,2.. 24 , etc.")
7576
baseCmd.PersistentFlags().StringVarP(&maxSegmentSizeBytes, "stream-max-segment-size-bytes", "", "500MB", "Stream segment size bytes, e.g. 10MB, 1GB, etc.")
7677
baseCmd.PersistentFlags().StringVarP(&consumerOffset, "consumer-offset", "", "first", "Staring consuming, ex: first,last,next or random")
78+
baseCmd.PersistentFlags().IntVarP(&initialCredits, "initial-credits", "", 10, "Consumer initial credits")
7779
baseCmd.AddCommand(versionCmd)
7880
baseCmd.AddCommand(newSilent())
7981
}

perfTest/cmd/silent.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,10 @@ func startConsumer(consumerName string, streamName string) error {
390390
streamName,
391391
handleMessages,
392392
stream.NewConsumerOptions().
393-
SetConsumerName(consumerName).SetOffset(offsetSpec).SetCRCCheck(crcCheck))
393+
SetConsumerName(consumerName).
394+
SetOffset(offsetSpec).
395+
SetCRCCheck(crcCheck).
396+
SetInitialCredits(int16(initialCredits)))
394397
if err != nil {
395398
return err
396399
}

0 commit comments

Comments
 (0)