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
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