Skip to content

sql/colexecerror: CatchVectorizedRuntimeError uses an expensive debug.Stack call #123235

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

Closed
rafiss opened this issue Apr 29, 2024 · 0 comments · Fixed by #123277
Closed

sql/colexecerror: CatchVectorizedRuntimeError uses an expensive debug.Stack call #123235

rafiss opened this issue Apr 29, 2024 · 0 comments · Fixed by #123277
Assignees
Labels
branch-release-24.1 Used to mark GA and release blockers, technical advisories, and bugs for 24.1 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. GA-blocker O-support Would prevent or help troubleshoot a customer escalation - bugs, missing observability/tooling, docs T-sql-queries SQL Queries Team

Comments

@rafiss
Copy link
Collaborator

rafiss commented Apr 29, 2024

Describe the problem

The usage of debug.Stack here is problematic:

stackTrace := string(debug.Stack())

During a recent customer outage, we captured this profile:
image

(Full profile available here.)

In the outage, the CRDB behavior was that once CPU usage became high enough, response times started to go up, and execution throughput went down. Notably, the throughput/latency impact is correlated with a large increase in concurrent open transactions. See the support ticket for more details.

The main part of the issue here appears to be that the usage of debug.Stack causes lock contention due to the system calls that rely on futex.

To Reproduce

This can be seen with the admission-control/tpcc-severe-overload test. See these notes.

Expected behavior

Make the CatchVectorizedRuntimeError less expensive.

There are two main ideas:

In addition to these two changes, there might be ways to improve the function even more. We can use this issue to track those ideas as well.

@michae2 has some early benchmark results from making some of these changes.

Jira issue: CRDB-38252

@rafiss rafiss added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-support Would prevent or help troubleshoot a customer escalation - bugs, missing observability/tooling, docs T-sql-queries SQL Queries Team labels Apr 29, 2024
@github-project-automation github-project-automation bot moved this to Triage in SQL Queries Apr 29, 2024
@michae2 michae2 self-assigned this Apr 29, 2024
@michae2 michae2 moved this from Triage to Active in SQL Queries Apr 29, 2024
michae2 added a commit to michae2/cockroach that referenced this issue Apr 30, 2024
michae2 added a commit to michae2/cockroach that referenced this issue Apr 30, 2024
michae2 added a commit to michae2/cockroach that referenced this issue Apr 30, 2024
michae2 added a commit to michae2/cockroach that referenced this issue Apr 30, 2024
Fixes: cockroachdb#123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
michae2 added a commit to michae2/cockroach that referenced this issue May 1, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 1, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 1, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 1, 2024
Fixes: cockroachdb#123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
Fixes: cockroachdb#123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
blathers-crl bot pushed a commit that referenced this issue May 2, 2024
blathers-crl bot pushed a commit that referenced this issue May 2, 2024
Fixes: #123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 2, 2024
Fixes: cockroachdb#123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
@michae2 michae2 added GA-blocker branch-release-24.1 Used to mark GA and release blockers, technical advisories, and bugs for 24.1 labels May 2, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 3, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 3, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 3, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 3, 2024
Fixes: cockroachdb#123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
michae2 added a commit to michae2/cockroach that referenced this issue May 6, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 6, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 6, 2024
michae2 added a commit to michae2/cockroach that referenced this issue May 6, 2024
Fixes: cockroachdb#123235

Release note (performance improvement): Make error handling in the
vectorized execution engine much cheaper. This should help avoid bad
metastable regimes perpetuated by statement timeout handling consuming
all CPU time, leading to more statement timeouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-release-24.1 Used to mark GA and release blockers, technical advisories, and bugs for 24.1 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. GA-blocker O-support Would prevent or help troubleshoot a customer escalation - bugs, missing observability/tooling, docs T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants