Skip to content

Backfill performance: Use batches for sending/inserting data #1971

Closed

Description

@danielmewes

Backfilling works by sending backfill_chunk_ts over the network. Despite the name, those currently contain only a single key/value pair each. Delivering all these small messages is inefficient.

On the receiving node, each key/value pair is then inserted in a transaction of its own. That's even more inefficient.

I've started working on code that sends all key/values of a given Btree leaf node at once (branch daniel_backfilling_chunks). When backfilling 400 byte documents from one machine with rotational drives to a second one with rotational drives, this improved the backfilling throughput from ~80 documents/s to 300-400 documents per second.

I would hope that we can still ship this as part of 1.12, because users are actually running into problems with slow backfills (#1885). If not, we could ship it in a point release soon after.

Activity

  1. added this to the 1.12 milestone on Feb 20, 2014
  2. self-assigned this
    on Feb 20, 2014
  3. wojons commented on Feb 20, 2014

    @wojons
    Contributor

    I think this would be fine as a point release dont get me wrong its imporant but the system is still working and running. And something like this on the size of batches should be something that is really well tuned and not picking random numbers from a hat. And if that means it will be in a point release that would be good. But this should be before an LTS

    One idea for something like this is take into a fact on how tcp knows to send more or less backets by how fast it responds. Pretty much if the host machine sends 100 bytes worth of data and the recivving node responds back in 2 seconds. Then the host may send 200 bytes and if the recving node returns back in 3 seconds it will keep getting faster since the rate the docs are being written to is faster. If it gets slower then it will send less data. Of course this number will never sit still but it will also allow for someone that has SSD drives that may be under hevey load for a moment to get data at a slower rate and then for it to pick up once there is more IO avaiable.

  4. danielmewes commented on Feb 20, 2014

    @danielmewes
    MemberAuthor

    @wojons: Thanks for sharing your thoughts. Something like what you describe would work very well I imagine.
    In the case of backfilling I think we can get away with something easier for now. There are basically two limitations for the batch size in backfilling:

    • The way our code is currently structured, we can send at most all the documents in a single leaf node of our btree in one batch. This is typically something like 30-40 documents.
    • The other limitation is size. If each of those documents is 16 MB large, then that's already a huge chunk of data. Probably too much to send all of it at once. So we have to limit that a little.
  5. danielmewes commented on Feb 20, 2014

    @danielmewes
    MemberAuthor

    In CR 1226 by @Tryneus

  6. wojons commented on Feb 21, 2014

    @wojons
    Contributor

    @danielmewes yeah its a pretty intresting under taking when i build systems that follow rules like that but once its built its really worth it because your very sure that in most cases ur as fast as its going to go.

  7. danielmewes commented on Feb 21, 2014

    @danielmewes
    MemberAuthor

    Merged into next e0b6856
    Will be shipped as part of 1.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions