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
440
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
650
Taming the Unicorn
jstorimer
3
230
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
460
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.4k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
6
980
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
240
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
450
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
200
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
290
Android 15 でアクションバー表示時にステータスバーが白くなってしまう問題
tonionagauzzi
0
150
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
C#/.NETのこれまでのふりかえり
tomokusaba
1
170
Kotlin2でdataクラスの copyメソッドを禁止する/Data class copy function to have the same visibility as constructor
eichisanden
1
150
WEBエンジニア向けAI活用入門
sutetotanuki
0
310
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
23k
Designing on Purpose - Digital PM Summit 2013
jponch
115
6.9k
Designing for humans not robots
tammielis
249
25k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
328
21k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
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