Could Telegram, Whatsapp or FB run using Elixir?

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:

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

Why is that, actually? Which bits of this problem make it too hard for BEAM to handle? What are the limitations here?

1 Like

It’s mostly paranoia. You can use GenServer mailboxes for the same things just fine; however if a node falls down you’ll lose a lot of enqueued data. So using Kafka in particular is a way of saying “whatever makes it to our servers we want it enqueued and persisted AS SOON AS POSSIBLE and have super fast background workers that pick it up milliseconds later and process it”.

Why Rust? No particular reason to pick it over Elixir except if you want less nodes to manage in your k8s cluster (if you use k8s at all which you ideally should not). But Rust will definitely give you some performance advantage plus you can fine-tune it very well; e.g. “let’s have these 10 background workers and they’ll each be responsible for this or that Kafka partition”. But Elixir’s concurrency levels can be fine-tuned as well so no particular advantage here. Rust wins mostly on raw speed and very small memory footprint.

So my advice was mostly aimed at super high load servers where you can fine-tune your storage and code.

But if you don’t care about the above aspects then just using Elixir and utilize GenServer mailboxes will get you VERY far.

1 Like

Discord write its backned in Elixir with some help of Rust ( NIF ) for mutable data structure .

Facebook wrote whole messaging service in erlang before

Whatsapp and wechat work pretty great with very high clients numbers.

Elixir/Erlang ( Beam ) made for Communication.

Even you can write Twitter in Elixir/Erlang

But for Many tools around its like Machine learning and distributed processing or Analyzing data you 100% need another tools/language like Python, JVM based project ( Apache 
 ) or Scala ( Spark )

1 Like