? ? ?
FROM RUBY TO ELIXIR
IT DAY KHERSON 2018
FROM RUBY TO ELIXIR
IT DAY KHERSON 2018
Maksym Pugach
Ruby
Ember
React
Elixir
Why to develop yet another
language?
José Valim Ruby activity
Processors stopped getting significantly faster
but they started to scale by getting more cores
Multicore world
SPARC M8-8 Server
256 x 8 = 2048
hardware
threads
Concurrency in
The Erlang runtime system is known for its designs that are well suited for systems with the following characteristics:
● Distributed
● Fault-tolerant
● Soft real-time,
● Highly available, non-stop applications
● Hot swapping, where code can be changed without stopping a system
The Erlang programming language is known for the following properties:
● Immutable data
● Pattern matching
● Functional programming
+ better syntax
+ better error reporting
+ modern tooling
+ can use Erlang libraries
+ fresh enthusiastic community
compiles into EVM bytecode, not into
Erlang first
I downloaded elixir last week and started playing ...
It didn't take long, but pretty soon my gut feeling
kicked in.
This is good shit.
- Joe Armstrong
https://joearms.github.io/published/2013-05-31-a-week-with-elixir.html
There have to be some code...
Comparing Ruby and Elixir…
“When it comes to concurrency
or distributed execution
it feels like the language
is on your side”
- heard somewhere
Umbrella applications
is
Plug + Phoenix router + MVC project structure
optional
+ Ecto integration
+ Brunch based assets pipeline
+ Phoenix Channels
+ Phoenix Presence
about a second to deliver a
Wikipedia article to 2M clients
in a single chat room
Phoenix Channels vs Rails Action Cable
2x Digital Ocean 16GB, 8-core instances for the client and server
Rails: 75 rooms, 3750 users Phoenix: 1100 rooms, 55,000 users
(maxed 55,000 client connections)
50 per room
2x Digital Ocean 16GB, 8-core instances for the client and server
Rails: 9 rooms, 1800 users before availability was
compromised when broadcasting.
Phoenix: 275 rooms, 55,000 users (maxed
55,000 client connections)
200 per room
Wobserver
by SQUARE ENIX
Elixir Stories
We’ve also seen an improvement in code clarity. We’re converting our
notifications system from Java to Elixir. The Java version used an Actor
system and weighed in at around 10,000 lines of code. The new Elixir
system has shrunk this to around 1000 lines. The Elixir based system is
also faster and more consistent than the Java one and runs on half the
number of servers.
- Steve Cohen | Pinterest engineer, Data
https://medium.com/@Pinterest_Engineering/introducing-new-open-source-tools-for-the-elixir-community-2f7bb0bb7d8c
87 million unique users (December 2017)
https://blog.discordapp.com/tagged/engineering
● How Discord Scaled Elixir to 5,000,000 Concurrent Users
● How Discord handles push request bursts of over a million per minute with Elixir’s
GenStage
1.5 Billion page views per month
250000 concurrent users at peak
3+ Billion push notifications per month
Ruby + $$$ = Elixir
poorly written Ruby application
poorly written Elixir Application
150 Ruby servers < 5 Elixir servers
Ruby + $$$ = Elixir
poorly written Ruby application
poorly written Elixir Application
150 Ruby servers < 5 Elixir servers
Ruby + $$$ = Elixir
poorly written Ruby application
poorly written Elixir Application
150 Ruby servers < 5 Elixir servers
NFL Draft 2016
generally busiest night of the year
200M+ push notifications sent during day one
10x performance from last year
Elixir: not autoscaling needed, just another day
● High-traffic systems
● Systems that do stuff asynchronously
● Distributed / clustered systems
● High-availability systems with true zero-downtime
● Server-side push and real-time applications
● Large applications
● Small microservice
● Your team is used to Elixir already
● A new project where the estimate can handle two weeks
for your team to get productive with a new technology
When to choose Elixir
● The project has short terms and your team is not proficient
with Elixir
● Legacy applications where Operational Expenses are
lower than Development Expenses
When to not choose Elixir
elixir-lang.org
As a developer, you should care because with Elixir, you don’t have to give up scalability for fun.
- Bruce Tate CTO of icanmakeitbetter.com
http://icanmakeitbetter.com/icanmakeitbetter-com-and-elixir/
one more thing...
So, we like Elixir and have seen some pretty big wins with it.
The system that manages rate limits for both the Pinterest
API and Ads API is built in Elixir. Its 50 percent response time
is around 500 microseconds with a 90 percent response time
of 800 microseconds. Yes, microseconds.
- Steve Cohen | Pinterest engineer, Data
https://medium.com/@Pinterest_Engineering/introducing-new-open-source-tools-for-the-elixir-community-2f7bb0bb7d8c
From Ruby to Elixir
From Ruby to Elixir
From Ruby to Elixir

From Ruby to Elixir

  • 1.
  • 2.
    FROM RUBY TOELIXIR IT DAY KHERSON 2018
  • 3.
    FROM RUBY TOELIXIR IT DAY KHERSON 2018
  • 4.
  • 5.
    Why to developyet another language?
  • 7.
  • 9.
    Processors stopped gettingsignificantly faster but they started to scale by getting more cores
  • 10.
  • 11.
    SPARC M8-8 Server 256x 8 = 2048 hardware threads
  • 12.
  • 14.
    The Erlang runtimesystem is known for its designs that are well suited for systems with the following characteristics: ● Distributed ● Fault-tolerant ● Soft real-time, ● Highly available, non-stop applications ● Hot swapping, where code can be changed without stopping a system The Erlang programming language is known for the following properties: ● Immutable data ● Pattern matching ● Functional programming
  • 15.
    + better syntax +better error reporting + modern tooling + can use Erlang libraries + fresh enthusiastic community compiles into EVM bytecode, not into Erlang first
  • 16.
    I downloaded elixirlast week and started playing ... It didn't take long, but pretty soon my gut feeling kicked in. This is good shit. - Joe Armstrong https://joearms.github.io/published/2013-05-31-a-week-with-elixir.html
  • 18.
    There have tobe some code...
  • 20.
    Comparing Ruby andElixir… “When it comes to concurrency or distributed execution it feels like the language is on your side” - heard somewhere
  • 21.
  • 23.
    is Plug + Phoenixrouter + MVC project structure optional + Ecto integration + Brunch based assets pipeline + Phoenix Channels + Phoenix Presence
  • 24.
    about a secondto deliver a Wikipedia article to 2M clients in a single chat room
  • 25.
    Phoenix Channels vsRails Action Cable
  • 26.
    2x Digital Ocean16GB, 8-core instances for the client and server Rails: 75 rooms, 3750 users Phoenix: 1100 rooms, 55,000 users (maxed 55,000 client connections) 50 per room
  • 27.
    2x Digital Ocean16GB, 8-core instances for the client and server Rails: 9 rooms, 1800 users before availability was compromised when broadcasting. Phoenix: 275 rooms, 55,000 users (maxed 55,000 client connections) 200 per room
  • 28.
  • 38.
  • 39.
    We’ve also seenan improvement in code clarity. We’re converting our notifications system from Java to Elixir. The Java version used an Actor system and weighed in at around 10,000 lines of code. The new Elixir system has shrunk this to around 1000 lines. The Elixir based system is also faster and more consistent than the Java one and runs on half the number of servers. - Steve Cohen | Pinterest engineer, Data https://medium.com/@Pinterest_Engineering/introducing-new-open-source-tools-for-the-elixir-community-2f7bb0bb7d8c
  • 40.
    87 million uniqueusers (December 2017) https://blog.discordapp.com/tagged/engineering ● How Discord Scaled Elixir to 5,000,000 Concurrent Users ● How Discord handles push request bursts of over a million per minute with Elixir’s GenStage
  • 41.
    1.5 Billion pageviews per month 250000 concurrent users at peak 3+ Billion push notifications per month
  • 42.
    Ruby + $$$= Elixir poorly written Ruby application poorly written Elixir Application 150 Ruby servers < 5 Elixir servers
  • 43.
    Ruby + $$$= Elixir poorly written Ruby application poorly written Elixir Application 150 Ruby servers < 5 Elixir servers
  • 44.
    Ruby + $$$= Elixir poorly written Ruby application poorly written Elixir Application 150 Ruby servers < 5 Elixir servers
  • 45.
    NFL Draft 2016 generallybusiest night of the year 200M+ push notifications sent during day one 10x performance from last year Elixir: not autoscaling needed, just another day
  • 46.
    ● High-traffic systems ●Systems that do stuff asynchronously ● Distributed / clustered systems ● High-availability systems with true zero-downtime ● Server-side push and real-time applications ● Large applications ● Small microservice ● Your team is used to Elixir already ● A new project where the estimate can handle two weeks for your team to get productive with a new technology When to choose Elixir
  • 47.
    ● The projecthas short terms and your team is not proficient with Elixir ● Legacy applications where Operational Expenses are lower than Development Expenses When to not choose Elixir
  • 48.
    elixir-lang.org As a developer,you should care because with Elixir, you don’t have to give up scalability for fun. - Bruce Tate CTO of icanmakeitbetter.com http://icanmakeitbetter.com/icanmakeitbetter-com-and-elixir/
  • 49.
  • 51.
    So, we likeElixir and have seen some pretty big wins with it. The system that manages rate limits for both the Pinterest API and Ads API is built in Elixir. Its 50 percent response time is around 500 microseconds with a 90 percent response time of 800 microseconds. Yes, microseconds. - Steve Cohen | Pinterest engineer, Data https://medium.com/@Pinterest_Engineering/introducing-new-open-source-tools-for-the-elixir-community-2f7bb0bb7d8c

Editor's Notes

  • #3 https://www.slideshare.net/rubybd/rubyconf-bangladesh-2017-elixir-for-rubyists https://www.slideshare.net/BrooklynZelenka/elixir-and-phoenix-for-rubyists https://speakerdeck.com/whatyouhide/introduction-to-elixir
  • #28 https://dockyard.com/blog/2016/08/09/phoenix-channels-vs-rails-action-cable