Alvise Susmel's blog on Elixir

It’s up to you :slight_smile: you can post future posts in this thread or the Elixir Blog Posts thread :023:


Cryptocurrency exchanges usually open their realtime feed for free and, like Coinbase Pro, without even having to create an account. This gives us a great way to build an architecture around realtime market data.

In this article we see how to build an Elixir application to get realtime updates from the coinbase websocket feed, handling crashes and disconnections.

1 Like

Counting Real-Time Trades

In the Real-time Market-Data Updates with Elixir article, we have seen how to build a Coinbase WebSocket client and receive real-time trades. A reader asked how many trades we receive per second. In general, the rate of trades depends on the product and the time of day.
In this article we start to see how to aggregate these trades in real-time, using the GenServer behaviour. We’ll build an aggregation process that groups and count the trades.

1 Like

Hey everyone! Happy new year!

Processing Large CSV files with Elixir Streams

In this article I introduce Elixir Streams as a powerful and elegant way to process large CSV files. I compare the greedy and the lazy approach with some memory and cpu benchmarking.

As always, any feedback is really appreciated! :smiley:


Create a High-Availability Kubernetes Cluster on AWS with Kops

This article is mainly focused on DevOps. I show how to create a High-Availability Kubernetes cluster on AWS with Kops and deploy a Phoenix Chat application.

I hope this can be useful to the Elixir community. I find interesting the idea of experimenting and discussing (in further articles) the deployment and update of distributed elixir apps on a Kubernetes cluster.

Please let me know what you think. I’m here for any question :smile:

Distributed Phoenix Chat using Redis PubSub

Hi guys,

In this article we see how to solve an issue we faced in the previous article, scaling horizontally the Phoenix Chat app. We’ll see how to integrate the PubSub Redis adapter to our chat app, and make it distributed.

1 Like

Distributed Phoenix Chat with PubSub PG2 adapter

In this article we see how to cluster Phoenix Chat nodes, using distributed Elixir. We see how pg2 works and inspect how Phoenix efficiently broadcasts the messages in a distributed chat app.


Connecting Elixir Nodes with libcluster, locally and on Kubernetes

In this video we are going to see how to cluster Elixir and Phoenix nodes with libcluster, locally and on Kubernetes using Docker containers.


Download Large Files with HTTPoison Async Requests

Some kind of HTTP requests/responses can lead to memory issues. In this article we see how manage these cases using HTTPoison Async Requests.


Spawning processes in Elixir, a gentle introduction to concurrency

Along with pattern matching, one of the coolest things in Erlang and Elixir is their concurrency implementation based on Actor model. In this article I introduce concurrency and show how we can start making our code concurrent in Elixir, using processes.

1 Like

The Primitives of Elixir Concurrency: a Full Example

Let’s finally put in practice what we’ve seen about concurrency primitives in Elixir!

In this article we see how to use spawn, send and receive to make multiple concurrent HTTP requests, merging the results in a single one. Then we see how to refactor our code with Task, which makes everything easier.

The most passionate will find a small challenge at the end.

1 Like

Elixir Streams to process large HTTP responses on the fly

Wouldn’t be great to process a large HTTP response, in chunks, with Elixir streams? Something like:

|> StreamGzip.gzip
|> Stream.into(!("image.tiff.gz"))

In this first of a two-parts article, we see how to transform an HTTPoison async response into an Elixir Stream, to easily process large remote files on the fly, gaining code clarity and reusability.


Elixir Stream and large HTTP responses: processing text

This is a second part of the article of last week.

This time we are going to process on the fly a 30 million lines remote file, summing the numbers on each line. We will see how to implement the functions we need to convert a stream of chunks (the one built in the part 1) to a stream of lines. We’ll then run a benchmark of two different implementations.

We will then see how easy and quick is to process just the first 30 lines of the same 125mb remote file.

Hashing a File in Elixir

In this article we see what a hash function is and what it can be useful for. We see how to calculate the hash of strings and files using the Erlang :crypto module and Elixir streams.

Step-by-Step Tutorial to Build a Phoenix App that Supports User Uploads


Hello everyone!

I’ve just published a detailed tutorial on how to create a Phoenix app from scratch to handle user’s uploads with Plug.

I explain in depth how run a PostgreSQL with Docker, create controller actions and views, phoenix context, and how to use Ecto to store upload details into the database.

As always any kind of feedback or question is more than welcome! :purple_heart:


Dealing with long-running HTTP Requests and Timeouts in Phoenix


When processing an HTTP request takes too long, it times out and Phoenix closes the connection.

In this article we see how to simulate a long-running request and ways on how to fix the problem.

Creating Thumbnails of uploaded Images and PDF in Phoenix


In this article I start from what built in Step-by-Step Tutorial to Build a Phoenix App that Supports User Upload. We see how to integrate ImageMagick and the Mogrify wrapper in the last article Phoenix app, to create thumbnails for image and PDF files.

As always any kind of feedback or question is more than welcome! :purple_heart:

1 Like

Add a Progress Bar in the Phoenix File Upload app


in the previous articles we’ve seen how to build a small Phoenix app that processes user uploads, creating thumbnails for images and PDFs.

The problem with the current app is that nothing is shown during the upload, which is maybe ok while testing the app in localhost (the upload was fast also with big files). But in the real world an upload could last minutes… or even hours.

So in this part we focus on the front-end and see how to use JavaScript to upload a file while animating a progress bar.

At first we see how to add jQuery to our Phoenix app and using it in our JavaScript files. We then see how to use jQuery to upload a file and listen to progress events to update an HTML5 progress bar.