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

DOC-12277 Add contention examples using crdb_internal.transaction_contention_events #19377

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

florence-crl
Copy link
Contributor

@florence-crl florence-crl commented Feb 14, 2025

Fixes DOC-12277

  • Added monitor-and-analyze-transaction-contention.md with images.
  • In crdb-internal.md, moved the column table to include file transaction-contention-events-columns.md.
  • In optimize-performance.json, added link to monitor-and-analyze-transaction-contention.html.

Rendered preview

Copy link

github-actions bot commented Feb 14, 2025

Files changed:

Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit 689e127
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-interactivetutorials-docs/deploys/67d855d8f6c7910008440779

Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit 689e127
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-api-docs/deploys/67d855d8d3452e0008505c36

Copy link

netlify bot commented Feb 14, 2025

Netlify Preview

Name Link
🔨 Latest commit 689e127
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-docs/deploys/67d855d8801fb90008bf5e38
😎 Deploy Preview https://deploy-preview-19377--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@jonstjohn jonstjohn left a comment

Choose a reason for hiding this comment

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

Thanks, Florence! I just added one minor comment but otherwise this looks great!

@florence-crl
Copy link
Contributor Author

Copy link

@kevin-v-ngo kevin-v-ngo left a comment

Choose a reason for hiding this comment

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

GREAT doc! Thanks for putting this together Florence. Approved pending nits.


It is crucial to understand where [transaction contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention) occurs and how it impacts your workload. Contention is a normal part of database operations. In many cases, it has limited impact on a workload. For example, a large number of contention events with a very short duration may not impact your workload. Similarly, a small number of contention events with longer duration may be acceptable if they occur outside the “user path”. However, if contention substantially contributes to query latency, it should be addressed.

This page shows how to monitor and analyze two types of contention: [lock contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention) and [serializable conflicts]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention). These types of contention are exposed via different observability mechanisms:

Choose a reason for hiding this comment

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

Nit: These types of contention are exposed via different observability touchpoints.


The remaining sections address analyzing contention once identified:

- [Analyze using `crdb_internal` tables](#analyze-using-crdb_internal-tables): A process to determine which workload and queries are involved in the contention.

Choose a reason for hiding this comment

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

Can we call out that not all crdb_internal are production ready and to refer to the doc here?

https://www.cockroachlabs.com/docs/stable/crdb-internal


- [Failed Execution]({% link {{ page.version.version }}/ui-insights-page.md %}#slow-execution)

A statement or transaction that failed due to a serialization error is identified as a Failed Execution. If the serialization error was due to contention, there is a conflicting or blocking transaction recorded. The execution details will show the conflicting transaction.

Choose a reason for hiding this comment

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

We capture all types of failures but for serialization errors, we capture more info (conflicting info) to help troubleshoot.

`txn.restarts.writetooold` | Number of restarts due to a concurrent writer committing first | COUNTER | COUNT

{{site.data.alerts.callout_info}}
Since these metrics are not categorized by database, interpreting them can be challenging.

Choose a reason for hiding this comment

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

Do we really need to call out it's challenging? Users can correlate these metrics with insights and SQL activity and find the 'database'

Since these metrics are not categorized by database, interpreting them can be challenging.
{{site.data.alerts.end}}

## Monitor using `crdb_internal` tables

Choose a reason for hiding this comment

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

Can we call out that not all are production-ready

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