When would you NOT use Elixir?

A couple of days ago I was discussing with a friend about different approaches to write microservices.

He said that if he was going to write a new microservice platform from scratch, he would probably use Go + Docker + Kubernetes + Rancher + Kafka/RabbitMQ.

I said that I would probably just stick with an Elixir’s umbrella using supervision tree and process discovery across nodes, using an external MQ or even Elixir Port to communicate with external actors when needed.

In the end we agreed that Go and Elixir proposes their own approach to the same problem, and that the context of the problem would tell which solution could be the best fit.

For me, this discussion raised a few questions that probably will be answered through experience and time.

Since a question like “why elixir is the best language in the world?” in the elixir forum would have very biased naswers, now I ask you: when would you not use Elixir?

10 Likes

Maybe when I have to do this. I think, by default, epmd creates a fully connected mesh network. Gossip protocols might scale better. Or federated mesh networks (like what whatsapp was doing?).

There are workarounds for elixir, though.

4 Likes

If I can’t afford the overhead? there is 0 chance I’d reach for Go though :slight_smile: I think Elixir + Rust is pretty much It for wast majority of use cases. And for use cases where Elixir would be too much overhead I’d reach for Rust. Both Rust and Elixir make writing concurrent code sane and safe in Go you can shoot yourself in the foot very easily and I’d rather “fight” compiler a bit than debug race conditions in prod. (not to mention how a lang. in 2018 can exist without sane package manager is a mystery).

10 Likes
  1. Heavy math. I would delegate it to some library and possibly do the rest in Elixir.
  2. GUI work, the bindings and support are just not there.
9 Likes

If need a very quick 5mins throwaway script I can/need to use out of my IDE, like cutting parts of JSON I don’t need I would use Python. Or if it’s something I have to put on server and just execute, without all the hassle of elixir and Erlang installation,

For everything else:

Pretty much this.

3 Likes

An older similar thread here:

I would not use Elixir when… I don’t have the choice to :lol: (such as native mobile apps)

I would also not use Elixir for very basic sites or when other languages excel in those areas (such as image processing) but still use Elixir as the ‘brains’/core of the app.

I like to stick to one language if possible, so hopefully, when I am fully acquainted with it, I will use Elixir most of the time.

7 Likes

+1 :slight_smile:

2 Likes

You might like to point out to him that RabbitMQ is implemented in Erlang so in effect he would be using almost Elixir, just with a bit of difference in the syntax. :grinning:

14 Likes

I’ll provide a (webdev/Phoenix focused) counterpoint. For the time being I use Elixir very little — but I’m rooting for it. My interest is primarily in frontend dev, though at work I have to do some backend dev in JS and Java as well. For my side projects I have been looking for a language/framework combo that provides fast and pleasant development for basic CRUD APIs with authentification. I just want this to be fast and painless so I can concentrate on the frontend work (I’m crazy, I know). I like a lot of what Elixir/Phoenix offers, but for the time being I’m sticking with Python/DjangoREST for the following reasons:

  • More libraries for Python.
  • Included user models and auth functionality in Django.
  • Better googleabilty and availability of docs/books for Python/Django.
  • Mostly anecdotal evidence for Elixir/Phoenix performance. Where are the benchmarks that compare several frameworks in differnet scenarios? In Techempower’s latest round Django outperforms Phoenix in most tests. I know you guys here are sceptical about these benchmarks, but why isn’t the Phoenix subsmission fixed if it’s misconfigured? Why aren’t alterantive benchmarks provided if Techempower’s are flawed?

That said, I’m eagerly watching Elixir/Phoenix. I will read the Programming Phoenix book when it’s updated to 1.3, and perhaps write the next API in Elixir/Phoenix.

2 Likes

Yeah. When writing “scripts”, I start with Bash and quickly upgrade to Ruby as soon as I need to write a function or do some more complex looping. Gawd, shell scripting sucks.

Anyway… would not use Elixir for that… :slight_smile:

To elaborate, Elixir isn’t really good with forking Unix processes. There is the porcelain package, which tries to make it nicer, but to get full nicety, it requires you install some shim written in Go. Ugh.

1 Like

This may sound really, really stupid and obvious, but one of my primary use cases for Ruby (and before that, Smalltalk of all things) is prototyping Object Oriented interfaces. Even when the final language is going to be Swift, Objective-C, or in my younger years C++, I’ve found that figuring out the interface for a class is often easier to do in a language that doesn’t have as long an edit - results cycle.

Needless to say, Elixir is not a really good choice for investigating OO interfaces :stuck_out_tongue_winking_eye: (though sometimes the clear separation of message passing means it’s not as far off as you might first think).

Unlike many folks who have chimed in, I do use Elixir for one-off scripts. But if I had to write larger script system (say build and deploy scripts for a non-elixir application) I probably wouldn’t use it for that.

2 Likes

Eh shell scripting is not that bad, though I usually prefer zsh over bash myself (more ‘sane’ overall, but otherwise almost identical syntax).

I usually start in standard posix, upgrade to ZSH if I need, then upgrade to either perl, python, or ocaml, depending on the system it will run on and what libs I need. :slight_smile:

Yeah that’s the problem there, OO interfaces are ‘almost’ always the wrong design choice… ^.^;

I have rarely as well, like for a benchmarker recently on querying some servers. ^.^

When i look that benchmark. I see rails outperforms phoenix in most tests. I dont know why. Most of phoenix developers came from rails as me. We see rails isn’t even close to phoenix about performance in real life situations.

Can someone compare “Docker + Kubernetes + Rancher + Kafka/RabbitMQ” vs Elixir concurrency?

1 Like

I don’t remember using Elixir to build a 3D engine. But for web development, API development, scripting, Elixir is great.

If I remember correctly, Chris McCord tried to fix it, but the benchmark owner didn’t implement/approve it. CMIIW.

1 Like

Wings3D is Erlang (and seemed pretty damn good when I played around with it a few years ago, interface and performance were both great), but I never investigated why the author/s settled on Erlang rather than something that you would expect would be more suited to the task.

4 Likes

Managing yourself Kafka and Kubernetes is not easy task. You will need all devops team or … cloud provider.

I would ask question if you are planning to use this in some public cloud, or you would like to maintain Kubernetes (K8s) by your self.

If you use public cloud , do you want to use other services from public cloud provide?
If so this this case I would stick with language that is official supported by cloud provider.

But if someone mentioned rancher I suppose this case K8s will be maintained by this person.
So you can create some services in elixr, some in go , some in python.
But also in this case I would choose language that fits the best for micro services architecture under K8s. So you can easy do tracing, monitoring …

3 Likes

Wings3D was implemented by Björn Gustavsson of the Ericsson OTP team who has been working with the compiler and the BEAM for over 20 years. It is rumoured that he improved the efficiency of floating point calculations for this tool. :wink:

9 Likes

I think most of the time I would not use Erlang/Elixir for something is a task for which they are just not well suited. For example, when I do web frontends I use Elm. If I had to do major number crunching (Not that I do that) I might reach for Fortran etc. Erlang & Elixir solve one set of problems really well, but there are lots of others that other things probably do better for.

3 Likes

I would not use Elixir when I have discussed the pros and cons with a client and they have not given the go ahead to proceed with a (gradual) migration to Phoenix/Elixir.

One client said no mainly because of the scarcity of elixir programmers with a side dish of not wanting to have yet another language, two others are happy enough for me to do my own (isolated) side project to experiment what a migration would entail (at my, not their cost), but don’t see it as a business priority, and therefor have not assigned any funds to it.

I am looking for greenfield projects that would start with Elixir … (I am just starting to learn Elixir and Phoenix, though it brings back memories of using prolog about 2 decades ago)

3 Likes