google / leveldb

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
BSD 3-Clause "New" or "Revised" License
36.3k stars 7.8k forks source link

why not use a immutable vector? #398

Open luodw opened 8 years ago

luodw commented 8 years ago

If we insert into leveldb quickly , the memtable will be also full quickly, but if the immutable do not write to disk, the main thread will be blocked to wait imm=NULL ;

So i want know why not use a immutable vector, when memtable is full ,it will be insert into immutable vector; therefore ,the main thread can not be blocked;

i know there is a background thread to dump imm, it schedule the task, so i think why not use this thread to solve the immutable vector?maybe set more background thread? just like main thread produce immutables and the backgraound threads to dump them.

thank you!

liuchang0812 commented 8 years ago

Double Buffers is a common method to improve application's performance, If we use only one immutable vector for memtable, we should be include more locks to protect this immutable. On the other hand, What should we do in which user inserts new key-value pair when we dumping the immutable.