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

release-2.1: kv: set sane default for kv.transaction.write_pipelining_max_batch_size #32621

Merged

Conversation

nvanbenschoten
Copy link
Member

Backport 1/1 commits from #32606.

/cc @cockroachdb/release


Informs #32522.

There is a tradeoff here between the overhead of waiting for consensus for a batch if we don't pipeline and proving that all of the writes in the batch succeed if we do pipeline. We set this default to a value which experimentally strikes a balance between the two costs.

To determine the best value for this setting, I ran a three-node single-AZ AWS cluster with 4 vCPU nodes (m5d.xlarge). I modified KV to perform writes in an explicit txn and to run multiple statements. I then ran kv0 with 8 DML statements per txn (a reasonable estimate for the average number of statements that an explicit txn runs) and adjusted the batch size of these statements from 1 to 256. This resulted in the following graph:

image

We can see that the cross-over point where txn pipelining stops being beneficial is with batch sizes somewhere between 128 and 256 rows. Given this information, I set the default for
kv.transaction.write_pipelining_max_batch_size` to 128.

Of course, there are a lot of variables at play here: storage throughput, replication latency, node size, etc. I think the setup I used hits a reasonable middle ground with these.

Release note: None

@nvanbenschoten nvanbenschoten requested review from tbg and a team November 26, 2018 23:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@bdarnell bdarnell left a comment

Choose a reason for hiding this comment

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

LGTM but anything that gets backported should have a release note.

Informs cockroachdb#32522.

There is a tradeoff here between the overhead of waiting for consensus
for a batch if we don't pipeline and proving that all of the writes in
the batch succeed if we do pipeline. We set this default to a value which
experimentally strikes a balance between the two costs.

To determine the best value for this setting, I ran a three-node single-AZ AWS
cluster with 4 vCPU nodes (`m5d.xlarge`). I modified KV to perform writes in an
explicit txn and to run multiple statements. I then ran `kv0` with 8 DML
statements per txn (a reasonable estimate for the average number of statements
that an **explicit** txn runs) and adjusted the batch size of these statements
from 1 to 256. This resulted in the following graph:

<see graph in PR>

We can see that the cross-over point where txn pipelining stops being beneficial
is with batch sizes somewhere between 128 and 256 rows. Given this information,
I set the default for `kv.transaction.write_pipelining_max_batch_size` to 128.

Of course, there are a lot of variables at play here: storage throughput,
replication latency, node size, etc. I think the setup I used hits a reasonable
middle ground with these.

Release note (performance improvement): Change the default value for the
cluster setting kv.transaction.write_pipelining_max_batch_size to 128.
This speeds up bulk write operations.
@nvanbenschoten
Copy link
Member Author

but anything that gets backported should have a release note

Done.

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