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

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New

We're in Beta

About us Mission Statement