A few weeks ago I attended a Ruby meetup that was set up as a Q&A session with a panel of speakers. One of the questions asked was, and I paraphrase: Given a Ruby audience, what are the next set of technologies that you are looking into? The answer: Elixir and Phoenix, unanimously. The panel was interesting enough that this piqued my curiosity leading me to a Google click-fest. Elixir is a language, and Phoenix is a web development framework for Elixir. Here are some interesting facts I learned about Elixir:
It compiles into Erlang’s VM, BEAM. A most attractive quality. A bit of background on Erlang: Ericsson developed it as a fault tolerant, highly concurrent system for their phone switches.
In BEAM, control flows using process-like units. What is a process-like unit, you ask? It’s not an OS process or thread. Rather the BEAM VM has its own conceptual processes. This results in a cheaper, more efficient context switch strategy, giving it a competitive advantage over Java or C#, where each language process equates to an OS process.
BEAM processes operate as memory-independent entities, yielding only when explicitly instructed or when experiencing a block i.e. a cooperative threading approach. Moreover, BEAM VM processes have dynamically allocated stacks, which makes it possible to spawn millions of processes without choking the RAM. Such characteristics pose Elixir as a language where concurrency is built into it.
The fact that each process has its own memory stack sets the stage for a fault-tolerant system. A failure in a single process will not bring down the whole system, or another process for that matter e.g. If a child process produces an exception, its parent will not die since they have independent memory stacks. Elixir does provide the flexibility to propagate errors through processes - the way you do that is by linking them.
One of the early criticisms with Erlang has been that it comes with a high learning curve. Elixir is trying to fix that and more. The Elixir syntax is similar to Ruby. However, Elixir is a functional language characterized by immutability of objects, and referential transparency, amongst others. Elixir's macro system comes well appreciated.
Personally, I haven’t begun to work in Elixir, but after researching a bit and seeing what the BEAM VM is capable of, I’m excited to dive in and try the language out. One of the coolest facts that surfaced was that Whatsapp uses Erlang for their core messaging system. Old phone systems are today’s messaging services, everything clicks. On their best day, Whatsapp processed 64 Billion messages. A few years ago, at my previous company Zynga, we had achieved over 1 billion message exchanges through all games. I thought that was rad ;)