[erlang-questions] Erlang questions
Jesper Louis Andersen
Tue Mar 26 14:44:13 CET 2019
On Tue, Mar 26, 2019 at 5:42 AM joe mcguckin <joe@REDACTED> wrote:
> What’s the main difference between Erlang & Elixir? What web framework is
> popular with Erlang?
> Just as a toy app for learning a bit of both languages I want to
> implement a URL shortner.
Both Erlang and Elixir run on the same Bytecode engine, called BEAM. From a
language perspective they are much more alike than they are different. The
two main differences, as I see them, are that Elixir has some neat support
for protocols; a somewhat bastardized version of what one would call an
interface, and is also embracing macros to a much greater extent than
typical Erlang code.
As for web frameworks, the dominant one on Elixir is Phoenix. On the Erlang
side, there is Zotonic, and also n2o. At a lower level, one that could be
suitable for a simple URL shortener, you could just use a web server such
as cowboy directly. I want to stress these are just what I remember: there
are more frameworks out there for Erlang, so do a search.
Does a CPU with more cores tend to handle more of a load? If so, it seems
> to me that a multi-socket
> RYZEN platform ought to be a good choice.
More cores will not make a single process any faster. But if you have
multiple processes, which can all do work at the same time, the VM will
start using additional cores. If you have a RYZEN platform with multiple
sockets, 128 threads of execution is not that far fetched. You can utilize
this, provided you have 128 url shortening requests at the very same time
in your system.
> Also, I saw a talk given by someone from WhatApp and he mentioned that
> they had a lot of internal BEAM fixes
> for performance speedups. Does anyone know if those fixes have been merged
> back into the public sources?
Modern BEAM (OTP-21 and later versions) implemented a set of optimizations
which has made some of the older WhatsApp changes obsolete. WA still have a
set of unique optimizations though. Most notably a way to quickly empty a
queue and a way to push a message to the front of the queue. The latter
breaks the semantics of Erlang and the message order guarantees, but WA
uses it to check for progress in certain core processes, which makes sense.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions