Spreads / Spreads.LMDB

Low-level zero-overhead and the fastest LMDB .NET wrapper with some additional native methods useful for Spreads
http://docs.dataspreads.io/spreads/libs/lmdb/api/README.html
Mozilla Public License 2.0
80 stars 9 forks source link

Replace blocking concurrent queue with non-blocking channel? #36

Closed wangjia184 closed 1 year ago

wangjia184 commented 5 years ago

Write transactions are executed in a single thread via a blocking concurrent queue.

it is better to replace blocking queue with Channel.

The former blocks a thread when waiting for new data; The latter is totally non-blocking hence you can free up thread when there is no data to write.

buybackoff commented 5 years ago

I'm actually thinking about removing the writer thread completely. LMDB is single-writer and enforces that with a lock. In .NET you could just use Task.Run if you do not want to block the current thread and fire-and-forget a transaction.

What is your use case where this is important?

buybackoff commented 1 year ago

Background write thread is removed completely.