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
Grow Your Unix Beard With Ruby
Search
jstorimer
October 05, 2012
Programming
4
450
Grow Your Unix Beard With Ruby
jstorimer
October 05, 2012
Tweet
Share
More Decks by jstorimer
See All by jstorimer
Grow Your Unix Beard Using Ruby
jstorimer
11
660
Taming the Unicorn
jstorimer
3
240
Other Decks in Programming
See All in Programming
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
100
情報漏洩させないための設計
kubotak
1
130
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
Go の GC の不得意な部分を克服したい
taiyow
3
780
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
3
690
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
100
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
useSyncExternalStoreを使いまくる
ssssota
6
1k
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
The World Runs on Bad Software
bkeepers
PRO
65
11k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Designing for Performance
lara
604
68k
GitHub's CSS Performance
jonrohan
1030
460k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Bash Introduction
62gerente
608
210k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Transcript
Grow Your Unix Beard With Ruby Jesse Storimer Wednesday, 10
October, 12
@jstorimer Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Unix Ruby Wednesday, 10 October, 12
Wednesday, 10 October, 12
http://tomayko.com/writings/unicorn-is-unix Wednesday, 10 October, 12
Wednesday, 10 October, 12
:o Wednesday, 10 October, 12
Wednesday, 10 October, 12
Rack HTTP server for fast clients and Unix Wednesday, 10
October, 12
Rack HTTP server for fast clients and Unix Wednesday, 10
October, 12
Pre-forking Wednesday, 10 October, 12
forking Wednesday, 10 October, 12
Wednesday, 10 October, 12
fork() creates a new process Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
fork() returns twice Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
fork() returns twice Wednesday, 10 October, 12
fork() returns twice once, but in two processes Wednesday, 10
October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
fork() creates an exact copy of the calling process Wednesday,
10 October, 12
@hits = Array(1..5) pid = Process.fork do @hits.delete_at(1) puts "Child
hits: #@hits" end Process.wait(pid) puts "Parent hits: #@hits" Wednesday, 10 October, 12
$hits = Array(1..5) pid = Process.fork do $hits.delete_at(1) puts "Child
hits: #{$hits}" end Process.wait(pid) puts "Parent hits: #{$hits}" Wednesday, 10 October, 12
Pre-forking Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
def start open_listener_socket load_rack_app 2.times do fork { worker_loop }
end end def worker_loop loop do connection = listener_socket.accept process_client(connection) end end Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
copy on write: share memory until it’s modified Wednesday, 10
October, 12
CoW Friendly Rubies •MRI 2.0 •Ruby Enterprise Edition •MRI 1.9.3-p194-perf
Wednesday, 10 October, 12
http://bit.ly/mri-perf Wednesday, 10 October, 12
Wednesday, 10 October, 12
accept() accept() Wednesday, 10 October, 12
Wednesday, 10 October, 12
fast, efficient booting robust connection handling Wednesday, 10 October, 12
worker heartbeats self-pipe trick Wednesday, 10 October, 12
replace an instance of itself without losing any connections Wednesday,
10 October, 12
Wednesday, 10 October, 12
exec() transforms the calling process into a new process Wednesday,
10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
def reexec fork do cmd = [$0] cmd << ARGV.dup
ENV['LISTENERS'] = sockets.map(&:fileno) exec(*cmd) # exec("unicorn", "-c", "unicorn_config.rb") end end Wednesday, 10 October, 12
Wednesday, 10 October, 12
Old Master Worker Worker Wednesday, 10 October, 12
Old Master Worker Worker Worker Worker New Master Wednesday, 10
October, 12
Worker Worker New Master Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
The original Unix beards Wednesday, 10 October, 12
“[..] the Unix beard is really an extension of the
philosopher's beard, and the academic's beard.” Wednesday, 10 October, 12
Wednesday, 10 October, 12
Wednesday, 10 October, 12
Thanks! Tweet @jstorimer Email
[email protected]
Books http://workingwithcode.com Use MAGICRUBY to
save $10 Wednesday, 10 October, 12
Refs •http://www.colourlovers.com/palette/1938182/coconut_lips_RC •http://www.colourlovers.com/palette/1111659/Ninja_Rainbow •http://www.flickr.com/photos/soyunterrorista/2658174628/sizes/l/in/photostream/ •http://www.colourlovers.com/palette/1936237/Keynote_2 •http://whiteboardunicorns.com/ •http://www.flickr.com/photos/amyvdh/6003141750/sizes/o/in/photostream/ •http://www.twoideas.org/2009/07/unix-beards/ •http://www.flickr.com/photos/69er/463302758/ Wednesday,
10 October, 12