I know that Lemmy is open source and it can only get better from here on out, but I do wonder if any experts can weigh in whether the foundation is well written? Or are we building on top of 4 years worth of tech debt?

39 points

It’s decent, but it isn’t scalable, at least not yet.

Right now the entire Lemmy backend is one big “monolith”. One app does everything from logins and signups to posting and commenting. This makes it a little harder to scale, and I wouldn’t be surprised to see it split out into multiple micro services sooner rather than later so some of the bigger instances can scale better.

I’d love to know where the higher level dev stuff is being discussed and if they’ve made a decision on why or why not microservices.

permalink
report
reply
38 points

There’s no reason that a monolith can’t scale. In fact you scale a monolith the same way you scale micro services.

The real reason to use micro services is because you can have individual teams own a small set of services. Lemmy isn’t built by a huge corporation though so that doesn’t really make sense.

permalink
report
parent
reply
7 points

You definitely can’t scale a monolith the same way you can scale a micro service

permalink
report
parent
reply
1 point

You can easily scale a monolith. You typically horizontally replicate any web server (monolith or not) to handle whatever traffic you’re getting. It shouldn’t really matter what type of traffic it is. Plenty of the world’s biggest websites run monoliths in production. You know how people used to say “rails doesn’t scale”? Well they were wrong because Rails monoliths are behind some huge companies like GitHub and Shopify.

The lemmy backend is also quite lightweight and parallel so it’s cheap and effective to replicate.

In my professional experience microservices are usually a dumpster fire from both the dev perspective and an ops perspective (I’m a Site Reliability Engineer).

permalink
report
parent
reply
19 points

I disagree that it being a monolith is immediately a problem, but also

In fact you scale a monolith the same way you scale micro services.

This is just not true. With microservices, it is easy to scale out individual services to multiple instances as demand requires them. Hosting a fleet of entire Lemmy instances is far more expensive than just small slices of it that may require the additional processing power.

permalink
report
parent
reply
0 points
*

Lemmy’s backend is native code, not run in a virtual machine or interpreted from text. You’re not going to pay much extra for an extra megabyte or 10 of RAM being used per instance for the extra code sitting idle. It certainly shouldn’t use much processing power when not in use.

permalink
report
parent
reply
11 points

What microservices would you split Lemmy into? The database, image hosting and the UI are already separate.

permalink
report
parent
reply
1 point

You can easily scale a monolith. You typically horizontally replicate any web server (monolith or not) to handle whatever traffic you’re getting. It shouldn’t really matter what type of traffic it is. Plenty of the world’s biggest websites run monoliths in production. You know how people used to say “rails doesn’t scale”? Well they were wrong because Rails monoliths are behind some huge companies like GitHub and Shopify.

The lemmy backend is also quite lightweight and parallel so it’s cheap and effective to replicate.

In my professional experience microservices are usually a dumpster fire from both the dev perspective and an ops perspective (I’m a Site Reliability Engineer).

permalink
report
parent
reply

Microservices aren’t a silver bullet. There’s likely quite a lot that can be done until we need to split some parts out, and once that happens I expect that federation would be the thing to split out as that’s one of the more “active” parts of the app compared to logins and whatnot.

permalink
report
parent
reply
5 points

Definitely not a silver bullet, but should stop the app from locking up when one thing gets overloaded. I’m sure they have their reasons for how it’s designed now and I’m probably missing something that would explain it all.

I’m still not familiar enough with how federation works to speak to how easy that would be. Unfortunately this has happened all as I’ve started moving and I haven’t gotten a chance to dive into code like id want to.

permalink
report
parent
reply
13 points

It’s also not the only solution for high-availability system. Multiple monoliths with load-balancing can be used as well.

Also, a lot of people are self-hosting. In this case, microservice won’t give them any scaling benefit.

permalink
report
parent
reply
18 points

Microservices can oftentimes cause more performance issue than they solve, as soon as they need to start talking to each other. Here’s someone with more experience than me explaining how it often goes wrong.

There’s nothing stopping you from putting a load balancer and running multiple instances of a monolith connected to one database. Then the database will also become a bottleneck, but that would still happen with microservices.

permalink
report
parent
reply
1 point

Exactly, and nothing prevent a monolith from doing vertical slicing at the database level as long as the monolith is not crossing its boundaries. This is the only scaling part that is inherent to microservices. If the issue is the horizontal scaling, microservices doesn’t solve anything in this case.

Also specifically on what I understand of the Fediverse, you want something easy to host and monitor since a lot of people will roll out their own instances which are known issues when running microservices.

permalink
report
parent
reply
3 points
*

This is a discussion I’m also interested in. Migrating a monolith to microservices is a big decision that can have serious performance, maintainability and development impact.

Microservices can be very complex and hard to maintain compared to a monolith. Just the deployment and monitoring could turn into a hassle for instance maintainers. Ease of deployment and maintenance is a big deal in a federated environment. Add too much complexity and people won’t want to be part of it.

I’ve seen some teams do hybrids. Like allowing the codebase to be a single artifact or allowing it to be broken by functionalities. That way people can deploy it the easy way or the performant way, as their needs change.

permalink
report
parent
reply
1 point

Gitlab is a great example of a piece of software that has multiple deployment strategies like that.

permalink
report
parent
reply
2 points

That’s what I’m thinking. Microservices could be a huge pain in the ass, but a hybrid approach would make things much better. Smaller instances wouldn’t be a problem, but the larger instances would be able to separate out components.

To keep it possible to run monolithicly would probably need a lot of work, but it’s possible to do and would probably be the best approach.

permalink
report
parent
reply
18 points
*

I have a friend that’s a lot more technical than me and he said that Lemmy’s codebase is kinda messy and relies on libraries that are still in beta and have not been tested well in the real world (since Rust is a relatively new language). This was a few months ago though, I’m not sure how much things changed since it’s been getting a lot more support and rewrote the front-end. The good news is it’ll get a lot better as more developers contribute to it.

I think a lot of people assume that because it’s written in Rust that means it has to be super stable but that really isn’t the case.

permalink
report
reply
1 point

Someone mentioned they had started out using websockets instead of http. I guess they’ve since migrated, but that design choice makes me wonder about the qualifications of the devs to make that kind of choice.

permalink
report
reply
3 points

Why’s that?

permalink
report
parent
reply
4 points
*

Web sockets are meant for applications where it’s important that you receive updates fast in a push fashion. E.g. collaborative editors like Google docs or a chat application. To scroll Lemmy or open a specific Lemmy post you don’t need that at all. You can just fetch the data once and have users refresh manually if for example they want to fetch the latest comments on a post. Using websockets for that type of application just puts unnecessary strain on the server.

permalink
report
parent
reply
5 points

They also originally thought they’d have it update in real time which was a bit of a mistake. When you’re running a small test instance it’s kinda neat if comments and posts pop up as they’re made, but the reality of that is a scroll jacking nightmare.

permalink
report
parent
reply
2 points
*

Maybe they wanted a different type of user experience. But yeha, maybe that’s something Reddit could pull off because of their infrastructure… And they don’t even do it because there’s not much user value to it.

Although reddit does use some websockets so you can see how many users are also seeing the post at the same time.

But not websockets for EVERYTHING.

permalink
report
parent
reply
10 points

Someone mentioned they had started out using websockets instead of http. I guess they’ve since migrated, but that design choice makes me wonder about the qualifications of the devs to make that kind of choice.

permalink
report
reply
19 points

Websocket was deprecated with 0.18.0 which is the latest official release, but a lot of instances are on the release candidate for 0.18.1. because of some major improvements. My login instance is on that one which is great for me because I’m using a desktop browser and it looks way nicer. A lot of fixes too.

Websocket is easier to implement so that’s probably why they started with it. It has heavy overhead and doesn’t scale well so that’s the down side. It wasn’t trivial for them to move to http. Websocket was probably a better starting point for them at the time, but they did realize its shortcomings and deprecate it in time to support growth. I don’t know if I’d hold that against them.

permalink
report
parent
reply
1 point

There is no documentation for the web API 😕

permalink
report
parent
reply
154 points

There are no good code bases, only less bad ones.

permalink
report
reply
20 points

Is Lemmy less bad or more bad than a typical open source project?

permalink
report
parent
reply
46 points

From some comments I’ve read, it’s at least in better shape than kbin? A few people expressed interest in helping with that project and then went running for the hills after reading through the code.

permalink
report
parent
reply
7 points

I read from one admin that a Lemmy instance is a lot easier to set up and maintain than a kbin instance. It’s initially more complicated to set up and updates are just a super headache to deal with. That sounds like a showstopper. I mean kbin is not going to get too far if it’s that difficult to run and maintain an instance, no matter how good or bad the code.

From a user perspective kbin has a really nice looking interface, though Lemmy has more features. I’d like to see kbin do well. It’s younger than Lemmy so it’s going to be behind, but hopefully the overhead in running an instance can be resolved.

permalink
report
parent
reply
9 points

That’s PHP for ya

permalink
report
parent
reply
49 points

It’s probably not the only reason, but Rust is a much more attractive language/platform for devs to work with than PHP. (Source: https://survey.stackoverflow.co/2023/#section-admired-and-desired-programming-scripting-and-markup-languages)

It’s also more scalable, because it’s a compiled multi-threaded technology, while PHP is interpreted and mono-threaded.

permalink
report
parent
reply
16 points

The best code base is the repo I just created and haven’t committed anything to.

permalink
report
parent
reply
13 points

Just clone this one. Guaranteed the best repo ever! https://github.com/kelseyhightower/nocode

permalink
report
parent
reply
5 points

Hey, my code base is fantastic if you ignore all the stuff I had to inherit, did in a time crunch, or didn’t understand what I was doing!

permalink
report
parent
reply
8 points

Wait, so the answer is, “it depends?” 🌎👨‍🚀🔫👨‍🚀

permalink
report
parent
reply
21 points

No the answer is that it is written in a modern language, is in its infancy and needs a lot of work to be really great, but it’s based on a certified protocol ActivityPub, that Mastodon and other “fediverse” systems use. It’s going to be really great, eventually.

permalink
report
parent
reply
6 points

“It depends” is a reference to an inside joke between developers. I agree with you that it could be really great, whether or not a code base is “good” or “bad” is just a complicated and highly subjective question to answer

permalink
report
parent
reply
5 points

Yup, code is bad, more code is worse. And unparseable specialist code is a technical debt.

permalink
report
parent
reply
48 points
*

The only valid measurement of code quality: WTFs/minute

permalink
report
parent
reply

No Stupid Questions

!nostupidquestions@lemmy.world

Create post

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others’ questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That’s it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it’s in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.

Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here.

Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

Community stats

  • 9.7K

    Monthly active users

  • 2.7K

    Posts

  • 107K

    Comments