Is Elixir able to power a social network messaging system with the same user volume as FB, Telegram or Whatsapp?
Well considering WhatsApp is written in erlang it would certainly be doable in elixir as well, elixir and Erlang have nearly identical characteristics being based on the same VM.
Elixir is amazing but Telegram has like 30 million people in it now and since Elixir isnât exactly performance-oriented I am not sure it can handle the load without spinning a lot more servers which might not be economically viable.
At this scale you definitely should reach to something like Kafka + Rust.
Are you sure Elixir can perform equally to Erlang in those use cases? I am tempted to go with Erlang to be safe, but wanted to get a more definitive answer before deciding not to use Elixir.
Throw enough hardware at it, and sure, no problem. You might need to pull some fancy tricks to be able to take advantage of that hardware efficiently, but that sort of thing is actually one of the things that Elixir is good at, leveraging Erlangâs distributed processing, supervision trees for reliability, and so on. It might need more hardware than something programmed in raw Assembly, but probably quite a lot less than something stood up in, say, Rails.
Is Elixir or Erlang a better choice to run in this use case and why??
It is possible to write bad elixir, just as it is possible to write bad Erlang. But all the tools that Erlang gives you are also available in elixir, so you can definitely use elixir to write anything you could write in erlang.
Is there ANYTHING that would prevent Elixir from performing (this use case) as well as Erlang?
They both compile to BEAM bytecode, and Elixir essentially evaluates to the same Erlang code, so no.
You mention Telegram, Whatsapp or FB as example of scale. Discord is using Elixir and itâs massive.
No, not really. They compile to a very similar (or exactly the same) internal bytecode. Erlang IMO has no innate advantage here. Thatâs the whole point of the BEAM bytecode if your compiler is good (and Elixirâs is) then you can have an identically performing code no matter the source language.
I might even be so bold to say that if youâre building a commercial product on the BEAM you should probably pick elixir by default. Before any erlangers get mad at me let me defend myself. The reason is that itâs easy to use Erlang (or any other BEAM language) library from Elixir, but itâs harder or impossible to use a lot of very good libraries like Phoenix and ecto from Erlang due to elixirâs macro system. If youâre building something open source it might make sense to pick Erlang by default to attract the widest audience (see telemetry as an example). This is the elixir forum so I am of course biased, take this with a grain of salt.
Hi John - Can you clarify which you think would be better to use when you say âyou should probably pick elixir by defaultâ and âit might make sense to pick Erlang by defaultâ. Donât worry about hurting feelings. I am interested in the raw truth of which would be best in this use case.
Itâs the same, but not with the same abstraction, and not the same syntax, but with the same BEAM and bytecode.
For apps and internal / closed-source libraries.
For open-source libraries â if you want all BEAM languages (Erlang, Elixir, LFE, Alpaca etc.) to have access to it.
This question is for a project that is not open source.
Messaging services is in the BEAMs sweetspot and I am pretty sure it would do well compared to any other language.
Whatsapp is famously known for running a global service with relatively few engineers and servers. They claim erlang is a big part of their success. In terms of erlang vs elixir I donât see any difference in performance at this level.
Iâm from Ecuador. In 2010-2011, in about three months, everyone got the urge to acquire an smartphone, mostly because everyone else was using Whatsapp. After getting to know Elixir, many years later, I finally understood it wasnât because having Whatsapp meant âfree messagesâ or because youâd get a touch screen; this sudden phenomena happened simply because Whatsapp never broke. You could lose your connection, but youâd get your messages back; a single conversation could misfire, but âthe systemâ was always on; it didnât matter if you were 4000 mts high or in a little village in the jungle: you could rely on it. You could rely on it more than in SMSs. This same thing happened worldwide. There were obviously brilliant people involved, but I do believe a lot of Whatsappâs success is due to Erlang.
(I assume both references pop up frequently, but theyâre quite interesting anyway)
Why WhatsApp Only Needs 50 Engineers for Its 900M Users
Erlang Factory 2014 - Thatâs âBillionâ with a âBâ: Scaling to the Next Level at WhatsApp
https://www.youtube.com/watch?v=c12cYAUTXXs
fb is a different thing and I personally think we shouldnât try to repeat in any language
As for this
you should probably pick elixir by default
I donât program Elixir professionally but I would choose Elixir just because of these
- Elixir has powerful macro system that Erlang doesnât have and it can really make a difference.
- Itâs easy to call Erlang libraries from Elixir but not as easy other way around. (There might be some new developments in this area that I donât know of)
- Elixir is more popular than Erlang so itâs easier to find solutions when problems arise.
- This is bit personal but Erlang is bit off putting because it looks so different from most other programming language that are popular now. For me it was just so much easier to learn Elixir because it is so much more readable. I think this will help a lot when hiring new people.
- Bit personal as well but I really like that Elixir has variable rebinding.
Erlang has macro system too, but different.
The |> pipe operator is also a nice addition from Elixir