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

sql: use go runtime task groups to measure CPU/RAM usage per session #60588

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

knz
Copy link
Contributor

@knz knz commented Feb 15, 2021

This uses the experimental task group API (see related RFC)
to measure CPU/RAM usage separately per SQL session.

The experimental task group API is available in this custom
branch of the Go runtime:
cockroachdb/go@crdb-fixes (commits)

The interface for the API in the new library go-plus
(github.com/cockroachdb/go-plus) ensures that the code runs without
error even when the custom go runtime is not being used.

Note that this implementation does not yet collect CPU/RAM usage on other
nodes when a session runs distributed queries.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz knz force-pushed the 20210215-task-groups branch 2 times, most recently from 02e1372 to c03b3bc Compare February 22, 2021 16:31
@knz knz force-pushed the 20210215-task-groups branch 2 times, most recently from b66431e to de09b24 Compare May 17, 2021 15:40
@knz knz force-pushed the 20210215-task-groups branch from de09b24 to e2d950a Compare June 21, 2021 13:47
@knz knz force-pushed the 20210215-task-groups branch from e2d950a to 974ab3a Compare June 28, 2021 14:35
@knz knz changed the title sql: use go runtime task groups to measure CPU usage per session sql: use go runtime task groups to measure CPU/RAM usage per session Jun 28, 2021
@knz knz force-pushed the 20210215-task-groups branch 2 times, most recently from 1916670 to 53a399a Compare June 30, 2021 12:07
@knz
Copy link
Contributor Author

knz commented Jun 30, 2021

cc @cockroachdb/sql-observability @cockroachdb/obs-inf-prs can one of you folk help? I'm modifying the session proto to add some field and getting some build errors:

src/sessions/sessionsPage.fixture.ts(47,5): error TS2322: Type '{ node_id: number; username: string; client_address: string; application_name: string; start: { seconds: Long.Long; nanos: number; }; last_active_query: string; id: Uint8Array; ... 7 more ...; toJSON: () => {}; }' is not a
ssignable to type 'Session'.
  Object literal may only specify known properties, and 'cpu_time' does not exist in type 'Session'.
src/sessions/sessionsPage.fixture.ts(55,3): error TS2739: Type '{ node_id: number; username: string; client_address: string; application_name: string; alloc_bytes: Long; max_alloc_bytes: Long; start: { seconds: Long; nanos: number; }; last_active_query: string; ... 4 more ...; toJSON:
() => {}; }' is missing the following properties from type 'Session': sched_ticks, nanos, large_bytes
src/sessions/sessionsPage.fixture.ts(119,5): error TS2322: Type '{ node_id: number; username: string; client_address: string; application_name: string; active_queries: { id: string; sql: string; start: { seconds: Long.Long; nanos: number; }; phase: cockroach.server.serverpb.ActiveQuery
.Phase.EXECUTING; txn_id: Uint8Array; sql_anon: string; }[]; ... 10 more ...; toJSON: () => {}; }' is not assignable to type 'Session'.
  Object literal may only specify known properties, and 'cpu_time' does not exist in type 'Session'.
error Command failed with exit code 2.

This somewhere in cluster-ui. What am I missing? Why does this not automatically update when I modify the .proto file?

@knz
Copy link
Contributor Author

knz commented Jun 30, 2021

oh nevermind, I should learn how to read the error message. I was able to fix it. Thanks

This uses the experimental task group API (see related RFC)
to measure CPU/RAM usage separately per SQL session.

The experimental task group API is available in this custom
branch of the Go runtime:
https://github.com/cockroachdb/go/commits/crdb-fixes

The interface for the API in the new library go-plus
(github.com/cockroachdb/go-plus) ensures that the code runs without
error even when the custom go runtime is not being used.

Note that this implementation does not yet collect CPU/RAM usage on other
nodes when a session runs distributed queries.

Release note: None
@knz knz force-pushed the 20210215-task-groups branch from 53a399a to a50bb8a Compare June 30, 2021 12:11
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.

2 participants