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

asim: load cluster configuration to be simulated #79961

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

lidorcarmel
Copy link
Contributor

Adding a few cluster configurations and a way to load those configs to be
simulated.

Note that this is somewhat different from what I had in mind initially: with
this implementation there is no way to change the configuration mid-run (we
will add that later).

Release note: None

@lidorcarmel lidorcarmel requested a review from kvoli April 14, 2022 18:08
@lidorcarmel lidorcarmel requested a review from a team as a code owner April 14, 2022 18:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@lidorcarmel lidorcarmel requested a review from shralex April 14, 2022 18:08
Copy link
Collaborator

@kvoli kvoli left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @lidorcarmel and @shralex)


pkg/kv/kvserver/asim/asim.go, line 208 at r1 (raw file):

		generators: wgs,
		conf:       conf,
		prevState:  NewState(),

Should prevState be set to initialState on this call?

In the first tick, applyWorkload and applyAllocatorAction will both need to consult the previous state in order to apply changes to the nextState?kjkj

Code quote:

		prevState:  NewState(),
		nextState:  NewState(),

pkg/kv/kvserver/asim/config_loader.go, line 90 at r1 (raw file):

}

// Zone is a simulated availability zone.

We will need to convert these to roachpb.Locality somewhere along the line. I don't see an issue with trying to keep an independent data model so we can be more flexible but I'm curious what you think and why you picked this method.

Code quote:

// Zone is a simulated availability zone.
type Zone struct {
	Name      string
	NodeCount int
}

pkg/kv/kvserver/asim/config_loader.go, line 105 at r1 (raw file):

// TODO(lidor): add cross region network latencies.
type ClusterInfo struct {
	DiskCapacityGB int

Is this per node and we take them all as homogenous? Seems fine just want to check, perhaps we could define a node resources type for configuration in the future, similar to the locality here.


pkg/kv/kvserver/asim/config_loader.go, line 114 at r1 (raw file):

	s := NewState()
	s.Cluster = &c
	// TODO(lidor): load locality info to be used by the allocator. Do we need a

I think we need to include the locality information here, I believe the locality can go on the store descriptor specifically.


pkg/kv/kvserver/asim/config_loader_test.go, line 30 at r1 (raw file):

		},
		{
			clusterInfo:       asim.MultiRegionConfig,

We should add in the node locality above and assert on the correct locality information in addition to counts.

Code quote:

			clusterInfo:       asim.SingleRegionConfig,
			expectedNodeCount: 15,
		},
		{
			clusterInfo:       asim.MultiRegionConfig,
			expectedNodeCount: 36,
		},
		{
			clusterInfo:       asim.ComplexConfig,
			expectedNodeCount: 28,

@lidorcarmel lidorcarmel force-pushed the lidor_asim_config branch 2 times, most recently from 03ff9c9 to 3dded88 Compare April 14, 2022 19:59
Copy link
Contributor Author

@lidorcarmel lidorcarmel left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @kvoli and @shralex)


pkg/kv/kvserver/asim/asim.go, line 208 at r1 (raw file):

Previously, kvoli (Austen) wrote…

Should prevState be set to initialState on this call?

In the first tick, applyWorkload and applyAllocatorAction will both need to consult the previous state in order to apply changes to the nextState?kjkj

the way things are now, ApplyLoad and ApplyAllocatorAction only care about nextState.
but the naming is not great, fixed a but, PTAL, thanks!


pkg/kv/kvserver/asim/config_loader.go, line 90 at r1 (raw file):

Previously, kvoli (Austen) wrote…

We will need to convert these to roachpb.Locality somewhere along the line. I don't see an issue with trying to keep an independent data model so we can be more flexible but I'm curious what you think and why you picked this method.

yes we will - I thought it would be easier to specify a config this way. also, we will need other things like network delay between regions to fit in this structure.


pkg/kv/kvserver/asim/config_loader.go, line 105 at r1 (raw file):

Previously, kvoli (Austen) wrote…

Is this per node and we take them all as homogenous? Seems fine just want to check, perhaps we could define a node resources type for configuration in the future, similar to the locality here.

exactly, we should be ok with homogenous disks.


pkg/kv/kvserver/asim/config_loader.go, line 114 at r1 (raw file):

Previously, kvoli (Austen) wrote…

I think we need to include the locality information here, I believe the locality can go on the store descriptor specifically.

right, in another pr?


pkg/kv/kvserver/asim/config_loader_test.go, line 30 at r1 (raw file):

Previously, kvoli (Austen) wrote…

We should add in the node locality above and assert on the correct locality information in addition to counts.

right, but now the locality info goes nowhere. we will do that once we actually propagate locality to where it should be. does it make sense? I agree that the current test is useless.. it will be improved.

Copy link
Collaborator

@kvoli kvoli left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @kvoli, @lidorcarmel, and @shralex)


pkg/kv/kvserver/asim/asim.go, line 208 at r1 (raw file):

Previously, lidorcarmel (Lidor Carmel) wrote…

the way things are now, ApplyLoad and ApplyAllocatorAction only care about nextState.
but the naming is not great, fixed a but, PTAL, thanks!

Okay, got it - seems good.


pkg/kv/kvserver/asim/config_loader.go, line 90 at r1 (raw file):

Previously, lidorcarmel (Lidor Carmel) wrote…

yes we will - I thought it would be easier to specify a config this way. also, we will need other things like network delay between regions to fit in this structure.

Cool, lets go with that then.


pkg/kv/kvserver/asim/config_loader.go, line 114 at r1 (raw file):

Previously, lidorcarmel (Lidor Carmel) wrote…

right, in another pr?

Yeah that makes sense, we definitely will want it in the near future as it seems like one of the harder parts of the allocator's logic to reason about from my exp.

Copy link
Contributor Author

@lidorcarmel lidorcarmel left a comment

Choose a reason for hiding this comment

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

TFTR Austen!

bors r+

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @kvoli, @lidorcarmel, and @shralex)

@craig
Copy link
Contributor

craig bot commented Apr 15, 2022

Build failed:

@lidorcarmel
Copy link
Contributor Author

unrelated failure, retrying.

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 15, 2022

Build failed:

@kvoli
Copy link
Collaborator

kvoli commented Apr 15, 2022

Looks like this was fixed on master. Try rebase off a newer sha.

Adding a few cluster configurations and a way to load those configs to be
simulated.

Note that this is somewhat different from what I had in mind initially: with
this implementation there is no way to change the configuration mid-run (we
will add that later).

Release note: None
@lidorcarmel
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 17, 2022

Build failed:

@lidorcarmel
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 18, 2022

Build succeeded:

@craig craig bot merged commit 6c91da4 into cockroachdb:master Apr 18, 2022
@kvoli kvoli mentioned this pull request Jun 8, 2022
16 tasks
@kvoli kvoli added the A-kv-simulation Relating to allocation simulation. label Jun 9, 2022
@lidorcarmel lidorcarmel deleted the lidor_asim_config branch July 21, 2022 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-kv-simulation Relating to allocation simulation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants