https://slatedb.io logo
Hello folks,
# general
s
Hello folks, We are trying to benchmark the scan_with_options endpoint for our use-case to use slatedb as an intermediate cache. However, the read throughput is getting capped at around 320MB/sec with CPU being the bottleneck. Some configuration pointers would really be helpful to improve the per reader throughput?
c
Few questions: 1. What's youre target throughput? 2. Can you share your configs? 3. When you say "reader throughput" are you using a
DbReader
? Or are you calling
scan_with_options
on the writer client? 4. Are you using compression?
(In general, I would say 320MB/sec is what I've experienced as near-peak load as well)
The main way to speed up reads is with caching...
s
cc: @Tr00evol could provide more details on the configurations.
t
Hi @criccomini ! 1. Generally, we are evaluating against some other options and trying to see how close we can get to raw S3 throughput. For a single scan, the read throughput is actually even less (30 - 50 MB/s), so the first step is to optimize the single scan case. 2. Configs: defaults for everything except the block size, which is 16KB and flush interval, which is 3 seconds. I did try with and without an object cache on disk but did not notice any changes. 3. We have been using both methods (
scan_with_options
on both DbReader and the writer client) 4. We are not using compression.
Additionally, scan_options -> [durability: inmemory, readahead: 4mb, cache_blocks:false] > The main way to speed up reads is with caching... I did have a few questions on this as well. As I understand there is an inmemory cache and an (optional) disk cache for object store? I did see a lot of s3 calls even after setting an object cache, is there a setting we might be missing in scan_options / object store config?
c
> I did have a few questions on this as well. As I understand there is an inmemory cache and an (optional) disk cache for object store? I did see a lot of s3 calls even after setting an object cache, is there a setting we might be missing in scan_options / object store config? The on-disk cache starts empty on the first run. As you scan, it persists chunks of the S3 objects locally on disk. These chunks are then re-used for future scans (even after restarting the process, and can also be shared across processes). So if your test starts with an empty cache for the first time and does a scan, the caching won't do anything for you. What exactly is your test doing?
t
The test starts by first writing a set amount of data through slate (1Gb/10Gb with items either 1kb/10kb). Then we all that data back through scan. We are trying different scan patterns, such as: 1. Single scan on writer. 2. Multiple concurrent scans on writer. 3. Single scan with
DbReader
. 4. Multiple concurrent scans on
DbReader
5. Multiple instances of
DbReader
(on different pods) doing concurrent scans.
c
You might consider a much higher readahead. IIRC, we default to 4MiB object chunks, so you would only be front-running one chunk. A 4MiB chunk would mean you are only fetching one chunk ahead. I do see that we're hard-coding the scan iterator to just 1 fetch task, though:
Copy code
let sst_iter_options = SstIteratorOptions {
    max_fetch_tasks: 1,
    blocks_to_fetch: read_ahead_blocks,
    cache_blocks: options.cache_blocks,
    eager_spawn: true,
};
You might try bumping this up locally to see if it improves throughput (if so, we can expose this through a ScanOption)
t
Gotcha. I did initially have a 128 mB readahead but it was leading to the process crashing due to
OutOfMemory
with multiple readers. Overall, we also want to support a decent number of concurrent readers. Ack on
max_fetch_tasks
, will try it out, thank you!
c
Gotcha. What version are you running? You might benefit from this PR for your use cases (1) and (2): https://github.com/slatedb/slatedb/pull/747 It is part of 0.8.
t
We are using the master branch from about 3 weeks ago. Will update.
c
K.. that PR is right on the border then 😛
Take a look at it; it requires some configs to use (preload and whatnot)
Heya-- just checking in to see how it's progressing
t
Hello, I haven't gotten a chance to try out the changes yet but working on it. Another thing we've been looking at is the write/read amplification. The way the tests are run, we shut down the writer instance after the writes succeed, which means there isn't a long enough time for which gc/compaction could run. We are seeing data in S3 about 5x the size of the data set, and are wondering if the read amplification could also be leading to some perf hit.
c
> We are seeing data in S3 about 5x the size of the data set Have to be very careful about drawing conclusions from data size on S3. The garbage collector only delets files perioidcally (and defaults to a pretty conservative
min_age
for compacted files).
t
Slight update: was able to get a much better throughput (~140mb/s) for the single scan case with max_fetch_tasks set to 4, compared to ~41mb/s earlier. This is on DbReader instances.
c
K, we should probably make that a variable...
Mind opening a GH for me? I'm knee-deep in deterministic simulation testing 😛
t
For sure!
c
Thanks!
t
Added the option to the gobindings as well, plus some other things hygiene things I had locally.
c
Merged! 🙂
Working on cutting an 0.8.2 right now
Pushed!