Skip to content

multitenant: only charge for pgwire egress and update cost model settings#71094

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
RaduBerinde:egress-only
Oct 6, 2021
Merged

multitenant: only charge for pgwire egress and update cost model settings#71094
craig[bot] merged 3 commits intocockroachdb:masterfrom
RaduBerinde:egress-only

Conversation

@RaduBerinde
Copy link
Copy Markdown
Member

@RaduBerinde RaduBerinde commented Oct 4, 2021

tenantrate: revive KV Compute Units

Sharing the same cost model for tenant costing and for KV-side tenant
limiting was a mistake - the latter is meant to estimate CPU usage as
much as possible whereas we want to take arbitrary freedoms with
tenant costing.

This commit revives the kv.tenant_rate_limiter.* settings for the
cost model and reverts to using the concept of "KV Compute Units"
inside the rate limiter.

Release note: None

Release justification: Necessary fix for the distributed rate limiting
functionality, which is vital for the upcoming Serverless MVP release.
It allows CRDB to throttle clusters that have run out of free or paid
request units (which measure CPU and I/O usage). This functionality is
only enabled in multi-tenant scenarios and should have no impact on
our dedicated customers.

multitenant: only charge for pgwire egress

This commit changes the tenant cost accounting for pgwire bytes to
only take into account egress; cloud providers don't charge for
ingress. In the future, we can plumb the ingress bytes separately if
needed - as of now we don't plan to charge for ingress.

Release note: None

Release justification: Necessary fix for the distributed rate limiting
functionality, which is vital for the upcoming Serverless MVP release.
It allows CRDB to throttle clusters that have run out of free or paid
request units (which measure CPU and I/O usage). This functionality is
only enabled in multi-tenant scenarios and should have no impact on
our dedicated customers.

tenantcostmodel: update settings

This commit updates settings for the tenant cost model. These values
are derived from the Tenant Pricing Model spreadsheet.

Release note: None

Release justification: Necessary fix for the distributed rate limiting
functionality, which is vital for the upcoming Serverless MVP release.
It allows CRDB to throttle clusters that have run out of free or paid
request units (which measure CPU and I/O usage). This functionality is
only enabled in multi-tenant scenarios and should have no impact on
our dedicated customers.

@RaduBerinde RaduBerinde requested a review from a team as a code owner October 4, 2021 19:48
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@RaduBerinde
Copy link
Copy Markdown
Member Author


pkg/kv/kvserver/tenantrate/settings.go, line 55 at r2 (raw file):

		"per-tenant rate limit in Request Units per second if positive, "+
			"or Request Units per second per CPU if negative",
		-500,

Not very sure how to go about setting this. Definitely seems like we should increase it, now that writes are 5x more expensive and reads are 2x.

@RaduBerinde RaduBerinde changed the title tenantcostmodel: update settings multitenant: only chagre for pgwire egress and update cost model settings Oct 5, 2021
@RaduBerinde RaduBerinde changed the title multitenant: only chagre for pgwire egress and update cost model settings multitenant: only charge for pgwire egress and update cost model settings Oct 5, 2021
@RaduBerinde
Copy link
Copy Markdown
Member Author

Updated - I added a commit that revives the separate tenantrate limiter settings; cost model changes no longer affect that subsystem.

Copy link
Copy Markdown
Contributor

@andy-kimball andy-kimball left a comment

Choose a reason for hiding this comment

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

:lgtm:

Do you foresee any problems if we upgrade from the previous code to this code in our Staging/Production environments?

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner and @RaduBerinde)


pkg/kv/kvserver/tenantrate/settings.go, line 52 at r5 (raw file):

// seconds), so it doesn't need to be adjusted in concert with the rate.
var (
	// kvcuRateLimit was initially set to an absolute value in KV Compute Units/s,

NIT: Somewhere in here, can you add a comment explaining the difference between the constants used in distributed rate limiting vs. the constants used in KV tenant throttling?

Copy link
Copy Markdown
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

TFTR! There should be no problem upgrading.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)


pkg/kv/kvserver/tenantrate/settings.go, line 52 at r5 (raw file):

Previously, andy-kimball (Andy Kimball) wrote…

NIT: Somewhere in here, can you add a comment explaining the difference between the constants used in distributed rate limiting vs. the constants used in KV tenant throttling?

Done, PTAL

Sharing the same cost model for tenant costing and for KV-side tenant
limiting was a mistake - the latter is meant to estimate CPU usage as
much as possible whereas we want to take arbitrary freedoms with
tenant costing.

This commit revives the `kv.tenant_rate_limiter.*` settings for the
cost model and reverts to using the concept of "KV Compute Units"
inside the rate limiter.

Release note: None

Release justification: Necessary fix for the distributed rate limiting
functionality, which is vital for the upcoming Serverless MVP release.
It allows CRDB to throttle clusters that have run out of free or paid
request units (which measure CPU and I/O usage). This functionality is
only enabled in multi-tenant scenarios and should have no impact on
our dedicated customers.
This commit changes the tenant cost accounting for pgwire bytes to
only take into account egress; cloud providers don't charge for
ingress. In the future, we can plumb the ingress bytes separately if
needed - as of now we don't plan to charge for ingress.

Release note: None

Release justification: Necessary fix for the distributed rate limiting
functionality, which is vital for the upcoming Serverless MVP release.
It allows CRDB to throttle clusters that have run out of free or paid
request units (which measure CPU and I/O usage). This functionality is
only enabled in multi-tenant scenarios and should have no impact on
our dedicated customers.
This commit updates settings for the tenant cost model. These values
are derived from the Tenant Pricing Model spreadsheet.

Release note: None

Release justification: Necessary fix for the distributed rate limiting
functionality, which is vital for the upcoming Serverless MVP release.
It allows CRDB to throttle clusters that have run out of free or paid
request units (which measure CPU and I/O usage). This functionality is
only enabled in multi-tenant scenarios and should have no impact on
our dedicated customers.
@RaduBerinde
Copy link
Copy Markdown
Member Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Oct 6, 2021

Build succeeded:

@craig craig bot merged commit 41ee2e9 into cockroachdb:master Oct 6, 2021
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Oct 6, 2021

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 56b8c5d to blathers/backport-release-21.2-71094: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants