Is Elixir good for microservices?

I am fun of elixir and I want to move with elixir, but someone recommend go and python for microservices, I am not sure, I have to use all them for microservices, or which one is best for me?

Yes, elixir fits perfectly for microservices.

2 Likes

Why you want microservices in the first place?

4 Likes

There are as many opinions and recommendations as there are people. I love Elixir more than the mentioned two (that’s why I am here and not on pythonforum :slight_smile:

One of the low hanging fruits/benefits of Elixir is the fast amount of build in functionality, the focus on the happy path and the code is easy to read.

Python is easy to write, flourishes on some specific areas but for a lot of things I think Elixir does better. Go has the benefit of a single binary to deploy and run and is faster. But in the end; Elixir is the one that combines many good things of other languages with little drawbacks.

3 Likes

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: