ElixirConf.EU 2017

I was in beautiful Barcelona for ElixirConf.EU 2017.
In this post I’m sharing some of my notes and impressions about it.


team-quiqup

Team Quiqup [Zorbas, Hawkins, Rabe]


Tutorials

I attended the tutorial “Microservices under the Umbrella” by Makis Otman & Georgina McFadyen, both working for 8th Light.

We hacked on code from the following repositories:

The was goal to create an umbrella application, going through the pros and cons of such an architecture. We coded a sub-application to query the Wikipedia API and cache the results to a GenServer. We wrote tests and finally used :rpc.call/4 to call functions on a remote node.

Relevant blog post: https://8thlight.com/blog/georgina-mcfadyen/2017/05/01/elixir-umbrella-projects.html

Conference - Day 1

Keynote - José Valim

The presentation was about the beginnings of the language, the current state of development and what to expect in upcoming releases.

Highlights

Depression Valley
The point where no-one is using your language and you’re unsure you’re headed in the right direction.
Lego Lang
That was the original name of the language in the early days.
Rookie Mistakes
José said that he made some during the first stages of development.

José stated that he knew the features he wanted to include in the language, the difficult part was to shape it in a way to make people productive. Early on, too much eval was required to make something non-trivial.

A Tour of the Elixir Source Code - Xavier Noria

In this talk Xavier demystified parts of the Elixir compiler. How code is loaded and compiled, Macros and the AST.

Topics:

  • Elixir Project Structure
  • What is Elixir written in?
  • Compilation
  • Parallel Compiler
  • Implementation of Protocols

Some little-known facts:

  • Elixir defines a dummy function in a dummy module, with the program as the body, all directly in Abstract Format
{_, mfa} = :erlang.process_info(self(), :current_function)

mfa
#=> {:elixir_compiler_0, __FILE__, 1}

If you find this interesting, you should read Xavier’s relevant blog post.

Ecto - DBConnection - Ecto’s SQL Sandbox - fishcakez (aka John Fish)

Stories behind the implementation of Ecto SQL Sandbox, which is a way to have concurrent tests against the database.

Highlights

Machine Learning with Elixir and Phoenix - Eric Weinstein

The talk was about implementing a neural network on stock market data to predict prices and act upon them.

  • Machine Learning on the BEAM is fun practical and super doable
  • I think he used the neat_ex package for the neural networks

Little or no code was shown during the talk and I couldn’t find the source in one of Erics’ GitHub repositories.


Conference - Day 2

Always Available - Claudio Ortolina

Slides

  • Use one process per request
  • Prevent letting the application to go down, when the database goes down
  • Elixir > v1.4 local registry can be used to register workers
  • Hide implementation details, typespecs can be of help, see example:
defmodule Libra.Inspector do
 @type url :: String.t
 @type uuid :: String.t
 @spec process_url(url) :: {:ok, uuid} | {:error, term}
 @spec get_page(uuid) :: {:ok, Libra.Page.t} | {:error, :not_found}
end

GraphQL in Practice - Bruce Williams & Benjamin Wilson

The talk was about using Absinthe, a GraphQL library for Elixir.

GraphQL is not just a frontend technology

  • Has an active growing community with more than 500 slack members
  • A book’s coming soon from the pragmatic programmers
  • Absinthe has a way to prevent DoS by complex queries. It performs complexity analysis of a query (it even provides a way to supply you own algorithm/implementation) and does not execute queries above a configurable threshold.

Closing Keynote - Chris McCord

  • Open-source is hard. You have to handle all sorts of feedback
  • Contexts are application barriers
  • Goal of Phoenix@1.2: Distributed applications
  • Goal of Phoenix@1.3: Design with intent. You have to think design carefully
  • Goal of Phoenix@1.4: Convincing the stakeholders

    • Monitoring & Metrics
    • Health Checks
    • Robust applications in production
    • Insights into running apps
    • “ROFLSCALE” apps
  • There are a few agents for APM services that can affect the performance of a running app.

Chris announced that there will be a common interface for metric collection. Probably implemented as a standalone library. Read more here.

He demoed an phoenix application feeding gauges in realtime with application metrics. A candidate abstraction for metrics reporting is the following:

defmodule Demo.Metrics do
  import Metrics

  def start_link do
    Metrics.Supervisor.start_link(__MODULE__, [
      gauge(:memory,     every: [1, :second]),
      gauge(:cpu,        every: [1, :second]),
      gauge(:processes,  every: [1, :second]),
      gauge(:memory,     every: [1, :second])
    ])
  end

  ## Gauges

  def memory(state) do
    {:ok, :memsup.get_system_memory_data(), state}
  end

  def cpu(state) do
    {:ok, %{usage: :cpu_sup.util()}, state}
  end
end

It’s going to be part of the roadmap for Kitto to make it easy to have a dashboard for phoenix metrics, maybe in the looks of https://kitto.io/dashboards/jobs

Highlights


musicians

🎷 After Party 👯


  • There were at least 2 reported laptop thefts, which got me worried
  • No water/coffee between the talks
  • I had a really interesting discussion with Xavier Noria about handling money with Elixir. It seems like the ecosystem needs something like RubyMoney.
  • I tried black pudding tapas. Unforgettably horrible 🤢.
  • I competed in the ElixirCards tournament! I couldn’t get past José Valim though 😀.

Upcoming Elixir Conferences