Skip to content

Commit

Permalink
Add support for isolation groups to matching simulator
Browse files Browse the repository at this point in the history
This fundamentally restructures how pollers and task generators are configured, but allows for granular control across isolation groups.
  • Loading branch information
natemort committed Aug 21, 2024
1 parent 69d0ce7 commit 24fbe7f
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 152 deletions.
257 changes: 159 additions & 98 deletions host/matching_simulation_test.go

Large diffs are not rendered by default.

62 changes: 37 additions & 25 deletions host/onebox.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,29 +159,6 @@ type (

// Number of task list read partitions defaults to 1
TaskListReadPartitions int

// Number of pollers defaults to 10
NumPollers int

// Number of task generators defaults to 1
NumTaskGenerators int

// The total QPS to generate tasks. Defaults to 40.
TasksPerSecond int

// The burst value for the rate limiter for task generation. Controls the maximum number of AddTask requests
// that can be sent concurrently. For example, if you have TasksPerSecond, TasksBurst, and NumTaskGenerators all
// set to 10 then every second you'll get 10 tasks added right at the start of the second. If you instead set
// TasksBurst to 1 then you'd get a steady stream of tasks, with one task every 100ms.
TasksBurst int

// Upper limit of tasks to generate. Task generators will stop if total number of tasks generated reaches MaxTaskToGenerate during simulation
// Defaults to 2k
MaxTaskToGenerate int

// Poll request timeout defaults to 1 second
PollTimeout time.Duration

// At most N polls will be forwarded at a time. defaults to 20
ForwarderMaxOutstandingPolls int

Expand All @@ -200,10 +177,45 @@ type (
// LocalTaskWaitTime. defaults to 0ms.
LocalTaskWaitTime time.Duration

// TaskProcessTime. The amount of time spent by the poller in-between requests
TaskProcessTime time.Duration
// RecordDecisionTaskStartedTime. The amount of time spent by History to complete RecordDecisionTaskStarted
RecordDecisionTaskStartedTime time.Duration

// The pollers that will be created to process
Pollers []SimulationPollerConfiguration

Tasks []SimulationTaskConfiguration
}

SimulationPollerConfiguration struct {
// The isolation group that pollers will be created with. Optional.
IsolationGroup string
// The number of pollers that will be created with this configuration. Defaults to 1
NumPollers int
// TaskProcessTime. The amount of time spent by the poller in-between requests. Defaults to 1ms
TaskProcessTime time.Duration
// Poll request timeout defaults to 15 seconds
PollTimeout time.Duration
}

SimulationTaskConfiguration struct {
// The isolation groups that tasks will be evenly distributed between
IsolationGroups []string

// Number of task generators defaults to 1
NumTaskGenerators int

// The total QPS to generate tasks. Defaults to 40.
TasksPerSecond int

// The burst value for the rate limiter for task generation. Controls the maximum number of AddTask requests
// that can be sent concurrently. For example, if you have TasksPerSecond, TasksBurst, and NumTaskGenerators all
// set to 10 then every second you'll get 10 tasks added right at the start of the second. If you instead set
// TasksBurst to 1 then you'd get a steady stream of tasks, with one task every 100ms.
TasksBurst int

// Upper limit of tasks to generate. Task generators will stop if total number of tasks generated reaches MaxTaskToGenerate during simulation
// Defaults to 2k
MaxTaskToGenerate int
}

// CadenceParams contains everything needed to bootstrap Cadence
Expand Down
14 changes: 8 additions & 6 deletions host/testdata/matching_simulation_burst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ matchingconfig:
simulationconfig:
tasklistwritepartitions: 4
tasklistreadpartitions: 4
numpollers: 8
numtaskgenerators: 10
taskspersecond: 500
maxtasktogenerate: 10000
polltimeout: 60s
forwardermaxoutstandingpolls: 1
forwardermaxoutstandingtasks: 1
forwardermaxratepersecond: 10
forwardermaxchildrenpernode: 20
localpollwaittime: 0ms
localtaskwaittime: 0ms
taskprocesstime: 1ms
tasks:
- numtaskgenerators: 10
taskspersecond: 500
maxtasktogenerate: 10000
pollers:
- taskprocesstime: 1ms
numpollers: 8
polltimeout: 60s
workerconfig:
enableasyncwfconsumer: false
14 changes: 8 additions & 6 deletions host/testdata/matching_simulation_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ matchingconfig:
simulationconfig:
tasklistwritepartitions: 4
tasklistreadpartitions: 4
numpollers: 8
numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
polltimeout: 60s
forwardermaxoutstandingpolls: 1
forwardermaxoutstandingtasks: 1
forwardermaxratepersecond: 10
forwardermaxchildrenpernode: 20
localpollwaittime: 0ms
localtaskwaittime: 0ms
taskprocesstime: 1ms
tasks:
- numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
pollers:
- taskprocesstime: 1ms
numpollers: 8
polltimeout: 60s
workerconfig:
enableasyncwfconsumer: false
13 changes: 8 additions & 5 deletions host/testdata/matching_simulation_more_read_partitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ matchingconfig:
simulationconfig:
tasklistwritepartitions: 4
tasklistreadpartitions: 8
numpollers: 8
numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
polltimeout: 60s
forwardermaxoutstandingpolls: 1
forwardermaxoutstandingtasks: 1
forwardermaxratepersecond: 10
forwardermaxchildrenpernode: 20
localpollwaittime: 0ms
localtaskwaittime: 0ms
tasks:
- numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
pollers:
- taskprocesstime: 1ms
numpollers: 8
polltimeout: 60s
workerconfig:
enableasyncwfconsumer: false
14 changes: 8 additions & 6 deletions host/testdata/matching_simulation_no_forwarding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ matchingconfig:
simulationconfig:
tasklistwritepartitions: 4
tasklistreadpartitions: 4
numpollers: 8
numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
polltimeout: 60s
forwardermaxoutstandingpolls: 0
forwardermaxoutstandingtasks: 0
forwardermaxratepersecond: 10
forwardermaxchildrenpernode: 20
localpollwaittime: 0ms
localtaskwaittime: 0ms
taskprocesstime: 1ms
tasks:
- numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
pollers:
- taskprocesstime: 1ms
numpollers: 8
polltimeout: 60s
workerconfig:
enableasyncwfconsumer: false
14 changes: 8 additions & 6 deletions host/testdata/matching_simulation_throughput.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ matchingconfig:
simulationconfig:
tasklistwritepartitions: 1
tasklistreadpartitions: 1
numpollers: 8
numtaskgenerators: 10
taskspersecond: 80
maxtasktogenerate: 3000
polltimeout: 60s
forwardermaxoutstandingpolls: 1
forwardermaxoutstandingtasks: 1
forwardermaxratepersecond: 10
forwardermaxchildrenpernode: 20
localpollwaittime: 0ms
localtaskwaittime: 0ms
taskprocesstime: 1ms
tasks:
- numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
pollers:
- taskprocesstime: 1ms
numpollers: 8
polltimeout: 60s
workerconfig:
enableasyncwfconsumer: false
34 changes: 34 additions & 0 deletions host/testdata/matching_simulation_zonal_isolation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
enablearchival: false
clusterno: 1
messagingclientconfig:
usemock: true
historyconfig:
numhistoryshards: 4
numhistoryhosts: 1
matchingconfig:
nummatchinghosts: 4
simulationconfig:
tasklistwritepartitions: 2
tasklistreadpartitions: 2
forwardermaxoutstandingpolls: 1
forwardermaxoutstandingtasks: 1
forwardermaxratepersecond: 10
forwardermaxchildrenpernode: 20
localpollwaittime: 0ms
localtaskwaittime: 0ms
tasks:
- numtaskgenerators: 2
taskspersecond: 80
maxtasktogenerate: 3000
isolationgroups: ['a', 'b']
pollers:
- isolationgroup: 'a'
taskprocesstime: 1ms
numpollers: 4
polltimeout: 60s
- isolationgroup: 'b'
taskprocesstime: 1ms
numpollers: 4
polltimeout: 60s
workerconfig:
enableasyncwfconsumer: false

0 comments on commit 24fbe7f

Please sign in to comment.