Мы в Telegram
Добавить новость
Новости сегодня

Новости от TheMoneytizer

Storing trillions of your Discord messages is waaaaay harder than you thought

 Storing trillions of your Discord messages is waaaaay harder than you thought

Keeping in touch is complicated, OK?

On big public Discord servers, most of the the displayed messages are recent and cached which is good for performance. But smaller servers used by just a few friends can often involve old messages that aren't cached being displayed or read from the database every time a user logs in.

According to numbers from 2019, Discord handled 25 billion messages per month.

The specifics of the company's struggles have been outlined in forensic detail in a blog by Discord's Bo Ingram, a senior software engineer for the platform. 

On big public Discord servers, most of the the displayed messages are recent and cached, which is good for performance. But smaller servers used by just a few friends can often involve old messages that aren't cached being displayed or read from the database every time a user logs in.

According to numbers from 2019, Discord handled something like 25 billion messages per month, 850 million every day, and 600,000 per minute. You can expect those numbers to be even bigger now.

Discord started off using the MongoDB database to support this activity, but then moved to Cassandra. Its appeal was as a NoSQL database that had support for clustering, which means you can have multiple instances of a given database working as one to improve performance.

Both Apple and Netflix, among other big tech companies, both reportedly use Cassandra. So, it's got proper blue chip cred. Surely it's good enough for Discord? Initially, yes. Once Discord had ironed out a few issues, the Cassandra databases were writing new messages within one millisecond and read back old messages to users in five milliseconds. Quick enough for your typical text chat, that's for sure.

But the good times didn't last. Discord now has something in the region of 150 monthly active users. By early 2022, Discord was running 177 Cassandra nodes storing trillions of messages.

The result was hotspots within the database when users interacted with Discord servers in certain patterns. The upshot is latency as the server falls ever further behind with user queries—in other words, users sending and reading text messages.

Discord DB

The NoSQL bone is connected to the Channel ID bone. (Image credit: Discord)

The way that Cassandra marks data for deletion before eventually removing it via garbage collection routines also added dramatically to latency when reading messages. In really rough layman's terms, the tombstones marking the location of data marked for eventual deletion slowed down the process of getting at actual live data for reading.

The solution for Discord is another extremely difficult migration to a new database, known as ScyllaDB. It has several advangtages, including being written in C++, which is much faster than the Java coding language used by Cassandra. It's also Cassandra-compatible and also deletes data directly rather than using a garbage collector.

Your next upgrade

(Image credit: Future)

Best CPU for gaming: The top chips from Intel and AMD
Best gaming motherboard: The right boards
Best graphics card: Your perfect pixel-pusher awaits
Best SSD for gaming: Get into the game ahead of the rest

Anyway, the switch over to ScyllaDB happened in May last year, and no doubt you didn't even notice when it happened. Which is a good thing. According to Bo, latencies are much improved compared to the tail end of the Cassandra implementation.

"It's been a quiet, well-behaved database (it's okay to say this because I'm not on-call this week). We're not having weekend-long firefights, nor are we juggling nodes in the cluster to attempt to preserve uptime. It's a much more efficient database—we're going from running 177 Cassandra nodes to just 72 ScyllaDB nodes," he says.

"Our tail latencies have also improved drastically. For example, fetching historical messages had a p99 of between 40-125ms on Cassandra, with ScyllaDB having a nice and chill 15ms p99 latency, and message insert performance going from 5-70ms p99 on Cassandra, to a steady 5ms p99 on ScyllaDB."

So, there you have it, the slightly-more-complicated-than-you-might-have-thought story of how to keep a message service from collapsing under the weight of millions of users. You can read about it all in much more detail over on the official Discord blog.

Читайте на 123ru.net


Новости 24/7 DirectAdvert - доход для вашего сайта



Частные объявления в Вашем городе, в Вашем регионе и в России



Smi24.net — ежеминутные новости с ежедневным архивом. Только у нас — все главные новости дня без политической цензуры. "123 Новости" — абсолютно все точки зрения, трезвая аналитика, цивилизованные споры и обсуждения без взаимных обвинений и оскорблений. Помните, что не у всех точка зрения совпадает с Вашей. Уважайте мнение других, даже если Вы отстаиваете свой взгляд и свою позицию. Smi24.net — облегчённая версия старейшего обозревателя новостей 123ru.net. Мы не навязываем Вам своё видение, мы даём Вам срез событий дня без цензуры и без купюр. Новости, какие они есть —онлайн с поминутным архивом по всем городам и регионам России, Украины, Белоруссии и Абхазии. Smi24.net — живые новости в живом эфире! Быстрый поиск от Smi24.net — это не только возможность первым узнать, но и преимущество сообщить срочные новости мгновенно на любом языке мира и быть услышанным тут же. В любую минуту Вы можете добавить свою новость - здесь.




Новости от наших партнёров в Вашем городе

Ria.city

В Москве и Петербурге вырастут штрафы за неоплаченный проезд по платным дорогам

МГУ восьмой раз подряд вошел в топ-100 лучших университетов мира по версии QS

Актер Зулькарнаев выступит со стихами на фестивале «Арт-пикник. Проект: Поэт»

Москва, Пекин и Тегеран заявили о поддержке восстановления ядерной сделки

Музыкальные новости

Концерт в музее им. П.И. Чайковского

«Роза Хутор» теперь тоже в метавселенной

На телеканале «Культура» рассказали о предстоящей премьере оперы «Борис Годунов»

В Туле наградили победителей межрегиональных соревнований по эстетической гимнастике "Кубок Роксэт"

Новости России

Мигранта-транссексуала выдворили из России за пропаганду ЛГБТ

Дело не в дороге: с какими проблемами чаще всего сталкиваются автотуристы

Золото партии. Дети Жириновского пошли в суд из-за наследства

В Москве и Петербурге вырастут штрафы за неоплаченный проезд по платным дорогам

Экология в России и мире

Befree запускает сайт для поиска талантов

3 детские зубные щетки "Ревилайн" по цене 2 в магазине "Ирригатор.ру" ко Дню защиты детей

Студия Звукозаписи в Москве. Создание Песен, Музыки, Аранжировок.

Россияне решили этим летом меньше отдыхать на курортах

Спорт в России и мире

Потапова о поражении от Свентек на "Ролан Гаррос": организм дал сбой

Ролан Гаррос. Расписание 2 июня. Потапова и Швентек сыграют первым запуском, Синнер – последним

Теннисист Джокович побил рекорд Федерера по победам на турнирах "Большого шлема"

Елена Рыбакина добилась впечатляющего достижения

Moscow.media

В этом году обновят 35 км трассы Р-255 Сибирь в Тайшетском и Нижнеудинском районах Приангарья

Водитель "Лифана" погибла после аварии с фурой

Завершен пятый этап надвижки моста через Каму

Два дня, наполненных театром, музыкой, книгами и наукой, — в Парке Горького во 2-й раз прошел Московский детский фестиваль искусств «НЕБО»







Топ новостей на этот час

Rss.plus





СМИ24.net — правдивые новости, непрерывно 24/7 на русском языке с ежеминутным обновлением *