Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Discord: A case study in performance optimization (fullstack.zip)
71 points by tylerdane 17 hours ago | hide | past | favorite | 43 comments
 help



I find it funny that backend devs will do all this infrastructure work to support billions of real time messages and then frontend devs stomp all over it by making the app take 500MB of RAM and hundreds of ms to take basic actions.

I agree with you that we should care more about resource usage, but it's a false comparison. Backend devs control where their code runs, frontend devs don't.

You can make more precise decisions when you have complete control over the environment. When you don't, you have to make trade-offs. In this case, universality (electron and javascript) for higher RAM usage. It doesn't seem to have slowed Discord's adoption rate.

Even if they built their desktops apps in native code and UI, they'd have to build a JS website in parallel.


> Backend devs control where their code runs, frontend devs don't.

This has nothing to do wih the fact that Discord is a bloated, slow monstrosity.

> Even if they built their desktops apps in native code and UI, they'd have to build a JS website in parallel.

Oh no. The impossibility of building a site that displays text and images


It's a fair point. I think loss-aversion over React (Native) is to blame.

Their current client stack is: Web: React Desktop: React + Electron Mobile: React Native + Native

Their commitment to React on so many platforms makes it easy to accumulate bloat. Their need to support lower-level features means they can't avoid native code altogether.

I wonder why they stick with it.

My guess is they don't want to add more hires just for this problem

Their 2018 commitment to RN: https://discord.com/blog/why-discord-is-sticking-with-react-...

Their 2025 complications with it: https://discord.com/blog/supercharging-discord-mobile-our-jo...


One runs on machines we pay for (= costs us money). Another runs on end users' machines (= costs them money).

You can pay to have better/more machines, while you can't do the same with your clients

But it affects user experience.

Backend performance issues can grind your system to a halt. It’s basically a requirement for Discord to work reliably.

Front-end performance is not a hard requirement for most end users, unless the app is actually unusable. Discord isn’t that bad compared to some software I’ve used. You have to get beach balls on startup and complete UI freezes for people to really care. If it’s good enough for most people, shaving some MB off the memory usage or small number of ms off latency isn’t important to the business


As long as negative experience doesn’t meaningfully impact user monetization, there’s no business incentive for that type of company to care.

Given how intelligent people are, I would not be surprised if this is by choice. They probably don't want poor pleba using their software anyway, just those with money to spare

Devs are probably running high end MBPs and don't get to experience the frontend on a potato

You can't buy client performance, so it is just more visible. It's not like there are a lot of people with Rust/C++ back ends outside of some very critical pieces.

Sure you can, you hire people to improve it

Well, no wonder everyone ships websites.

The average Discord user does not care.

Honest question, does anyone appreciate these “case studies”? It seems like they’re always based on some random quote and they go way in detail on what the various technologies are and how they might possibly apply to the subject in question, but with almost no real insight besides “I think this is how it might work”. What kind of case study is that?! If you don’t have real examples how is this better than just presenting the original source for the quote and Wikipedia links to the various technical terms?

>Honest question, does anyone appreciate these “case studies”?

I, for one, do not.

But great that we get into some guy's ideation about how Discord is possibly cool, while it's undergoing a major scandal related to ties to Peter Thiel's surveillance company, Palantir, in the botched rollout of age verification[1].

My personal guess is that appearance of articles that paint Discord in a positive light on this forum (and lack substance otherwise) is simply PR.

[1] https://kotaku.com/discord-palantir-peter-thiel-persona-age-...


I don't really think your comment is very relevant either, fwiw.

Their comment is supremely relevant. The timing is not a coincidence and it tastes awful

You think this post was written because of the Discord stuff in the news?

>I don't really think your comment is very relevant either, fwiw.

Hmmm, really? Just mentioning the biggest thing in the news involving Discord right now isn't relevant to a post about Discord, huh?

What can I say, you have a peculiar definition of relevance.


Yes, because the post isn’t about Discord. Hacker News always devalues generic comments like those.

Whenever I read about these web startup architectures I notice there is never a baseline comparison. They start with an insane architecture and then do heroics to transform it into something a little better.

If you have a fast cgi service inserting a text message into a Postgres database, how many messages do you need until that doesn’t work?


Couldn't they focus some of their creativity on making the UI look less like the inside of a middle schooler's brain?

In what ways does it look that way, if you recall?

I hear this semi-often, but I don't really get it. The base UI of Discord is pretty normal / looks just like every other chat app out there. Is it the ads for nitro and stuff like that were the issue?


I think the base UI of Discord is fine, but having used it for almost a decade at this point, the UI has gotten worse. Besides the ads you've mentioned, they've added a lot more clutter (random icons, rarely used features, hidden menus, etc.). When I look at screenshots from 2019, I weep.

There's a bit of clutter for sure, but I don't find it too objectionable. As the sibling comment mentioned, the super reacts are really annoying, and so are the ads, but it's overall alright.

Animated server logos, colorful /gradient and tonally-varied usernames & avatars, the super emoji or whatever they're called, etc all feel like they're pushing more towards Twitch chat than anything else. Which as another commenter remarked, is essentially aligned with their original and biggest target demographic.

I like those things tbh. A lot of it helps make things more visually interesting, and other users more distinctive.

> Animated server logos, colorful /gradient and tonally-varied usernames & avatars

Fair, but all of these things are user controlled. If you're using Discord for work or something, presumably you don't have a bright flashing animated server icon and avatar, your server doesn't have gradient roles, etc.

The super emoji are spot on though, those are fun but were really dumb from the get-go, and waste space in the reaction UI.


It’s also their method of making money which is locking cosmetics behind subscription or purchases.

Other option would be to limit core features for non paying users.


Why would they make their UI less familiar to their target audience?

The problem is that a lot of people who are not part of that target audience have to suffer that UI to get work done.

You’re choosing the gaming chat for your work though

I am not; I did not create the communities I am a member of. Dozens of them; none about gaming.

It's the one that works.

Discord is honestly not great for work, but there are lots of other tools. I think they should focus on what’s made them successful, which is gamers and communities.

They should realize charging people $100/year per person for Nitro and $500/year for server boosts means that they don’t want to be advertised to and have their data stolen.

> suffer

Really? :/


Except they, or more precisely speaking -- RGB keyboard/computer case buyers-- are their target audience, low IQ high spenders

What's underappreciated in Discord's story is how much their migration choices were driven by operational pain rather than pure performance benchmarks.

The Cassandra → ScyllaDB move is a good example. Cassandra's GC pauses were causing p99 latency spikes that made the real-time experience feel broken — messages arriving out of order, typing indicators lagging. ScyllaDB's shard-per-core architecture eliminated GC entirely. The performance gains were dramatic but the real win was predictability.

I'm building a real-time chat product myself (WebSocket-based, Go backend) and the lesson I keep learning from Discord's architecture posts is: at scale, tail latency matters more than throughput. You can handle 10x the messages per second but if your p99 spikes to 500ms during GC, users notice immediately. Chat is one of those domains where humans are incredibly sensitive to delays — even 200ms feels "off."

The Rust migration for their read states service is similarly telling. They didn't rewrite everything in Rust — they picked the single hottest service and rewrote just that. Targeted optimization over wholesale rewrites. That's a pattern more teams should follow.


Cool article :)

Don't let them fool you

Discord, especially the mobile app, is some of the shittiest, broken software I have encountered. The core protection team is absolute trash at their job




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: