pmjoe

pmjoe

Elixir suitable for building a API gateway?

Is Elixir suitable for building a API gateway like Kong? The main driver is the latency, throughput can be archived with more machines, but latency don’t.

The server should have a very low latency, be stable and support plugins. I’m very inclined to use Go because it’s fast and easy. But i don’t know if i can have the same stability guarantees from Elixir.

Most Liked

NobbZ

NobbZ

Go gives you nothing near to the stability guarantees that a properly built elixir application gives you. Supervision trees are totally rocking.

I can’t say anything about response time comparison in both, since those really depends on how well the application is crafted, not that much the language.

I can tell though that the go runtime stops the world for garbage collection, while the BEAM does garbage collection on a per process base.

gon782

gon782

I would add Inspectability to that list. The amount of tooling you have out of the box to inspect a single process is far beyond what Go can give you. For any one of those multiplayer game rooms, chat rooms, what have you, you can open up observer and see exactly what the internal state is, in order to debug it (or just for shits and giggles).

Go doesn’t have a way to refer to single threads via a general identifier, much less a non-intrusive (or any) way to see what the internal state of a thread is. To inspect the state of something, you’ll have to actually make that whole business yourself, which will just be another point of failure for you. observer will tell you exactly what’s there and how it relates to the other processes in the process tree.

Qqwy

Qqwy

TypeCheck Core Team

An Elixir application will probably respond a lot better than a Go application when put under increased load.

Of course, what exactly happens in real life is something you can only find out by extensive benchmarking. I find the claim ‘in practice, Go has better latency’ very sketchy. It’s a nice benchmark that you linked to, but in real life, an application also performs some work besides immediately returning a response to a request. (Which this benchmark does not do)

That said, Elixir is definitely better than Go when talking about:

  • Stability. Even if Go becomes pre-emptive, it can by no means claim the same fault-tolerancy as Elixir does unless it will also start to work with the Actor Model. Also, Distributed Erlang (and the newer Swarm and Partisan) are absolutely amazing tools to manage multi-server scalability and fault tolerancy.
  • Hot-code reloading. AFAIK, Go is compiled and does not allow you to do this. Especially when you might want to include streaming features in your API, this is the difference between all in-progress API requests being broken or being able to continue along.
  • Stateful APIs. The ability to spin up GenServers that manage every need fo your user(s) in a specific context are conceptually really easy to understand, and are a lot faster than writing everything to a database in-between requests. This makes Elixir really well-suited for e.g. multiplayer games, communication platforms, etc.
StefanHoutzager

StefanHoutzager

There are already api gateways built in elixir. See https://github.com/Accenture/reactive-interaction-gateway https://accenture.github.io/blog/2017/11/09/introducing-rig.html https://www.youtube.com/watch?v=wNF51mmnsMo
I’m reading a bit about api gateways because my new customer works wit microservices and uses a gateway.

Where Next?

Popular in Questions Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement