Description
Our file IO currently blocks the host thread. This is triggered by ringbuffer messages from the enclave to the host, both for reads and writes. These are assumed to be quick operations, but they will completely block the host thread (main lib uv thread) while processing.
We need to make this asynchronous, to avoid stalls when the IO is slow. We need to ensure the file IO is still correctly ordered.
I think there are 2 extreme approaches:
- Start a new thread dedicated to IO, queue all IO operations, run them in order on this new thread.
- Use libuv to launch each IO task as a separate task on the work queue.
We'd like to use the latter for optimal parallelism, and to avoid rebuilding similar infrastructure ourselves. But since we're unsure about the ordering guarantees of this approach, we'll start with something slower and simpler like the former.
While ledger_get
and ledger_append
operations are simple enough, anything that interacts with ledger ranges (in particular - fetching the body for an AppendEntries
) is likely to be tricky to make async.