https://slatedb.io logo
👋 hey everyone, Micah here from Arroyo. Really e...
# general
m
👋 hey everyone, Micah here from Arroyo. Really excited about this project! We've been thinking a lot about what a good hierarchical storage approach would look like for streaming engines, and it's great to see so many new projects in this space. I'm particularly interested in the problem of fast recovery. With Flink, a major source of operational difficulty is that all of the RocksDB state needs to be downloaded locally before the job can be resumed on recovery. I think in the current slatedb design that's still more or less the case—we need to copy entire sstables to local disk or memory. It's possible to improve on this with file formats that support indexing so we can minimize the amount of data we need to read to get a particular key. This is particularly valuable for jobs with very large state (like 100gigs-TBs) representing very long windows with relatively rare keys. For example, a pipeline that counts events by user id over a month might just see a particular user on a few of those days and could avoid loading their data until they show up again. I'm curious if any of this resonates with the design goals of this project, and whether there's interest in file formats with more efficient KV-lookups.
r
Good to see you @micahw ! You might remember we met at Kafka Summit London earlier this year 🙂 I definitely view fast recovery as a goal for the project. I think the current design lays some good foundations to acheive this: 1. the core state needed to recover the db and start serving is actually quite small. You just need to recover the core metadata/manifest and replay the WAL to be able to start serving. 2. From there, you need to page in the state required to serve a given read. Our current file format supports this somewhat well. Each SST has a single-level index over the contained blocks. So you just need to read this index and then you can read the block(s) required to serve a given request. The index is single-level, so it can wind up being quite large - this is something we can improve on eventually. You still have to go to the object store to get that data. We're currently working on adding in-memory and on-disk caches to make reads faster. The in-memory cache is at the block level, so you don't have to fetch much state to populate it, and displacement is less of an issue. @flaneur233 is working on the disk cache. I think he's implementing it so that we page in some chunk between a block and the whole SST. So you still have to read a good chunk of data to fill it, but it doesn't have to be the whole SST. And it can be populated in the background. Repeated reads to the same key can be served from the block cache while the on-disk cache gets filled. Curious to get your thoughts on what a good file format would look like.
c
Hey Micah! Rohan covered everything. Just wanted to point to the on-disk cache that @flaneur233 , which is located here: https://github.com/slatedb/slatedb/pull/139 As Rohan said, it does background caching in configurable chunk sizes (default is 32 or 64mb I think). The startup cost, as Rohan said, is just the WAL replay, which is configurable, and quite small. From there, reads will be slow-ish (20-100ms depending on value sizes and AWS latency) as the cache warms up. The in-memory cache will cache any blocks read immediately (LRU). The on-disk cache will simultaneously fetch the 64mb chunks which will serve as both a cache and optimistic read for range scans.
tl;dr Startup should be almost immediate, then reads should be slow for a little bit as the cache warms up. I'm also quite interested in what ideas you have for a file format.
v
Adding to above, one other thing that could speed up cache warmup is to persist some metadata about cache state optionally, and fill the cache upon recovery. This would further mitigate the read latency increase after recovery, specifically for applications that have a large overall state and a smaller, often repeated hot state.
c
Good point. We can also remember what cache we have on disk so a restart on the same machine will automatically get the cache on disk.
Lots to do 😄
@Vignesh mind opening GH issue for that? I think it's a good one, and @flaneur233 is making good progress on the disk cache. It'd be a nice follow-on..
I'm looking at the in-memory block cache right now 😆
So many nice PRs
v
c
Thanks! 😊