Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDC Floripa 2016 - Elixir in production: The ex...

TDC Floripa 2016 - Elixir in production: The experience at Xerpa

Renan Ranelli

May 14, 2016
Tweet

More Decks by Renan Ranelli

Other Decks in Programming

Transcript

  1. AGENDA • Why the heck are people talking so much

    about FP ? • What the heck is “Xerpa” ? • What the heck is “Elixir” ? • A little bit about our experience and main struggles. • Discussion, questions and things like that.
  2. WHAT'S HAPPENING ON HARDWARE­LAND • You must google “no more

    free lunch”. • The takeaway is: – CPUs are not getting faster for single threaded applications. – Concurrency is the next major revolution in how we write software
  3. In 2005: – Java 5 was hot news. – Windows

    XP. Vista only in 2007. – No AWS, Twitter, Netflix. – Ruby on Rails launching in December. – Youtube was just founded. – You've never heard of Justin Bieber
  4. FUNCTIONAL PROGRAMMING • Every* language built after that has concurrency

    as a main concern to be adressed – Scala, Clojure. – Elixir. – Go, Rust. – Erlang & Haskell's rediscovery. – Kotlin, Nim, Pony, Crystal, etc...
  5. FUNCTIONAL PROGRAMMING • Actually, functional programming is a very old

    paradigm (even older than OOP): – 1960 → Lisp – 1973 → ML – 1980s → Lazy langs: Miranda, KRC, SASL, Orwell... – 1986 → Erlang – 1990 → Haskell 1.0
  6. • Our tech-stack today is something like this: – Elixir

    backend (!!) [Phoenix] – Clojurescript frontend (!!!!!) [Reagent/React] – Postgresql 9.4, (Cassandra soon) – ElasticSearch, Redis, C#/Mono (!?) – InfluxDB, Sensu & Grafana – Jenkins, Mailgun, Ansible, Terraform, AWS and *a lot* of shell scripting :D – No Docker, microservices, no service discovery.
  7. • Elixir in production for 7 months: 2k commits, 300

    PRs, +- 21k lines of code, 4 devs ~ 150 modules
  8. • Elixir – Based on the Erlang VM. Can handle

    a lot of punching. – Erlang's runtime is extremely mature and battle-hardened. – Fault tolerance is a first class citizen. Hot-code reloads are possible. Many versions of the same module can coexist. – Erlang is built to yield uptimes up to 99.9999999% (really) – Communication is “shared nothing” and “default asynchronous”. – This is also called the “Actor System”.
  9. WHAT ELIXIR DOES REALLY WELL? • Everything is immutable. •

    There is a compiler (!). • Elixir is pragmatic (!!!) • Performance is great. GC is per-process. (*) • Documentation & tooling are take seriously. (*) • Macros. (*) • The runtime & OTP are AWESOME. Every process is preempted. No bad neighbors.
  10. PHOENIX >> RAILS • Where Phoenix excels over Rails ?

    – SUPER DUPPER FAST (!?) – Much easier to setup for high concurrency – Much less magic. Mostly everything is based on simple function calls. – Channels (!) – Views vs Templates. – It feels like “Rails done right”.
  11. PROBLEMS WE ENCOUNTERED SO FAR • The ecosystem is still

    very small (and somewhat buggy). – No options for monitoring apps (like new relic, appsignal, honeybadger). – Nothing as mature as Sidekiq (we have Exq and verk, but still...). – ExMachina (elixir's factory girl) is so broken. Ecto 2.0 will solve this. – No Monads. (we don't actually need them.)
  12. PROBLEMS WE ENCOUNTERED SO FAR • The ecosystem is still

    very small (and buggy). – No usable client for elastic search (*) – No usable (at the time?) library for exposing jsonapi (*) – No usable (at the time) library to handle auth (*) – No usable bindings for GraphicsMagick (*) – Releases are so damn hard and un-12factor (*) – Hot code reloads are much much harder than people say – Almost no problems with core libs like Ecto, Plug & Phoenix though.
  13. PROBLEMS WE ENCOUNTERED SO FAR • The ecosystem is still

    very small (and buggy). – No usable client for elastic search (*) – No usable (at the time?) library for exposing jsonapi (*) – No usable (at the time) library to handle auth (*) – No usable bindings for GraphicsMagick (*) – Releases are so damn hard and un-12factor (*) – Hot code reloads are much much harder than people say – Almost no problems with core libs like Ecto, Plug & Phoenix though.
  14. A SMALL COMPARISON WITH CLOJURE: – Clojure can tap into

    the JVM. – A *big* and mature ecosystem (erlang is mature, but not big) – A lot (?) of developers willing to work with it – Although Elixir can tap into Erlang-land's libraries and tools, they are much harder to use (less googlability, bad/incomplete docs) – Clojure offers absolutely nothing in terms of distribution and fault tolerance. There is no competition really...
  15. On Elixir • Elixir is *very promissing*, and has learned

    a lot from other communities. (e.g. Queryable is an idea from .Net's Linq) • You can see that it evolves and taps into the learning experiences of other languages & communities. It still lacks a mature ecosystem but it is gaining traction fast. • If you truly aim to invest yourself in it, you must be ready to get your hands dirty and write a lot of infrastructure you take for granted in other ecosystems. • Do *not* underestimate the complexity of managing library code + tests + docs + versioning + bug tracking.