Skip to content

multitenant: add pgwire bytes component to tenant cost#70877

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
RaduBerinde:pgwire-bytes
Sep 30, 2021
Merged

multitenant: add pgwire bytes component to tenant cost#70877
craig[bot] merged 1 commit intocockroachdb:masterfrom
RaduBerinde:pgwire-bytes

Conversation

@RaduBerinde
Copy link
Copy Markdown
Member

@RaduBerinde RaduBerinde commented Sep 29, 2021

This commit adds accounting for the total number of bytes transferred
through pgwire.

We currently just passively record the usage, similar to CPU. In the
future, we will consider throttling the sending of data to the client.

The tenant cost model setting is a preliminary guess, we are in the
process of revisiting all the values.

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.

Informs #68479.

@RaduBerinde RaduBerinde requested a review from a team as a code owner September 29, 2021 19:35
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

needs some rewrites for the virtual table logic tests.

Reviewed 7 of 23 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andy-kimball and @RaduBerinde)


pkg/multitenant/cost_controller.go, line 43 at r1 (raw file):

//  - pgwireBytes: total bytes transferred between the client and the SQL
//    instance (both ingress and egress).
type ExternalUsageFn func(ctx context.Context) (cpuSecs float64, pgwireBytes uint64)

Thoughts on adding a struct rather than an ever-expanding set of return params?

This commit adds accounting for the total number of bytes transferred
through pgwire.

We currently just passively record the usage, similar to CPU. In the
future, we will consider throttling the sending of data to the client.

The tenant cost model setting is a preliminary guess, we are in the
process of revisiting all the values.

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.
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!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ajwerner and @andy-kimball)


pkg/multitenant/cost_controller.go, line 43 at r1 (raw file):

Previously, ajwerner wrote…

Thoughts on adding a struct rather than an ever-expanding set of return params?

Done.

@RaduBerinde
Copy link
Copy Markdown
Member Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Sep 30, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Sep 30, 2021

Build succeeded:

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