Skip to content

Commit

Permalink
start work on potential support for multiple connections
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Apr 11, 2019
1 parent 605767e commit f045d2d
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 220 deletions.
2 changes: 2 additions & 0 deletions cmd/ghz/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ var (
z = kingpin.Flag("duration", "Duration of application to send requests. When duration is reached, application stops and exits. If duration is specified, n is ignored. Examples: -z 10s -z 3m.").Short('z').Default("0").Duration()
x = kingpin.Flag("max-duration", "Maximum duration of application to send requests with n setting respected. If duration is reached before n requests are completed, application stops and exits. Examples: -x 10s -x 3m.").Short('x').Default("0").Duration()

conns = kingpin.Flag("connections", "Number of connections to use. Concurrency is distributed evenly to all the connectios. Default is 1.").Default("1").Uint()

data = kingpin.Flag("data", "The call data as stringified JSON. If the value is '@' then the request contents are read from stdin.").Short('d').PlaceHolder(" ").String()
dataPath = kingpin.Flag("data-file", "File path for call data JSON file. Examples: /home/user/file.json or ./file.json.").Short('D').PlaceHolder("PATH").PlaceHolder(" ").String()
binData = kingpin.Flag("binary", "The call data comes as serialized binary message read from stdin.").Short('b').Default("false").Bool()
Expand Down
4 changes: 3 additions & 1 deletion runner/call_template_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// call template data
type callTemplateData struct {
WorkerID string // the unique worker ID / number
RequestNumber int64 // unique incrememnted request number for each request
FullyQualifiedName string // fully-qualified name of the method call
MethodName string // shorter call method name
Expand All @@ -24,10 +25,11 @@ type callTemplateData struct {
}

// newCallTemplateData returns new call template data
func newCallTemplateData(mtd *desc.MethodDescriptor, reqNum int64) *callTemplateData {
func newCallTemplateData(mtd *desc.MethodDescriptor, workerID string, reqNum int64) *callTemplateData {
now := time.Now()

return &callTemplateData{
WorkerID: workerID,
RequestNumber: reqNum,
FullyQualifiedName: mtd.GetFullyQualifiedName(),
MethodName: mtd.GetName(),
Expand Down
3 changes: 3 additions & 0 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type RunConfig struct {
c int
qps int

// number of connections
nConns int

// timeouts
z time.Duration
timeout time.Duration
Expand Down
Loading

0 comments on commit f045d2d

Please sign in to comment.