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

Phoenix for Rubyists with notes

Phoenix for Rubyists with notes

Introduction to Elixir and Phoenix

Avatar for Doug Goldie

Doug Goldie

August 26, 2018
Tweet

More Decks by Doug Goldie

Other Decks in Programming

Transcript

  1. Moore’s Law is Dead! number of transistors in a dense

    integrated circuit doubles approximately every two years. We are seeing more multi-core machines with more cores. The observation is What are we getting …. more chips, more multi-core machines.
  2. Any Web Application Classic CRUD monolith Single page app (SPA)

    - with any frontend Realtime app productivity and performance.
  3. Distributed Systems Small distributed apps. Large-Scale distributed, fault-tolerant system Phoenix

    as the Web component Elixir for the other components. productivity and performance.
  4. Agenda Elixir in 10 minutes Basic Phoenix app Real-time app

    Distributed systems Some really contrarian, disruptive ideas !! - Rails like demo - Non-rails like demo - realtime - web component for a distributed, fault tolerant system - use this platform to do things in a really contrarian way.
  5. Processes • lightweight, small memory, fast to create and terminate

    • message passing • no shared data • links and monitors • error handling Erlang is designed for massive concurrency Erlang is designed for massive concurrency. Erlang processes are lightweight (grow and shrink dynamically) with small memory footprint, fast to create and terminate, and the scheduling overhead is low.
  6. Server A HTTP Server Nginx and Phusion Passenger Request processing

    Ruby on Rails Long-running requests Go Server-wide state Redis Persistable data Redis / MongoDB Background jobs Cron, Bash scripts, and Ruby Service crash recovery Upstart Server B Erlang Erlang Erlang Erlang Erlang Erlang Erlang A real world Rails app needs other software. other things: sidekiq, docker, ???
  7. Server A Server B Erlang Erlang Erlang Erlang Erlang Erlang

    Erlang A real world Rails app needs other software. other things: sidekiq, docker, ???
  8. HTTP Server Nginx and Phusion Passenger Request processing Ruby on

    Rails Long-running requests Go Server-wide state Redis Persistable data Redis / MongoDB Background jobs Cron, Bash scripts, and Ruby Service crash recovery Upstart Erlang Erlang Erlang Erlang Erlang Erlang Erlang Server A Server B This isn’t just large-scale problems. We build distributed systems all the time. A real world Rails app needs other software. other things: sidekiq, docker, ???
  9. Erlang History Developed over 25 years ago by Ericsson for

    building Telcom products Released as open source in 1998.
  10. Requirements • high concurrency • distribution • fault tolerant •

    soft realtime • high availability • external interfaces • hot code upgrade
  11. Processes • basic unit of work • message passing •

    no shared state • high concurrency Erlang is designed for massive concurrency. Erlang processes are — lightweight (grow and shrink dynamically) — with small memory footprint, — fast to create and terminate, and — the scheduling overhead is low.
  12. Processes • lightweight, small memory, fast to create and terminate

    • message passing • no shared data • links and monitors • error handling Erlang is designed for massive concurrency Erlang is designed for massive concurrency. Erlang processes are lightweight (grow and shrink dynamically) with small memory footprint, fast to create and terminate, and the scheduling overhead is low.
  13. OTP • supervision trees • behaviors • applications • releases

    • release handling Erlang is designed for massive concurrency. Erlang processes are — lightweight (grow and shrink dynamically) — with small memory footprint, — fast to create and terminate, and — the scheduling overhead is low.
  14. Quotes “Best kept secret in software” 
 - Evan Miller,

    author of Chicago Boss “Erlang is about building Systems”
 - Robert Virding “Erlang makes the easy things hard 
 and the hard things easy” separate?
  15. Server A Server B HTTP Server Nginx and Phusion Passenger

    Erlang Request processing Ruby on Rails Erlang Long-running requests Go Erlang Server-wide state Redis Erlang Persistable data Redis / MongoDB Erlang Background jobs Cron, Bash scripts, and Ruby Erlang Service crash recovery Upstart Erlang
  16. Elixir review • BEAM (Erlang VM) • modern syntax •

    macros • tooling • community • documentation