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

Elixir- Processes, OTP and GenServer

Elixir- Processes, OTP and GenServer

A small intro presentation into Elixir. How it deals with processes and introduction into the famous OTP(Open Telecom Platform) and the GenServer

Avatar for Ananth Madhavan

Ananth Madhavan

April 30, 2016
Tweet

Other Decks in Programming

Transcript

  1. Who am I? • Engineer at Synup Inc • I

    speak Ruby and Elixir in the machine world. • AnanthMadhavan • ananth99
  2. What is Elixir? • Elixir is a functional, immutable, concurrent,

    general purpose programming language built on top of the Erlang BEAM VM. • Invented by Jose Valim, Rails core commiter. • Full compatibility with the Erlang Universe! • Compiles to Erlang Byte code. • Ruby like Syntax. • Amazing tooling and documentation!
  3. A little background on Erlang… • Originally developed by Ericsson

    to support distributed, fault tolerant, highly available, non stop applications back in 1986. • Erlang runs on a battle tested BEAM virtual machine. • WhatsApp scaled 2 million connections in a server running Erlang VM! • RabbitMQ, an open source message broker software that implements Advance Message Queueing Protocol(AMQP) is built using Erlang. Highly tolerant and distributed. • https://github.com/erlang/otp
  4. • In Elixir, all code runs inside a process. •

    Not to be confused with OS processes. • Processes communicate via message passing. • Processes in Elixir are extremely lightweight in terms of CPU and memory (unlike threads in many languages?). • Create processes like you create objects in Ruby. ;-) Processes
  5. OTP • Open Telecom Platform(OTP) is a set of libraries

    that ship with Erlang. • Used to maintain state, build fault tolerant and distributed applications
  6. GenServer • A behavior module for implementing the server of

    a client server relation • A GenServer process is like any other Elixir process and can be used to maintain state, run code asynchronously and so on. • Has a standard set of interface functions.
  7. Supervisors • A supervisor is a process which supervises other

    processes called child processes. • Supervisors are used to build a hierarchical process structures called supervision trees, a nice way to structure fault tolerant applications. • Strategies: :one_for_one, :rest_for_one, :one_for_all