Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for isolation groups to matching simulator #6243

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nonblocking:

since onebox is used for both docker/local development and simulation, what do you think about pulling this simulation-specific stuff into a simulation.go file so that it's a bit easier to see at a glance if there's any significant changes to the more general onebox config or it's just simulation config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, when I do further refactoring I'll move it out.

// 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
Loading