Conversation
This implements support for on-disk indexes using the Pebble library. Benchmarks with `pebble.NoSync` committing of the batch (with `Sync` it's about 15k/s): BenchmarkDB_WriteTxn_1-8 1114802 1075 ns/op 930177 objects/sec 1064 B/op 17 allocs/op BenchmarkDB_WriteTxn_10-8 2676404 471.6 ns/op 2120280 objects/sec 526 B/op 8 allocs/op BenchmarkDB_WriteTxn_100-8 3023170 399.4 ns/op 2503613 objects/sec 537 B/op 7 allocs/op BenchmarkDB_WriteTxn_100_Pebble-8 395737 2855 ns/op 350215 objects/sec 1279 B/op 24 allocs/op BenchmarkDB_RandomLookup-8 33684 34905 ns/op 28649147 objects/sec 0 B/op 0 allocs/op BenchmarkDB_RandomLookup_Pebble-8 1236 956300 ns/op 1045697 objects/sec 512791 B/op 9001 allocs/op BenchmarkDB_SequentialLookup-8 44026 27245 ns/op 36703490 objects/sec 0 B/op 0 allocs/op BenchmarkDB_SequentialLookup_Pebble-8 1278 936724 ns/op 1067550 objects/sec 512878 B/op 9001 allocs/op To be considered: - Export `tableIndex` etc. interfaces and implement this as a separate go module so we don't expose these extra dependencies for all users. Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
|
Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a thought exercise for implementing support for on-disk indexes using the Pebble library. This was 100% implemented by Codex with minor input from me to come up with reasonable plan (
plan-pebble-index.md) and tweaks to avoid too large changes to existing code. As such I do not consider this anywhere near production quality and it is meant solely as an experiment to gauge the feasibility of on-disk indexes.PebbleIndexcan be used either as the primary or as a secondary index.PebbleIndexis alwaysunique. To restore tables with pebble indexes
db.Restoremust be called before the database is used.Benchmarks with
pebble.NoSynccommitting of the batch:With
pebble.Syncfor actually durable commits:To be considered:
tableIndexetc. interfaces and implement this as a separate go module so we don't expose these extra dependencies for all users. Depends on Proposal: Split into multiple Go modules #154. Pebble is about ~160k lines and it is not imported by cilium/cilium yet.WithPebble,Restore, changes toCommitpath,Err*Pebble*, ...)Watchagain to continue syncing a StateDB table then it'll need to re-list and throw the old data away.Watchmay also return objects out-of-order in regards to theResourceVersionso likely need to separately (from PebbleIndex) persist what the last highest seenResourceVersionwas. Or do a full scan of the table to find highestResourceVersion, althoughResourceVersionis supposed to be an opaque string and is not considered comparable.pkg/walcould be replaced with this. A new 160k line dependency for niche uses is probably not worth it forcilium/ciliumat this time though. If we want persistence but always with in-memory indexing then we could consider instead having hooks to use something likepkg/walwith the tables. The benefit ofPebbleIndexis that we wouldn't actually need to hold all objects in memory (provided all indexes arePebbleIndex, including the internal RevisionIndex or that the in-memory indexes just hold primary keys instead of objects and we look up object from disk via the PebbleIndex).