I’m exploring the possibility of using Elixir/Phoenix as a HTTP proxy for a application that I’m building. The proxy don’t have much logic, just the transport part and some metrics that need to be generated. The only question that I have is, is Elixir able to archive line rate speeds?
I was considering using Rust/Go but I want to dig more into Elixir.
Elixir is as fast as its programmer.
Having thousands of connection is very much normal in an Elixir app. So you won’t need to worry about that.
As for the metric part, I would suggest you to do as much work asynchronously as possible. Look into
Task in Elixir docs, or
GenServer to learn more.
As for me, I find nothing more enjoyable than Elixir/Erlang when I have something to do asynchronously And I’m always amazed how resource-friendly that is. Just check it and you will love it.
Hi @pmjoe. If your use case is pretty simple, I’m curious what you’re aiming for by writing your own proxy vs reaching for something off of the shelf?
In the past I wrote a proxy in Elixir that today I might not because of the more flexible options now available. But, that aside… BEAM code is quite fast at moving data between sockets, and unmatched at doing that for lots of connections in parallel. For CPU-intensive parts of tasks it is much slower than Rust or Go. So the answer to whether it will be fast if used as a proxy is a resounding “probably” Unless you’re doing some really intensive analysis or transformation on the data, yes, very fast.
@benwilson512, explaining better, it’s a proxy, but it has some proxy rules to dispatch the request to different clients. It don’t involve data transformation or anything like that, just scheduling an routing.
In the past I wrote a proxy in Elixir that today I might not because of the more flexible options now available