this post was submitted on 05 Jun 2023
161 points (99.4% liked)

Lemmy

2172 readers
4 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to [email protected].

founded 4 years ago
MODERATORS
 

With forewarning about a huge influx of users, you know Lemmy.ml will go down. Even if people go to https://join-lemmy.org/instances and disperse among the great instances there, the servers will go down.

Ruqqus had this issue too. Every time there was a mass exodus from Reddit, Ruqqus would go down, and hardly reap the rewards.

Even if it's not sustainable, just for one month, I'd like to see Lemmy.ml drastically boost their server power. If we can raise money as a community, what kind of server could we get for 100$? 500$? 1,000$?

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 68 points 1 year ago (1 children)

It's a single server, Michael. What could it cost, $10?

[–] [email protected] 21 points 1 year ago (1 children)

I'd donate 500$ for one month of high cores/RAM to brace the hug

[–] [email protected] 18 points 1 year ago (1 children)
[–] [email protected] 17 points 1 year ago

Already donated some, but admins said they're not gonna upgrade servers for it

[–] [email protected] 61 points 1 year ago (9 children)

The site currently runs on the biggest VPS which is available on OVH. Upgrading further would probably require migrating to a dedicated server, which would mean some downtime. Im not sure if its worth the trouble, anyway the site will go down sooner or later if millions of Reddit users try to join.

[–] [email protected] 36 points 1 year ago (3 children)
8 vCore
32 GB RAM

😬

2 follow-ups:

  • Can we replace Lemmy.ml with Join-lemmy.org when Lemmy.ml is overloaded/down?
  • Does LemmyNet have any plans on being Kubernetes (or similar horizontal scaling techniques) compatible?
[–] [email protected] 20 points 1 year ago (1 children)

Maybe some dns fail-over for lemmy.ml to point to join-lemmy.org might be cool indeed 🤔

load more comments (1 replies)
[–] [email protected] 14 points 1 year ago

We need Self hosted team and team networking to represent. Would be amazing to see some community support in scaling Lemmy up.

[–] [email protected] 10 points 1 year ago (1 children)

Can we replace Lemmy.ml with Join-lemmy.org when Lemmy.ml is overloaded/down?

I dont think so, when the site is overloaded then clients cant reach it at all.

Does LemmyNet have any plans on being Kubernetes (or similar horizontal scaling techniques) compatible?

It should be compatible if someone sets it up.

[–] [email protected] 8 points 1 year ago (1 children)

You could configure something like a Cloudflare worker to throw up a page directing users elsewhere whenever healthchecks failed.

[–] [email protected] 18 points 1 year ago (6 children)

Then cloudflare would be able to spy on all the traffic so thats not an option.

load more comments (6 replies)
[–] [email protected] 28 points 1 year ago* (last edited 1 year ago) (1 children)

I'm sure you know this, but getting progressively larger servers is not the only way, why not scale horizontally?

I say this as someone with next to no idea how Lemmy works.

[–] [email protected] 43 points 1 year ago (1 children)

Its better to optimize the code so that all instances benefit.

[–] [email protected] 15 points 1 year ago* (last edited 1 year ago) (1 children)

Is it possible to make Lemmy (the system as a whole) able to be compatible with horizontally scaling instances? I don't see why an instance has to be confined to one server, and this would allow for very large instances that can scale to meet demand.

Edit: just seen your other comment https://lemmy.ml/comment/453391

[–] [email protected] 28 points 1 year ago (3 children)

It should be easy once websocket is removed. Sharded postgres and multiple instances of frontend/backend. Though I don't have any experience with this myself.

[–] [email protected] 12 points 1 year ago

I think that is unavoidable, Look at the most popular subreddits , they can get something like 80 million upvotes and 66K comments per day, do you think a single server can handle that?

Splitting communities just so that it will be easier technically is not good UX.

[–] [email protected] 12 points 1 year ago

@nutomic @Lobstronomosity In one of the comments I thought I saw that the biggest CPU load was due to image resizing.

I think it might be easier to split the image resizer off to its own worker that can run independently on one (or more) external instances. Example: client uses API to get a temporary access token for upload, client uploads to one of many image resizers instead of the main API, image resizer sends output back the main API.

Then your main instance never sees the original image

[–] [email protected] 8 points 1 year ago (3 children)

There is already a docker image so that should not be too hard. I'd be happy to set something up, but (as others have said) the DB will hit a bottleneck relatively quickly.

I like the idea of splitting off the image processing.

load more comments (3 replies)
[–] [email protected] 27 points 1 year ago

There will either be an hour of downtime to migrate and grow or days of downtime to fizzle.

I love that there's an influx of volunteers, including SQL experts, to mitigate scaling issues for the entire fediverse but those improvements won't be ready in time. Things are overloading already and there's less than a week before things increase 1,000-fold, maybe more.

[–] [email protected] 13 points 1 year ago (3 children)

What's the current bottleneck?

[–] [email protected] 38 points 1 year ago (1 children)

SQL. We desperately need SQL experts. It's been just me for yeRs, and my SQL skills are pretty terrible.

load more comments (1 replies)
[–] [email protected] 23 points 1 year ago (5 children)

There are some SQL database optimisations being discussed right now and apparently the picture resizing on upload can be quite CPU heavy.

[–] [email protected] 40 points 1 year ago (2 children)

SQL dev here. Happy to help if you can point me in the direction of said conversation. My expertise is more in ETL processes for building DWs and migrating systems, but maybe I can help?

[–] veroxii 20 points 1 year ago (1 children)

I've been helping on the SQL github issue. And I think the biggest performance boost would be to separate the application and postgresql onto different servers. Maybe even use a hosted postgresql temporarily, so you can scale the db at the press of a button. The app itself appears to be negligible in terms of requirements (except the picture resizing - which can also be offloaded).

But running a dedicated db on a dedicated server - as close to the bare metal as possible give by far the best performance. And increase it for more connections. Our production database at my data analytics startup runs a postgresql instance on an i9 server with 16 cores, 128GB RAM, and a fast SSD. We have 50 connections set up, and the run pgbouncer to allow up to 500 connections to share those 50. And it seamlessly runs heavy reporting and dashboards for more than 500 business customers with billions of rows of data. And costs us less than US$200pm at https://www.tailormadeservers.com/.

[–] [email protected] 7 points 1 year ago

And I think the biggest performance boost would be to separate the application and postgresql onto different servers.

I think hexbear.net (an older lemmy fork-ed site) is working on this in conjunction with moving back to a modern lemmy version

load more comments (3 replies)
[–] [email protected] 6 points 1 year ago (1 children)

And may be the bandwidth. Serve thousands and thousands need at minimum 1gbps.

[–] [email protected] 10 points 1 year ago

Its mostly text so bandwidth shouldnt be a problem.

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago)

Is it running in a single docker container or is it spread out across multiple containers? Maybe with docker-machine or kubernetes with horizontal scaling, it could absorb users without issue - well, except maybe cost. OVH has managed kubernetes.

[–] [email protected] 6 points 1 year ago (2 children)

So reading this correctly, it's currently a hosting bill of 30 Euro a month?

[–] [email protected] 9 points 1 year ago* (last edited 1 year ago) (2 children)

No, thats the 8 GB memory option... if its the biggest, it should be around 112 €. Meanwhile i keep wondering if i should let Lemmy stay on the current KVM (which is similarely specked but with dedicated cores and stuff) or if it is better to move it to one of my dedis just in case... well... will see xD

[–] [email protected] 6 points 1 year ago (16 children)

Its the one for 30 euros, Im not seeing any vps for 112. Maybe thats a different type of vps?

load more comments (16 replies)
load more comments (1 replies)
load more comments (1 replies)
load more comments (3 replies)
[–] [email protected] 43 points 1 year ago (1 children)

I'm a Reddit refugee (new number who dis?)

I'm in the processing of closing on a house/moving so i don't have a ton of extra money or time laying around, but I work in tech as a junior Linux admin with some experience with some big data tech (HDFS, some Spark, Python, etc).

How can I help?

[–] [email protected] 13 points 1 year ago (2 children)

Good question. Seeing as your set of skills don't quite align with Lemmy's core componentes (Rust backend and Inferno frontend), your best bet would probably be on helping new people settle in, improving documentation, translations, discussing new ideas (like for onboarding), etc.

Any form of help is highly appreciated!

load more comments (2 replies)
[–] [email protected] 29 points 1 year ago* (last edited 1 year ago) (1 children)

Based on looking at the code and the relatively small size of the data, I think there may be fundamental scaling issues with the site architecture. Software development may be far more critical than hardware at this point.

[–] [email protected] 15 points 1 year ago (1 children)

What are you seeing in the code that makes it hard do scale horizontally? I've never looked at Lemmy before, but I've done the steps of (monolithic app) -> docker -> make app stateless -> Kubernetes before and as a user, I don't necessarily see the complexity (not saying it's not there, but wondering what specifically in the site architecture prevents this transition)

[–] [email protected] 50 points 1 year ago* (last edited 1 year ago) (2 children)

Right now it looks to me like Lemmy is built all around live real-time data queries of the SQL database. This may work when there are 100 postings a day and an active posting gets 80 comments... but it likely doesn't scale very well. You tend to have to evolve to a queue system where things like comments and votes are merged into the main database in more of a batch process (Reddit does this, you will see on their status page that comments and votes have different uptime tracking than the main website).

On the output side, it seems ideal to have all data live and up to the very instant, but it can fall over under load surges (which may be a popular topic, not just an influx from the decline of Twitter or Reddit). To scale, you tend to have to make some compromises and reuse output. Some kind of intermediate layer such as every 10 seconds only regenerate the output page if there has been a new write (vote or comment change).

don’t necessarily see the complexity (not saying it’s not there

It's the lack of complexity that's kind of the problem. Doing direct SQL queries gets you the latest data, but it becomes a big bottleneck. Again, what might have seemed to work fine when there were only 5000 postings and 100,000 total comments in the database can start to seriously fall over when you have reached the point of accumulating 1000 times that.

[–] [email protected] 8 points 1 year ago (2 children)

Out of curiosity how would https://kbin.social/ source: https://codeberg.org/Kbin/kbin-core stand up to this kind of analysis? Is it better placed to scale?

[–] [email protected] 8 points 1 year ago (5 children)

The advantage kbin has is that it is build on a pretty well known and tested php Symphony stack. In theory Lemmy is faster due to being built in Rust, but it is much more home-grown and not as optimized yet.

That said, kbin is also still a pretty new project that hasn't seen much actual load, so likely some dragons linger in its codebase as well.

load more comments (5 replies)
load more comments (1 replies)
load more comments (1 replies)
[–] [email protected] 22 points 1 year ago (1 children)

I'm also willing to donate to other instances too - Beehaw, Sopuli, Lemmygrad, Lemmyone - Anything so we can have better shock absorption. If you run one of those instances, please reply and let us know how much you think you need

[–] ruud 24 points 1 year ago (6 children)

At the moment, I run lemmy.world using the funding of mastodon.world. If Lemmy.world might grow and need a dedicated server, I'll try to raise funds for it separately (or create a larger .world fundraiser as I have other instances as well)

[–] Mac 12 points 1 year ago* (last edited 1 year ago) (1 children)

What if a bunch of groups from the Fediverse hosted a huge fundraiser and distributed the funds to where they were needed? Maybe even kept a bank of funds for when large, temporary influxes of funding are needed.

Also, hi! Thanks for hosting!

load more comments (1 replies)
load more comments (5 replies)
[–] [email protected] 12 points 1 year ago (1 children)

This is why I also subscribe to the communities on mastodon just in case

[–] [email protected] 10 points 1 year ago (4 children)

can you interact with mastodon on here? sorry if it's a stupid question, i am new to the whole fediverse thing.

[–] [email protected] 15 points 1 year ago (3 children)

Yes you can :) There are no stupid question, we're not accostumed to these kind of structures for social networks so it's very normal to have them. I can suggest some video like this to understand better how federation works

load more comments (3 replies)
[–] [email protected] 8 points 1 year ago

Currently, I believe Mastodon/Misskey/Calckey/Akkoma/Friendica users can post and reply to Lemmy groups/communities. There doesn't seem to be a way to follow them from Lemmy, though.

I think you might be able to follow Friendica groups, though.

And kbin and Lemmy have a lot of interoperability.

load more comments (2 replies)
load more comments
view more: next ›