Could Telegram, Whatsapp or FB run using Elixir?

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.

6 Likes

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

9 Likes

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.
3 Likes

Erlang has macro system too, but different.

The |> pipe operator is also a nice addition from Elixir :slight_smile:

2 Likes

As I said in my last post, for a commercial project elixir makes the most sense as you can use the widest variety of libraries. For an open source project Erlang makes the most sense as you can be used by the widest variety of users.

1 Like

I think it’s more like if you are making a open source library for Erlang ecosystem that doesn’t need other Elixir libraries or features then it might make more sense to use Erlang. For other kind of projects it doesn’t really matter. From what I understand Gleam language also has good interoperability story but that language might not yet be mature enough.

Well the reason I came to Elixir is because I want to use it to build a social network :003:

As many have said in the thread, WhatsApp is already powered by Erlang, and is a technological feat - you’ll see in the article linked to by @toronja that their app has 900M users and they did it with a team of just 50. That’s incredible - and goes to show that Elixir/Erlang will be able to get you to that sort of scale much easier and quicker than what might be possible in other systems.

With regards to Elixir or Erlang - Elixir runs on the Erlang VM, so all the power of Erlang is available to Elixir. The differences are in things like tools/libraries/frameworks etc. Erlang has frameworks like Zotonic, Nitrogen, Nova, Chicago Boss and Elixir has Phoenix (as the community has preferred to stick to one) so look at the syntax and tools of each and just go with which you prefer. Ultimately, in my eyes, we’re all Erlangers in some shape or form at the end of the day :023:

2 Likes

@alphanumeric If you’re interested in more detail about the similarity of BEAM byte code regardless of source language I did a presentation at Elixir Sydney that compares the BEAM byte code generated by an Elixir and Lisp Flavoured Erlang implementation of the Exercism ISBN verifier: ISBN Verifier Verily Verified - Robin Hilliard - YouTube. You can find out even more at my source for the presentation: GitHub - happi/theBeamBook: A description of the Erlang Runtime System ERTS and the virtual Machine BEAM..

4 Likes

If Elixir sits on top of Erlang, wouldnt that make Elixir slower than erlang?

1 Like

Doesn’t sit on top, it runs on the same Virtual Machine, the BEAM.

Erlang code is compiled to run on the BEAM and Elixir code is also compiled to run on the BEAM.

As already pointed out Discord it’s a good example of running Elixir at scale:

Now if at some point you need to squeeze more performance then you can call Rust from Elixir as Discord does nowadays for some bits of their app that are very performance sensitive:

4 Likes

If Elixir sits on top of Erlang, wouldnt that make Elixir slower than erlang?

No it won’t be slower it doesn’t sit “top” of Erlang it compiles to Erlang abstract format. Good comparison is TypeScript that compiles to JavaScript and TypeScript isn’t slower than JavaScript. You could also think it as similar to Kotlin for Java VM that compiles to same Java bytecode like Java itself does. Kotlin is not slower and can use Java libraries similar how Elixir can use Erlang libraries.

2 Likes

I didn’t understand this argument as WhatsApp has billion of users and server is written in Erlang ?

2 Likes

Any chat is a stupidly simple problem that is very hard to scale properly. The entirety of a chat system is: get a message, broadcast it to all participants. That’s it. Proper social networks like Facebook are more complex, of course. That said:

WhatsApp is built on Erlang. Erlang VM is what Elixir runs on, so yes, you can use Elixir for that.

Discord uses Elixir.

Facebook is C++, and PHP (most likely not a lot of it now), and at some time Erlang.

Instagram is Python.

EVE Online, one of the largest MMOs in the world, is Python.

Apple’s push notifications are Java.

Spotify is Java and Python.

Literally any language can be used to build what you need. Elixir/Erlang give you better basic building blocks than other languages, but you still need to know what to do.

2 Likes

I am aware and it’s a very classic that many people give to advocate for Erlang/Elixir – myself included. This is not bashing the BEAM.

I am simply assuming that from a certain scale and on the throughput might be a problem, that’s all.

Hi AstonJ, did you build the social networking app, yet? I’ve a similar idea to build an app for doctors appointment… I’m right now learning to work with absinthe but I’m stuck at authenticating an user on web and mobile app :frowning:

1 Like

@AstonJ We’re using Elixir to build an ethical social media ecosystem. Would love to chat sometime if you’re interested.

1 Like

Sorry for the delay in getting back to you both (thanks for the reminder @troo_co!)


@HappyBee - It is my long term project/goal :smiley: I quite like my life as it is and I’m only too aware how drastically that could change subject to a successful project in the space :lol: I have enough crazy ‘stalkers’ as it is and the sites I’ve run to date are tiny in comparison to the big SNs :043:

Seriously tho, I really value being able to have genuine interactions with everyday people and I’d hate being in a position where I’d have to second guess whether those interactions were sincere - but at the same time I feel like it’s something I must do (when I think about it it makes the hairs on the back of my neck stand up :icon_redface:) so it’s definitely something I aim to do but I am quite happy taking my time getting there. Good luck with yours and I look forward to hearing more about it on the forum!

@troo_co - thanks for thinking of me Michael (and the DM)! Your project sounds really cool! You might also want to check out SNs like @pleroma (Pleroma — a lightweight fediverse server) or @f0rest8’s SN Metamorphic :smiley: With regards to joining your team, as mentioned to HappyBee, I’m not quite ready to dive in to a big SN yet, but I will definitely keep a look out for yours :sunglasses: Thanks for thinking of me and good luck, I hope you keep us posted on the forum :023:

1 Like

More like 500 million :slight_smile: