Skip to content

mv nonblocking write2

Matthew Von-Maszewski edited this page Oct 18, 2016 · 11 revisions

Status

  • merged to master -
  • code complete - October 6, 2016
  • development started - December 2, 2015

History / Context

eleveldb is Basho's Erlang to leveldb translation layer. The layer initially accessed the leveldb API calls while remaining on Erlang threads. Turns out the use of Erlang threads within leveldb could result in single and multiple collapses of the Erlang schedulers. Erlang does not recognize scheduled tasks that "take a while", such as native disk operations. Basho installed a specialized worker pool, call hot threads, in the first quarter of 2013 within eleveldb. eleveldb took each Erlang operation request and created an asynchronous task that executed on thread from the worker pool. The Erlang scheduler thread was released to perform other tasks while waiting for an asynchronous message from the independent eleveldb thread.

The thread swapping solution solved the problem of Erlang scheduler collapses. But thread swapping increased the time required to perform any requested operation. This branch looks for opportunities when a write operation is highly unlikely to be delayed or if delayed, not for a significant period. During those opportunities, this branch bypasses the thread swap when write operations are known to not receive intentional delays from the write throttle code and/or rotation of the current write buffer.

There is an mv-nonblocking-write2 branch in both the eleveldb repository and the leveldb repository. This wiki entry discusses both.

Branch description

db/builder.cc

Clone this wiki locally