Skip to content

Commit

Permalink
initial design/api for #717
Browse files Browse the repository at this point in the history
  • Loading branch information
ldemailly committed Feb 25, 2023
1 parent c044bbd commit 60a8d72
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cli/fortio_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ var (
qpsFlag = flag.Float64("qps", defaults.QPS, "Queries Per Seconds or 0 for no wait/max qps")
numThreadsFlag = flag.Int("c", defaults.NumThreads, "Number of connections/goroutine/threads")
durationFlag = flag.Duration("t", defaults.Duration, "How long to run the test or 0 to run until ^C")
rampFlag = flag.Duration("ramp", 0, "Ramp/Warm up time from initial to target QPS")
percentilesFlag = flag.String("p", "50,75,90,99,99.9", "List of pXX to calculate")
resolutionFlag = flag.Float64("r", defaults.Resolution, "Resolution of the histogram lowest buckets in seconds")
offsetFlag = flag.Duration("offset", defaults.Offset, "Offset of the histogram data")
Expand Down Expand Up @@ -398,6 +399,7 @@ func fortioLoad(justCurl bool, percList []float64, hook bincommon.FortioHook) {
ro := periodic.RunnerOptions{
QPS: qps,
Duration: *durationFlag,
Ramp: *rampFlag,
NumThreads: *numThreadsFlag,
Percentiles: percList,
Resolution: *resolutionFlag,
Expand Down
13 changes: 12 additions & 1 deletion periodic/periodic.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ var DefaultRunnerOptions = RunnerOptions{
NumThreads: 4,
Percentiles: []float64{90.0},
Resolution: 0.001, // milliseconds
// Not used unless Ramp is non zero, but if it is:
InitialNumThreads: 1,
}

type ThreadID int
Expand Down Expand Up @@ -170,12 +172,21 @@ type RunnerOptions struct {
Runners []Runnable `json:"-"`
// At which (target) rate to run the Runners across NumThreads.
QPS float64
// Initial QPS. Used if Ramp duration is specified, will increase the target from InitialQPS to QPS over Ramp duration.
InitialQPS float64
// Ramp duration. If specified, will increase the target from InitialQPS to QPS over Ramp duration.
// default is no ramp up.
Ramp time.Duration
// How long to run the test for. Unless Exactly is specified.
Duration time.Duration
// Note that this actually maps to gorountines and not actual threads
// but threads seems like a more familiar name to use for non go users
// and in a benchmarking context
// and in a benchmarking context.
NumThreads int
// InitialNumThreads is the number of threads to start with when using Ramp.
// If Ramp is specified, will increase the number of threads from InitialNumThreads
// to NumThreads over Ramp duration.
InitialNumThreads int
// List of percentiles to calculate.
Percentiles []float64
// Divider to apply to duration data in seconds. Defaults to 0.001 or 1 millisecond.
Expand Down

0 comments on commit 60a8d72

Please sign in to comment.