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

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
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
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
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New

Other popular topics Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
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
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
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement