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
460
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
670
Taming the Unicorn
jstorimer
3
240
Other Decks in Programming
See All in Programming
Alba: Why, How and What's So Interesting
okuramasafumi
0
210
ASP.NET Core の OpenAPIサポート
h455h1
0
120
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
28
4.2k
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
13
2.3k
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
940
Scaling your build logic
antalmonori
1
100
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
590
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
390
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
44
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
173
51k
Faster Mobile Websites
deanohume
305
30k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
240
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Designing for Performance
lara
604
68k
How to train your dragon (web standard)
notwaldorf
89
5.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Building Applications with DynamoDB
mza
93
6.2k
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