this post was submitted on 12 Jun 2023
380 points (99.2% liked)
Lemmy.World Announcements
29028 readers
8 users here now
This Community is intended for posts about the Lemmy.world server by the admins.
Follow us for server news ๐
Outages ๐ฅ
https://status.lemmy.world
For support with issues at Lemmy.world, go to the Lemmy.world Support community.
Support e-mail
Any support requests are best sent to info@lemmy.world e-mail.
Report contact
- DM https://lemmy.world/u/lwreport
- Email report@lemmy.world (PGP Supported)
Donations ๐
If you would like to make a donation to support the cost of running this platform, please do so at the following donation URLs.
If you can, please use / switch to Ko-Fi, it has the lowest fees for us
Join the team
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It's important to recall that last week the biggest lemmy server in the world ran on a 4-core VM. Anybody that says you can scale from this to reddit overnight with "horizontal scaling" is selling some snake oil. Scaling is hard work and there aren't really any shortcuts. Lemmy is doing pretty well on the curve of how systems tend to handle major waves of adoption.
But that's not your question, you asked if Lemmy can horizontally scale. The answer is yes, but in a limited/finite way. The production docker-compose file that many lemmy installs are based on has 5 components. From the inside out, they are:
So... first off... there's 5 layers there that talk to each other over the docker network. So you can definitely use 5 computers to run a lemmy instance. That's a non-zero amount of horizontal scaling. Of those layers, I'm told that lemmy and lemmy-ui are stateles and you can run an arbitrary number of them today. There are ways of scaling nginx using round-robin DNS and other load-balancing mechanisms. So 3 out of the 5 layers scale horizontally.
Pict-rs does not. It can be backed by object storage like S3, and there are lots of object storage systems that scale horizontally. But pict-rs itself seems to still need to be a single instance. But still, that's just one part of lemmy and you can throw it on a giant multicore box backed by scalable object storage. Should take you pretty far.
Which leaves postgres. Right now I believe everyone is running a single postgres instance and scaling it bigger, which is common. But postgres has ways to scale across boxes as well. It supports "read-replicas", where the "main" postgres copies data to the replicas and they serve reads so the leader can focus on handling just the writes. Lemmy doesn't support this kind of advanced request routing today, but Postgres is ready when it can. In the far future, there's also sharding writes across multiple leaders, which is complex and has its downsides but can scale writes quite a lot.
All of which is to say... lemmy isn't built on purely distributed primitives that can each scale horizontally to arbitrary numbers of machines. But there is quite a lot of opportunity to scale out in the current architecture. Why don't people do it more? Because buying a bigger box is 10x-100x easier until it stops being possible, and we haven't hit that point yet.