Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Let's Chat
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Garrett Heinlen
September 12, 2017
Education
450
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Let's Chat
Ruby and Elixir. An exploration of cross language communication
Garrett Heinlen
September 12, 2017
More Decks by Garrett Heinlen
See All by Garrett Heinlen
Event Sourcing: Don't want to miss a thing
gogogarrett
0
140
Lets Program - A practical guide
gogogarrett
0
70
StudyGroups
gogogarrett
1
93
:gen_fsm meets elixir
gogogarrett
1
380
Intro into Ecto
gogogarrett
2
89
Hopscotch
gogogarrett
1
170
Ember Testing: is it a mirage?
gogogarrett
1
180
Elixir and Phoenix
gogogarrett
0
220
WTF is WF
gogogarrett
1
140
Other Decks in Education
See All in Education
参加制約理論
roadofhope
0
150
学習者データを「見る」:外国語教師のためのデータの入力、分析、解釈方法
uranoken
0
150
Examen de Selectividad. Geografía junio 2026 (Convocatoria Ordinaria). UCLM
juanmartin2026
1
4.8k
2026年度春学期 統計学 第15回 分布についての仮説を検証する ― 仮説検定(2) (2026. 7. 9)
akiraasano
PRO
0
110
プロポーザルを書く技術とアンチパターン/proposal-writing-and-antipatterns
moriyuya
13
3.7k
マークシート試験のTeX言語を用いた自動採点について
doratex
0
620
観察、仮説、実行、検証、計画、提案を一年で3000回トレーニングする方法/3000 Thinking Loops in 365 Days
moriyuya
4
700
Geografía y Fútbol: Chattanooga Geografía del Búnker de La Roja.
juanmartin2026
1
12k
遊ぶかね欲しさの犯行(ルビ:労働)です
shirayanagiryuji
0
220
Throw Yourself In! - How I've learned English and What I'm Facing
georgeorge
1
220
Center for Entrepreneurship Education | Science Tokyo (Institute of Science Tokyo)
sciencetokyo
PRO
0
210
AWS Skill Builderを活用した一石二鳥の業務計画
ysaeki
0
120
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
270
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
Everyday Curiosity
cassininazir
0
280
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
790
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
770
Transcript
Let's Chat Ruby and Elixir. An exploration of cross language
communication
Hey, I'm Garre!
None
None
I work for Blake Education
We teach children
None
We use Ruby && Elixir
Why did we move? — really fast — immutable data
— parallel / concurrent — easy to isolate complexity into applications (microservices w/o http) — encourages better design — shiny — does your taxes — #1 hacker news
Agenda — Refresher on Ruby — Explain Redis — Explore
Sidekiq — Introduce Elixir — Demo — Recap
Refresher on Ruby
Ruby - Hash We use keys to unlock values
Ruby - Hash ! ! " # ! " $
! " %
Ruby - Hash ! my_house ! door_1 " # shower
! door_2 " $ living_room ! door_3 " % bedroom
Ruby - Hash my_house = { door_1: "shower", door_2: "living_room",
door_3: "bedroom", }
Ruby - Hash person = { name: "Garrett", age: 27,
hearthstone_rank: 3, fav_things: [] } person[:hearthstone_rank] # => 3 person[:fav_things] << "gummy bears" # => ["gummy bears"]
Ruby - Array An Array is a list of items
in order
Ruby - Array ! " # $ %
Ruby - Array
Ruby - Array a = [] # => [] a
<< "abc" # => ["abc"] a # => ["abc"] a.pop # => "abc" a # => []
Ruby - Array a = [] # => [] a.push("abc")
# => ["abc"] a # => ["abc"] a.pop # => "abc" a # => []
Ruby - Array Appending to a list x << y
x.push(y)
Ruby - Array Pulling items off a list x.pop(y)
Ruby - Array Push && Pop x.push(y) x.pop(y)
None
PushPop
Well, that's Ruby.
Explain Redis
Redis is a hash in the cloud.
$redis = {} # setter $redis[:thought] = "Where's the Elixir
already?" # getter $redis[:thought] # => "Where's the Elixir already?" # setter $redis[:drinks] << "little creatures" $redis[:drinks] << "150 lashes" # getter $redis[:drinks] # => ["little creatures", "150 lashes"]
$ redis-cli set thought "Where's the Elixir already?" get thought
# => "Where's the Elixir already?" rpush drinks "little creatures" rpush drinks "150 lashes" lrange drinks 0 -1 # => 1) "little creatures" # => 2) "150 lashes" lpop drinks # => "little creatures"
Redis Desktop Manager
Explore Sidekiq
Sidekiq framework for background job processing
Why do I need a Sidekiq
¯\(ϑ)/¯
Common Use cases — Emails — Expensive computation — Imagine
Processing — Reports — Etc..
None
Sidekiq is built on 3 parts — Client — push
jobs into redis — Redis — store the jobs — Server — process the jobs
Client MyWorker.perform_async({abc: "123", simple_as: "drm"}) Redis rpush queue:default "{\"class\":\"MyWorker\",\"args\":[{\"abc\":\"123\",\"simple_as\":\"drm\"], \"retry\":true,\"queue\":\"default\",
\"jid\":\"f03cd72fef59bfbbf4098890\", \"created_at\":1503728661.8513222,\"enqueued_at\":1503728661.851379}" Server class MyWorker include Sidekiq::Worker def perform(hash) puts hash.inspect # => {abc: "123", simple_as: "drm"} end end
Client class SomethingSingularOrPluarl < BigBaseController def create MyWorker.perform_async(superfriend_params) head :created
end private def superfriend_params params.permit! # {abc: "123", simple_as: "drm"} end end
Redis
Server class MyWorker include Sidekiq::Worker def perform(hash) puts hash.inspect #
=> {abc: "123", simple_as: "drm"} end end
Lets Chat, A practical application
Sidekiq - how does it work? # clients rpush "redis:jobs"
{assignee: "Audience Member", task: "Greet your neighbour"} rpush "redis:jobs" {assignee: "Audience Member", task: "Take a drink"} rpush "redis:jobs" {assignee: "Audience Member", task: "Heckle louder"} rpush "redis:jobs" {assignee: "Audience Member", task: "Do Garrett's Taxes"} # sidekiq while true job = lpop "redis:jobs" if job AudienceMember.perform(job) end end
None
Well, thats Sidekiq.
Introduce Elixir
Elixir can act as the Server.
Exq job processing library compatible with Sidekiq for Elixir
Configure Exq config :exq, host: "localhost", port: 6379, namespace: "",
concurrency: 10, queues: ["default"], poll_timeout: 200
Ruby Sidekiq Server class MyWorker include Sidekiq::Worker def perform(hash) puts
hash.inspect # => {abc: "123", simple_as: "drm"} end end
Elixir Sidekiq Server defmodule MyWorker do def perform(map) do IO.inspect(map)
# => %{abc: "123", simple_as: "drm"} end end
Demo Time !
None
Recap — Redis is a Hash — We push jobs
into a list — We pull jobs off the list — We can process the jobs with Ruby or Elixir — Exq is the Elixir Sidekiq
Thanks @gogogarre!