rtj

rtj

Hello everyone
I would like to know which database you prefer for chat applications?
I do not know if traditional databases are preferable or maybe there is some other option that works well with Elixir / Phoenix?

I would appreciate it if you can share your experience.
In this case it will be a fairly complete and large chat app.

Thanks

Showing Posts 27 to 18

idi527

idi527

Then probably genserver + postgres will work fine.

rtj

rtj OP

Hello,
- how import is the chat history (if not at all I would just keep it in genserver)
The chat history is important ( Purchases are made by chat )

- how long to you want to save the history
The chat history will be stored for at least 6-12 months.

- how do you work the historical data afterwards (searching, scrolling)
Minimum, just to find some order, or some times open some chat history to check the order.

It will be a chat 1 to 1 ( agent to client or bot to client) and it is expected to have a high number of conversations at the same time

DianaOlympos

DianaOlympos

In general : Do Not Use Cassandra except if you have a really really good team of devs or a really really good team of Operators/SRE. And i would probably put a and here instead of a or if i could.

Cassandra seems nice from the outside, but it is really hard to operate and really hard to develop for, especially if you care about not losing data or getting acceptable time frame for answers.

voughtdq

voughtdq

Discord uses Elixir / Phoenix and switched from The Mongo to Cassandra. We don’t really know if they’re having good luck with it, but I think there is a high probability of that.

brightball

brightball

I’d tend to agree with this assessment.

Plus, you also need to think about how the data is related before you think about scaling strategies. With a Chat app every message in the system is basically grouped by “room”. Whether that room accounts for 2 people or a group of people depends on your interface.

When it comes to scaling it, this is a data structure that is very, very easy to shard because you can shard by “room”. All that’s required to make it work is to have a central point to act as a directory of which rooms is on which database and then you can query conversation from there.

What I’m getting at is just, don’t dive to deep into trying to find some ultimate database that can spread itself across hundreds of machines when your data naturally separates into manageable chunks. Those “spreading” solutions become necessary when the data doesn’t separate so easily.

jeramyRR

jeramyRR

All I’m saying is that there is no reason not to just start with Mnesia. If you grow to a point where you need more then switch at that time. Whatsapp was serving over 600 million users on Mnesia so it’s understandable that it started to become a pain point. If your service gets that big then you can afford to spend some time changing your storage options.

Mnesia requires little to no setup. It’s more important to get your product working and out there than spending time deciding which database to use.

marcuslankenau

marcuslankenau

And let the content push to S3 when chat is inactive for a couple of miniutes. And kick the genserver. When they start chatting again pull the history form S3 again.

idi527

idi527

a genserver per chat would be fine, I think.

marcuslankenau

marcuslankenau

I would think about the use cases you want to implement:

  • how import is the chat history (if not at all I would just keep it in genserver)
  • how long to you want to save the history
  • how do you work the historical data afterwards (searching, scrolling)
  • how big will the history get
  • how many users
  • how can you partition stuff (maybe there are groups that can be separated for easy charding)

When you know more about the use cases, the amount and the frequencies you can think about the technology.

If you want to get started quickly I would just use what you have, like postgresql and separate the storage from the core app. Then change to something more powerful when needed.

Marcus

idi527

idi527

I do like me some k8s and terraform from time to time …

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews