parallelism to read from replicas is the key on accessing object stores. and it's considered a common practise when a database want leverage the cheap object stores, like described in this video from tanvivy (a elasticsearch replacement in object store) (it's also a same practise in databend):
(in summary: 1. assumes faster network 2. highly parallel to read from multiple replicas from s3)
so i think this approach still has the potential:
1. it's straghtforward and predicatble, and proven in object storage cache solutions in prod like alluxio and juicefs (some people use them to run MySQL workload over object storage to save cost)
2. it's compatible with different evicton strategies LRU, LFU, and do not need to maintain many metadata around eviction, less state, easier to get the program robust
3. it enables parallelism on accessing object storage
4. allows using read-ahead to accelerate Range scans
i think the parallism is the most important reason here, it's still a must to fit the access pattern of object stores
when comparing with the cachelib approach, i think the main shortage is that a finer-grained cache unit allows eviction at a finer grained level. so more hot caches could be kept on the machine if the working set is larger than the disk size.
i think this issue could be regarded as a kind of storage amplification, reduced the available storage size.
however in practise, such as a database workload, the buffer cache is always much smaller than the disk size, like i have an 1tb mysql instance, a 20gb buffer cache is always not bad for serving tens of thousand of queries. if we had a 200gb SSD, it could cache pretty lot of things imho.
given a 10tb slatedb, i guess a 500gb SSD as cache would be enough. with finer grained cache unit, it could reduce to 200gb, but i guess it might be acceptable? the disk nowadays becomes not that expensive comparing with memory, and easy to scale up in the cloud.
r
Rohan
09/04/2024, 3:55 AM
> however in practise, such as a database workload, the buffer cache is always much smaller than the disk size, like i have an 1tb mysql instance, a 20gb buffer cache is always not bad for serving tens of thousand of queries. if we had a 200gb SSD, it could cache pretty lot of things imho.
This is the bit where I'm unconvinced. The problem to me seems to be that the "page size" is so large for the alluxio style cache. With linux buffer cache it's still relatively small (4-16KB typically). So there isn't nearly as much un-accessed data in each cache entry. With the alluxio style cache is 1K times larger (4MB). So I'm skeptical about the analogy to a 20GB buffer cache sufficing for typical db workloads. For point-read workloads at least. I definitely see the benefit for workloads that do a lot of larger range scans.
> i think the parallism is the most important reason here, it's still a must to fit the access pattern of object stores
I'm not seeing why either approach offers better parallelism than the other. Can you expand on that?
f
flaneur233
09/04/2024, 4:08 AM
the alluxio approach is not only a cache layer but also a acceleration layer, it could rewrite a single RANGE into multiple small fragments GET requests in parallel, the goal this layer is to find out a access pattern which fit the nature of object store best (has multiple replicas available to read; each replica might have noisy neighbours and unpredictable latencies; not good latency on point read but have good bandwidth with parallelism; may produce a big bills simply because of massive api requests count). (however i think the object store access layer could be decoupled from a cache solution, but caching is definitely an important part in the layer's overall design goal)
flaneur233
09/04/2024, 4:19 AM
> With the alluxio style cache is 1K times larger (4MB). So I'm skeptical about the analogy to a 20GB buffer cache sufficing for typical db workloads. For point-read workloads at least. I definitely see the benefit for workloads that do a lot of larger range scans.
agree, with 4mb it might need a much larger disk storage than 20gb. i heard that some people use juicefs (which is similiar with alluxio, add a cache layer to object store and exposes a POSIX fs interface) to run OLTP mysql workload, but i can not remember the numbers about their configurations. i guess the disk cache size was not very small on these workloads.
i think we could assume the disk of 200gb is still cheaper than 20gb memory in the cloud, and users can choose scaling up their disk to save more cost from memory. claude tells me that a 200GB disk roughly $20~30 per month (5 times more expensive when comparing with object storage, which costs $22/tb per month), while 20gb memory is roughly $100~$200 per month (i hope it's not hallucination..)
r
Rohan
09/04/2024, 4:26 AM
That makes sense. FWIW object_store supports something like this already if you use their buffered APIs. I'm sure we could do it much more effectively for slatedb from our own layer though where we can control the request sizes and concurrency. I think this is orthogonal to the architecture of the cache. We need to make sure that when we do go to object store, that we do it in the most efficient way possible.
Rohan
09/04/2024, 4:31 AM
I'm skeptical about the 200GB number because 4MB is so large. At he same time it also means that we're more likely to pull in something that might result in a hit later. I suppose there isn't that much of a point to speculating. We really just have to see when we test it. The costs you're quoting actually sound more expensive. gp3 disks in aws are .08$/GB/month, so 16$/month for 200GB.
f
flaneur233
09/04/2024, 4:34 AM
agree, simulate the worloads & run a test is all we need
c
criccomini
09/04/2024, 5:55 AM
💯 on perf tests. We have the Alluxio style one. We should run some tests on it with Rohan’s load tester. 😁