Is Elixir good for microservices?

Why not? Or what do you think about it

Tnx so much for ur answer, is it possible to use python and elixir altogether for microservices in same project?

Tnx so much:)

I think you would need to have a specific need to:

  1. Mix languages
  2. Use microservices

But if you want some of it you can

  1. Use mix (phun intended)
  2. Create a few apps in one umbrella

Don’t use things because other people say it’s cool; use them because you need them or because they are better for you / your project. Most projects can do without all the issues microservices bring to the table.

I started with Elixir because I had a few needs that Elixir solved. Not much later I loved. Elixir replaced many services in PHP+Go, had consistent performance, did not leak memory (memory usage is a flat line the last 5 years) and I could drop external dependencies (Cron, Redis, MirrorBits, Nginx, some external program to restart the apps on crash, and a few more). All those extra benefits followed the need. And now I consider the ‘all batteries included’ almost a need dor every project as it makes tons of things much easier.

5 Likes

Why not? Because the upside it has is largely overrated for most projects but it brings tons of complexity. The kind of costs you only should be willing to pay if your app is so complex/large that is is a problem.

Real microservices don’t share a database. Figure how you do joins, how you ensure all services have the same definition of a ‘user’, how you version interfaces, etc etc.

Ohhh…and stay away from NoSQL. As cool as they make it sound; it super fun for prototyping but once apps grow it soon becomes a burden only to become valuable again once you have enormous amounts of data (but then your schema is probably less fluid so that’s okey)

6 Likes

Tnx so much for ur explaining, what do you think video streaming performance in elixir, thst is why i love python, because python is well suited for video streaming app

You might stream as well with Membrane. I am using Python with Elixir mostly for AI.

2 Likes

I have no idea. Never had to do anything like it. But the mentioned Membrane project seems quite nice.

Please define “microservices”. Do you mean them as a physical deployment model? If so, I think that is a pox on the software industry, pushing complexity into the network and interfaces and devops. If you mean it as a logical model, then, yes, each BEAM process is a microservice. It is isolated from its peers from crashes due to supervision trees. They communicate via memory-copied messages (however binary vs. json).

I am hugely in favor of logical microservices in an Elixir release, but I have issues with the more conventional meaning of the term.

13 Likes

That’s the wrong question to ask. Much better question is: “Why have microservices?”

The classic microservices are basically self-contained apps that still have to work together and each has a separate database. That’s a nightmare to maintain because what can be a simple function call is now a networked exchange of messages – needlessly complex (and 1000x times slower, too)! Even something like 2 separate microservices is going to be a huge drain of your time and energy.

Advice: do NOT fall for hyped up videos or “tutorials”, do NOT listen to some 22 year olds that barely have one production project behind them but are now excited because they themselves saw some hyped up video.

IT work (programming included) is about ruthlessly managing and reducing complexity. Do NOT introduce complexity in your paid work. Oh, and don’t mix languages unless you are forced to. Stick to one language.

If you are so hyped up about something, try it on your own time and on a hobby project. If you do that in your paid work I promise you that you’ll dearly regret it and will curse your life.

8 Likes

I’ll echo what @gregvaughn and @dimitarvp have said. However, if it was decreed from above that you have to use a microservice approach, then the answer is yes, Elixir can do microservices, and monolithic, and everything in between.

I’ve never seen anyone voluntarily build a bunch of microservices in their personal hobby project. If I were a masochist, there are easier ways to torture myself.

10 Likes

While others has spoken finely about why you really consider carefully about microservices approach (recently popular opinion has moved toward modular monolith, even among microservices proponent like Sam Newman), i want to focus if you decide to do microservices approach, how do you decide between elixir/python/golang?

Each of the language has it’s strong point and weak point, you would need to consider which of the language suit your problem domain + context the best.

IMO,
Elixir has it’s strong suit on correctness + robustness + general productivity, example problem domain it shine is communication (WhatsApp), blockchain/web3 tech, and rapid application development

GoLang has it’s strong suit on low level/binary manipulation + fast performance + tooling support, example problem domain it shine is CLI tools, binary level work (video/streaming encoding), gRPC based microservice.

Python has it’s strong suit in it’s large amount of library (especially data based library) + general productivity, example problem domain it shine is machine learning, and rapid application development

Context is things like company culture and developer general skill. for example some company is invest heavily on JVM, so usually when they introduce new language, it’s a language which are supported on JVM (like clojure/scala/kotlin).

3 Likes

tnx so much for ur respond, what do you think about performance of membrane for video streaming and compare with python?

tnx so much for ur answer, I have an example, you have a mobile app like tiktok, it has message service and video streaming service, I mean if you were create microservice about it, how you will decide, like write chat service by elixir, and video streaming service by python, or write all services by elixir?

What a great explanation, tnx so much.

tnx so so much ,I understand very well, appreciated :slight_smile:

I recommend you this article by Martin Fowler about microservices.

In the case of Elixir, you can write a monolith app but in it will run “as microservices” on the host machine, which is one of it’s killer feature.

However, microservices could be interesting with Elixir if you want to slice your service into functional pieces (e.g. for a team organization purpose).

4 Likes

tnx so much appreciated :slight_smile:

1 Like

How one can define microservices?
It has different meanings, depending on the project’s context.

1 Like

I think this question was covered when microservices was more hyped up.

Here are some relevant discussions from a few years ago:

Robert Virding’s quote in there is quite hilarious because Erlang has been doing microservices forever by its design.

Anyway, on another note, something no one hasn’t mentioned yet - microservices are very useful when you have cross-organizational boundaries and have 300 people trying to commit to trunk. They are somewhat useful when you have to scale a hotspot. And for everything else…meh.

One group I was working with in 2015 divided a system into 14 separate microservices for a team of 8-9. When I went to visit, I asked them, “Why are you storing the same data over these 5 boundaries? It’s all the same data, why not the same service.” They answered, “That’s what we said, but our architect told us we need to microservices!”

So whatever you’re building, don’t do that and blame the language(s). :slight_smile:

4 Likes