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

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

4569aec00cb223b3fbf484f9e7ba1256?s=128

Renan Ranelli

May 14, 2016
Tweet

Transcript

  1. ELIXIR IN PRODUCTION: THE EXPERIENCE AT XERPA Renan Ranelli

  2. Milhouse (@renanranelli)

  3. Software Engineer @ Milhouse (@renanranelli)

  4. (former) Software Engineer @ Milhouse (@renanranelli)

  5. Milhouse (@renanranelli)

  6. 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.
  7. None
  8. 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
  9. This was written in March 2005.

  10. 2005

  11. 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
  12. This was written in March 2005

  13. FUNCTIONAL PROGRAMMING (!)

  14. 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...
  15. 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
  16. https://www.youtube.com/watch?v=njAMVB02Ag0 https://www.youtube.com/watch?v=kiaZd8dmbtI THERES LIFE BEYOND OOP IF YOU WANT TO

    KNOW MORE, I HAVE TWO TALKS FOR YOU
  17. ELIXIR @ XERPA

  18. ELIXIR @ XERPA

  19. • 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.
  20. • Elixir in production for 7 months: 2k commits, 300

    PRs, +- 21k lines of code, 4 devs ~ 150 modules
  21. • 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”.
  22. None
  23. None
  24. None
  25. 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.
  26. 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”.
  27. Now to the not-fun part.

  28. 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.)
  29. 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.
  30. YOU GOTTA GET YOUR HANDS DIRTY

  31. YOU GOTTA GET YOUR HANDS DIRTY

  32. YOU GOTTA GET YOUR HANDS DIRTY

  33. YOU GOTTA GET YOUR HANDS DIRTY

  34. YOU GOTTA GET YOUR HANDS DIRTY

  35. YOU GOTTA GET YOUR HANDS DIRTY

  36. 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.
  37. 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...
  38. Conclusion:

  39. 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.
  40. OBRIGADO !

  41. @renanranelli /rranelli Renan Ranelli (Milhouse) milhouseonsofware.com

  42. • https://www.youtube.com/watch?v=njAMVB02Ag0 • https://www.youtube.com/watch?v=kiaZd8dmbtI