samacs

samacs

OTP and the microservices advent

About a month or so we embarked on redesigning/rearchitecting most of the operation processes of the business for the company I work for, one of the biggest online clothing retailers in Mexico.

In order to support more sale channels and marketplaces, we decided to delegate some operational aspects of the overall system and start building systems to coordinate or orchestrate these operations and keep them in sync with our monolith back office system and services around it.

We started building these microservices using Go. It’s been a little difficult to find people willing to work/learn Go our the Mexico City’s area, but still, we are about to ship these to production and the overall outcome seem pretty promising, systems talk to each other in a proper way using message queues, RPC calls, etc.

We built a series of mechanisms in order to manage and monitor the lifecycle of various processes (task workers, consumers, etc.) in Go. Which I’ve seen that’s related almost homogeneously to the way Processes, GenServers and Supervisors work in Elixir.

As of today, we manage and monitor periodically running tasks and queue consumers using Goroutines, channels, and mutexes. Different endpoints are exposed via an API in order to query the state of processes and to manage their lifecycles, the number of workers needed for a particular job/consumer.

Although it works, I started feeling it is a little hacky, considering that this kind of supervising processes seems to come out almost free out of the box in OTP, the challenging being I think designing the correct processes tree and exposing the interfaces to monitor/manage them.

In this regard, along with reading the excellent articles and presentations out there, I’m considering getting a couple of books in order to research this in depth and build a stronger base to implement part of the system using Elixir, but I’m afraid of wasting my time (and money) reading things that treat Elixir with a web development point of view. Not that I’m not considering something like Plug, or even Phoenix, but for now I consider a little more important understanding OTP for the kind of system we are trying to build.

What are your thoughts on the following books? Is there any other good book/resource you consider worth reading to have a better understanding of OTP and Elixir in general?:

Thanks in advance!

First Post!

peerreynders

peerreynders

So far the best OTP (design) book that I’ve encountered is still Designing for Scalability with Erlang/OTP-Implement Robust, Fault-Tolerant Systems. The ebook is available DRM-free from Google Play Books and ebooks.com. The free sample on Google Play Books covers everything up to most of Chapter 4.

The Chapter 2 Erlang primer should be enough to get an Elixir developer going to understand the Erlang code - which isn’t that difficult to port to Elixir.

Functional Web Development with Elixir, OTP, and Phoenix would be a great follow up as a demonstration in the pure Elixir space with Phoenix (don’t forget the forum discount).

If you are still looking for a more introductory Elixir text Elixir In Action - 2e is a good choice for an experienced programmer with its more “Erlang-oriented” approach - and it dabbles a little bit with OTP (for a few more hours half off).

Fred Hébert:

Where Next?

Popular in Questions Top

aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
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
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
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
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
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
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New

We're in Beta

About us Mission Statement