11
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 15 Jun 2023
11 points (92.3% liked)
Programming
17314 readers
152 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
I would say that it's extremely unlikely.
Websites in general are never limited by raw code execution, they are mostly limited by IO. Be that disk IO as files are read and written, database IO as you need to execute complex queries to gather all the data to build the user timeline, and network IO to transfer data to and from the user. For decentralized social media like Kbin or Lemmy its even more IO limited as each instance needs to go back and forth to other instances to keep up-to-date data.
Websites usually benefit much more from caching and in-memory databases to keep frequently used data in fast storage.
This is why simple, high level, object oriented, garbage collected languages have become so common. All the CPU performance penalties they incur don't actually affect the website performance.
Not relevant to lemmy (yet), but this does break down a bit at very large scales. (Source: am infra eng at YouTube.)
System architecture (particularly storage) is certainly by far the largest contributor to web performance, but the language of choice and its execution environment can matter. It's not so important when it's the difference between using 51% and 50% of some server's CPU or serving requests in 101 vs 100 ms, but when it's the difference between running 5100 and 5000 servers or blocking threads for 101 vs 100 CPU-hours per second, you'll feel it.
Languages also build up cultures and ecosystems surrounding them that can lend themselves to certain architectural decisions that might not be beneficial. I think one of the major reasons they migrated the YouTube backend from Python to C++ isn't really anything to do with the core languages themselves, but the fact that existing C++ libraries tend to be way more optimized than their Python equivalents, so we wouldn't have to invest as much in developing more efficient libraries.
It is fairly relevant to lemmy as is. Quite a few instances have ram constraints and are hitting swap. Consider how much worse it would be in python.
Currently most of the issues are architectural and can be fixed with tweaking how certain things are done (i.e., image hosting on an object store instead of locally).
That’s correct. I wonder if YouTube still uses Python to this day (seems like they migrated to C++?)
Not saying there isn’t a difference in language performance, but for most world problems the architecture and algorithms matter more than the language for performance. Unless you’re in a very constrained environment such as lower end smartphones or embedded systems.
We do not.
In lemmy's case, my perusal of the DB didn't really suggest that the queries would be that complex and I suspect that moving it to a higher performance NoSQL DB might be possible, but I'd have to take a look at a few more queries to be sure.
I wonder if this could be made to work with Aerospike Community Edition...
Obviously it could be more effort than it's worth though.
There's no need to migrate the database, that shouldn't be an issue at this size. Caching should be implemented as another comment suggested.
Oh shit does lemmy not have response caching? Yeah, that's gonna be an issue pretty soon.
https://www.reddit.com/r/Lemmy/comments/14h965f/comment/jpdemet
Would you be so kind as to recommend some resources about caching? I've read the basics, but have yet to dive deep on it
The basic idea is to keep data as close to the processor as possible, so with a database that means storing the result of commonly used queries in memory.
Good resources.
Also this makes you think (assuming it’s true lol): https://www.reddit.com/r/Lemmy/comments/14h965f/comment/jpdemet