tmds / Tmds.LinuxAsync

MIT License
25 stars 3 forks source link

Support using ThreadPool as output writer scheduler #71

Closed tmds closed 4 years ago

tmds commented 4 years ago

This adds an additional option for the output writer scheduler.

We've already experimented using Inline and IoThread.

These have some limitations: Inline is unable to batch multiple writes to a pipe. This will definitely affect pipelined plaintext benchmark. But also in non-pipelined cases, it is an issue because the pipe reader can't distinguish between the writer writing, or flushing. With inline scheduler this means we perform a send syscall even for intermediates writes. IoThread requires Socket to expose a PipeScheduler in some form.

This adds the option to use ThreadPool as the scheduler. Compared to Inline there is scheduling overhead, but there is the advantage of batching multiple writes. Compared to IoQueue it may be nicer for the ThreadPool implementation. Compared to IoThread it is unable to batch the operations, because they don't occur on the io thread.

cc @antonfirsov @adamsitnik