cockroachdb / cockroachdb/cockroach
db-console: Insights page makes separate requests for every contention event
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
When the db-console page gets high contention insights, it makes a separate request to `addStmtContentionInfoApi` for each event. This API is extremely expensive because it's querying `crdb_internal.transaction_contention_events` which results in a cluster-wide fan out.
At the very least, db-console should make a sql request for multiple `waiting_stmt_id` at once, instead of one at a time.
https://github.com/cockroachdb/cockroach/blob/d5f328ea6f3efd8fbe631c97d59f7b74307d22f9/pkg/ui/workspaces/cluster-ui/src/api/stmtInsightsApi.ts#L172
Jira issue: CRDB-44019
Contributor guide
Research direction
Start with pkg/ui/workspaces/cluster-ui/src/api/stmtInsightsApi.ts around the addStmtContentionInfoApi call and trace how high-contention insights are loaded. Check the related request and SQL handling to determine where multiple waiting_stmt_id values can be accepted. Done means the Insights page uses one request for multiple contention events instead of one expensive cluster-wide query per event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- databases, frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100