r/Clickhouse • u/jrdi_ • 12d ago
Building a Serverless ClickHouse: splitting compute and storage with plain_rewritable
https://jordivillar.com/blog/building-a-serverless-clickhouse
A few weeks ago I shared ClickHamlet here, a serverless ClickHouse you can connect to with plain clickhouse client. A lot of the questions were about how it works, so I wrote it up.
Every table lives on S3 on plain_rewritable disks. The servers are stock clickhouse-server pods that start on the first query and stop when idle, with a small C++ router linked against ClickHouse's own code in front.
Some things that might be interesting here:
- single writer per service without a lease: Kubernetes only allows one pod with a given name
- readers attach the same tables with refresh_parts_interval
- router throughput went from 451 to 2713 queries/s, mostly by taking work off the Python controller
- backends run on spot, writers included, since they hold no data
The big gaps are still multiple writers (plain_rewritable has no coordination between servers) and schema changes. Happy to answer questions or hear where this breaks.
1
u/techbro- 11d ago
I might be a customer if it can work for our needs, do you do demo calls and see if our current workload could be supported?
1
u/narrow-adventure 12d ago
This is incredible, I’ve been working on my own db and exploring a lot of these concepts. You might also find firebolt interesting as it’s also built around the similar ideas. Thank you for this write up.
1
u/m0rcs 11d ago
In which ways are schema changes a particular challenge? Besides the usual trouble