iainduncan

iainduncan

Using Elixir or Erlang as reverse proxy in front of other services?

I have a legacy over-coupled system (large!) that we are slowly breaking into a polyglot backend of cooperating services and I’m just exploring some options so this might be a dead end or not. Some parts of our app are great fits for elixir, and others we might leave alone (for now). In Python, one can split off parts from the main app with WSGI middleware, where the middleware almost acts like a proxy (I think plug is very similar in many respects). I’m wondering whether it might be feasible to do something similar for parts of the app across the two languages by having an Elixir layer act as the incoming request handler that either a) handles the whole thing and sends back the response or b) proxies on to the python app servers, which could take a while. So in case (b), the request connection could be open for a long time because we have some terrible db crap going on some of the time. I realize the proxying may add response time, but at the moment our response time is bad enough that this is likely the least of my worries. I expect that farming out what I can to Elixir will more than make up for this, though I would love to hear otherwise if I’m wrong.

Has anyone any experience with using either Elixir or Erlang apps in a similar pattern or with reverse proxying off them in general? Any tips or advice much appreciated.

Most Liked

idi527

idi527

I might be wrong, but I think going down the reverse-proxy-in-elixir path would require a non trivial amount of work that can be avoided – wouldn’t it be easier to have something like haproxy or aws load balancer do the proxying, and rewrite your pyhton app in elixir piece by piece? I worked with someone who was transitioning from ruby to elixir, and that was exactly what they did.

In the case you do decide to build this, maybe these projects and blog posts might help you

https://github.com/slogsdon/elixir-reverse-proxy

https://github.com/poteto/terraform

https://github.com/josevalim/proxy

https://github.com/KazuCocoa/http_proxy

https://github.com/houli/http-proxy

https://blog.fourk.io/replace-your-production-api-with-elixir-today-4426a8903642

Where Next?

Popular in Questions Top

siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
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
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
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
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement