Oh, fun. I wasn't expecting this on here so soon. It's very MVP and currently running on a 5$ VPS.
Happy to answer any questions.
andersmurphy•2h ago
And we're back on a 10$ VPS.
konsalexee•2h ago
What is the full stack you are using? What parts also require scaling up? DB, bandwidth orrr?
andersmurphy•1h ago
So the stack is datastar + clojure + sqlite + caddy on a hetzner VPS 2 core 2G.
The scaling was preemptive as it was hitting 150% CPU (out of 200%). Needed to power down to rescale.
Now it's hovering at around 200% (out of 400%). About 80kb/s and 10 disk iops.
Everything goes via a sqlite db.
daymanstep•1h ago
How are you doing the throttling? I imagine one malicious player might do like 10000 iops to your DB.
andersmurphy•1h ago
So there's no rate limiting.
But because it's sqlite it's a single writer. Everything gets batched as one transaction every 100ms. The operations on a single chunk gets squashed into a single write.
Even without the squashing sqlite can handle 10000-20000+ updates/s because of the transaction batching.
With the chunk based squashing all edits to a chunk in that 100ms window become one update, so it can scale quite well.
matsemann•1h ago
But the question wasn't really if you can handle it, but more if someone could control the whole board themselves, I think?
andersmurphy•49m ago
Oh, I mean they could try. It's a very big board. Probably possible though if someone is sufficiently motivated.
matsemann•42m ago
I see a snake eating the 0,0 part now at least, heh.
Btw, if I add a ' to the string, it's impossible to override by othrs. At least in the UI on Firefox, the snake still ate it.
andersmurphy•4h ago
Happy to answer any questions.
andersmurphy•2h ago
konsalexee•2h ago
andersmurphy•1h ago
The scaling was preemptive as it was hitting 150% CPU (out of 200%). Needed to power down to rescale.
Now it's hovering at around 200% (out of 400%). About 80kb/s and 10 disk iops.
Everything goes via a sqlite db.
daymanstep•1h ago
andersmurphy•1h ago
But because it's sqlite it's a single writer. Everything gets batched as one transaction every 100ms. The operations on a single chunk gets squashed into a single write.
Even without the squashing sqlite can handle 10000-20000+ updates/s because of the transaction batching.
With the chunk based squashing all edits to a chunk in that 100ms window become one update, so it can scale quite well.
matsemann•1h ago
andersmurphy•49m ago
matsemann•42m ago
Btw, if I add a ' to the string, it's impossible to override by othrs. At least in the UI on Firefox, the snake still ate it.