Skip to content

Mv throttle 4

Matthew Von-Maszewski edited this page Aug 23, 2013 · 3 revisions

Status

  • development started July 24, 2013

History / Context

The write throttle was always adjusted in a rush. One of its known weaknesses is that the amount of wait applied to a given Write() call did not account for the amount of time passed since the previous call. This bad accounting causes over-throttling in long running, heavy Write loads (and/or slow drive arrays). This branch addresses the accounting problem.

Branch description

The DBImpl::Write() function within db/db_impl.cc contains the timed wait portion of the write throttle. This branch splits the wait into two steps. The first step is for one write operation. The wait is calculated as the difference between the expected end time of this wait and now. The second step calculates how much additional time is needed for batches with multiple writes. Once both steps complete, the expected ending time for the next write is saved.

Google's original NowMicros() function is updated to use clock_gettime(CLOCK_MONOTONIC) instead of gettimeofday() in util/env_posix.cc. clock_gettime(CLOCK_MONOTONIC) is considered both a "best practices" solution in general Linux work and a higher performance solution. The latter is key given the rate this new write throttle might be calling it.

Clone this wiki locally