{"by":"rockeetterark","descendants":26,"id":44432322,"kids":[44433950,44445497,44435336,44434326,44433864,44435282,44432323,44435437,44433577,44434519,44433168],"score":73,"text":"As the creator of TerarkDB (acquired by ByteDance in 2019), I have developed ToplingDB in recent years.<p>ToplingDB is forked from RocksDB,   where   we have replaced almost all components with more efficient alternatives(db_bench shows ToplingDB is about ~8x faster than RocksDB):<p>* MemTable: SkipList is replaced by CSPP(Crash Safe Parallel Patricia trie), which is 8x faster.<p>* SST: BlockBasedTable is replaced by ToplingZipTable, implemented by searchable compression algo, it is very small and fast, typically less than 1μs per lookup:<p><pre><code>  * Keys&#x2F;Indexes are compressed   using NestLoudsTrie(a multi-layer nesting LOUDS succinct trie).\n\n  * Values in a SST are compressed   together with better zip ratio than zstd, and can unzip by a single value at 1GB&#x2F;sec.\n\n  * BlockCache is no longer needed, double caching(BlockCache &amp; PageCache) is avoided\n</code></pre>\nOther hotspots are also improved:<p>* Flush MemTable to L0 is omited, greatly reducing write amp and is very friendly for large(GB) MemTable<p><pre><code>  * MemTable   serves as the index of Key to &quot;value position in WAL log&quot;\n\n  * Since WAL file content almost always in page cache, thus value content can be efficiently accessed by mmap\n\n  * When Flush happens, MemTable is dumpped as an SST and WAL is treated as a blob file\n\n    * CSPP MemTable use integer index instead of physical pointers, thus in-memory format is exactly same with in-file format\n</code></pre>\n* Prefix cache for searching candidate SSTs and prefix cache for scanning by iterators<p><pre><code>  * Caching fixed len key prefix into an array, binary search it as an uint array\n</code></pre>\n* Distributed compaction(superior replacement to rocksdb remote compaction)<p><pre><code>  * Gracefully support MergeOperator, CompactionFilter, PropertiesCollector...\n\n  * Out of the box, development efforts are significantly reduced\n\n  * Very easy to share compaction service on spot instances for many DB nodes\n</code></pre>\nUseful Bonus Feature:<p>* Config by json&#x2F;yaml: can config almost all features<p>* Optional embeded WebView: show db structures in web browser, refreshing pages like animation<p>* Online update db configs by http<p>MySQL integration, ToplingDB has integrated into MySQL by MyTopling, which is forked from MyRocks with great improvements, like improvements of ToplingDB on RocksDB:<p>* WBWI(WriteBatchWithIndex): like MemTable, SkipList is replace with CSPP, 20x faster(speedup is more than MemTable).<p>* LockManager &amp; LockTracker: 10x faster<p>* Encoding &amp; Decoding: 5x faster<p>* Others ....<p>MyRocks has many disadvantages compared to InnoDB, while MyTopling outperforms InnoDB at almost all aspect - excluding feature differences.<p>We have create ~100 PRs for RocksDB, in which ~40 were accepted. Our PRs are mostly &quot;small&quot; changes, since big changes are not likely accepted.<p>ToplingDB has been deployed in numerous production environments.<p>Welcome every one using ToplingDB &amp; MyTopling, and discuss in <a href=\"https:&#x2F;&#x2F;github.com&#x2F;topling&#x2F;toplingdb&#x2F;discussions\">https:&#x2F;&#x2F;github.com&#x2F;topling&#x2F;toplingdb&#x2F;discussions</a>","time":1751364479,"title":"Show HN: ToplingDB - A Persistent Key-Value Store for External Storage","type":"story","url":"https://github.com/topling/toplingdb"}