-
Notifications
You must be signed in to change notification settings - Fork 474
Add a FAQ on contention #3156
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
Add a FAQ on contention #3156
Conversation
Once the copy-editing is done I'll do the propagation to the other version directories |
bf002dc
to
4a8ee43
Compare
4a8ee43
to
a903219
Compare
a903219
to
8036276
Compare
8036276
to
8915bc8
Compare
v2.1/sql-faqs.md
Outdated
over table rows with the same index key values (either on [primary | ||
keys](primary-key.html) or secondary [indexes](indexes.html)) or using | ||
index key values that are close to each other, and thus place the | ||
indexed data on the same [data ranges](architecture/overview.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
table rows with the same index key values within the same column family, no?a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I wrote first. But for identifying contention column families don't matter: we don't split rows with the same PK across different ranges, so even accesses to different column families land on the same range.
The distinction matters for single-key serialization, which I detail further below.
76395ea
to
9fd8a3f
Compare
Does this belong in FAQs or the performance best practices page? It's definitely a frequently-encountered issue, but "what is transaction contention" is not the way that people phrase the question. Is there another title we can give this that would be a better match for the users' language? (other than something vague like "why is it so slow") Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. v2.1/sql-faqs.md, line 58 at r2 (raw file):
"A set of transactions that all contend on the same keys will be limited in performance to the maximum processing speed of a single node..." It is possible for a set of transactions that all contend with each other to contend on different keys and therefore still get some parallelism, but we don't need to go into that much detail here. v2.1/sql-faqs.md, line 69 at r2 (raw file):
I would remove the discussion of multi-core parallelism from these two bullets, and instead add a section at the end, something like: "It is always best to avoid contention as much as possible via the design of the schema and application. However, sometimes contention is unavoidable. To maximize performance in the presence of contention, you'll need to maximize the performance of a single range.
v2.1/sql-faqs.md, line 90 at r2 (raw file):
I'm not sure about this advice. Have we seen many instances where this was part of the solution? Denormalization of immutable (or nearly-immutable) data can also increase scalability by creating multiple copies of often-referenced data. v2.1/sql-faqs.md, line 106 at r2 (raw file):
Also mention that using Comments from Reviewable |
The title must stay because we often talk about contention in our explanations to users (and in blog posts, and other things) and it would be good for people to have a definition/explanation to search for if they want to understand our answers better. However I agree we must provide additional entry points to make this information better discoverable. I'll make some attempt. Will let you know. Review status: 0 of 1 files reviewed at latest revision, 5 unresolved discussions, all commit checks successful. Comments from Reviewable |
9fd8a3f
to
85f87a9
Compare
I have moved the bulk of the explanation to the perf best practices page, and added two entry points in the FAQ. RFAL Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions. v2.1/sql-faqs.md, line 58 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. v2.1/sql-faqs.md, line 69 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. v2.1/sql-faqs.md, line 90 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Added a note with your highlight. v2.1/sql-faqs.md, line 106 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. Comments from Reviewable |
85f87a9
to
1f112e5
Compare
Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions, all commit checks successful. Comments from Reviewable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, @knz! As usual. LGTM, with some nits.
Once this lands, I'll look into other ways to cross-reference this new material.
|
||
## Understanding and Avoiding Transaction Contention | ||
|
||
Transaction contention occurs when the following three conditions hold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: hold together
> are met
.
|
||
To avoid contention, multiple strategies can be applied: | ||
|
||
- Use index key values with a more random distribution of values, so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to link directly to the specific FAQ you have in mind.
specify values for all columns in the inserted rows. This will | ||
usually have the best performance under contention, compared to | ||
combinations of [`SELECT`](select-clause.html), | ||
[`INSERT`](insert.html) and [`UPDATE`](update.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: place comma before the and
(the "oxford comma").
It is always best to avoid contention as much as possible via the | ||
design of the schema and application. However, sometimes contention is | ||
unavoidable. To maximize performance in the presence of contention, | ||
you'll need to maximize the performance of a single range. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this paragraph introducing the following bulleted list? If so, use a semicolon instead of a period at the end of the last sentence.
v2.1/sql-faqs.md
Outdated
Transaction contention occurs when transactions issued from multiple | ||
clients at the same time operate on the same data. | ||
|
||
This can cause transactions to wait on each other and decrease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be its own paragraph. Please make it the second sentence of the previous paragraph.
v2.1/sql-faqs.md
Outdated
Transaction | ||
Contention](performance-best-practices-overview.html#understanding-and-avoiding-transaction-contention). | ||
|
||
## Why can I not get more operations per second by increasing the number of nodes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rephrase this a bit: Why would increasing the number of nodes not result in more operations per second?
1f112e5
to
5bf139f
Compare
Review status: 0 of 2 files reviewed at latest revision, 11 unresolved discussions. v2.1/performance-best-practices-overview.md, line 232 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. v2.1/performance-best-practices-overview.md, line 270 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
There are multiple. How do you suggest to do that? v2.1/performance-best-practices-overview.md, line 287 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. v2.1/performance-best-practices-overview.md, line 305 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. v2.1/sql-faqs.md, line 47 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. v2.1/sql-faqs.md, line 55 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. Comments from Reviewable |
v2.1/performance-best-practices-overview.md, line 270 at r3 (raw file): Previously, knz (kena) wrote…
You're right. You can just leave it as-is. Users will see the toc and jump to the FAQ that interests them. Comments from Reviewable |
Want me to propagate the change to the other version dirs? |
Yes, please. |
5bf139f
to
a4541ad
Compare
Done |
I've been seeing this so many times everywhere (on the forum, on gitter, from sales etc) that I am surprised we didn't FAQ this earlier. Here it is.