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
Mongrel 2
Search
Will Speak
March 30, 2016
Technology
0
90
Mongrel 2
A quick introduction to the Mongrel 2 webserver protocol.
Will Speak
March 30, 2016
Tweet
Share
More Decks by Will Speak
See All by Will Speak
Opening your First Pull Request
iwillspeak
0
300
A Rusty Guide to Types and Safety
iwillspeak
0
150
Object Recognition with Grassmannian Manifolds
iwillspeak
0
93
Other Decks in Technology
See All in Technology
ビジネス文書に特化した基盤モデル開発 / SaaSxML_Session_2
sansan_randd
0
260
「Roblox」の開発環境とその効率化 ~DAU9700万人超の巨大プラットフォームの開発 事始め~
keitatanji
0
110
Rubyの国のPerlMonger
anatofuz
3
730
データ基盤の管理者からGoogle Cloud全体の管理者になっていた話
zozotech
PRO
0
370
【CEDEC2025】ブランド力アップのためのコンテンツマーケティング~ゲーム会社における情報資産の活かし方~
cygames
PRO
0
240
MCP認可の現在地と自律型エージェント対応に向けた課題 / MCP Authorization Today and Challenges to Support Autonomous Agents
yokawasa
5
2k
LTに影響を受けてテンプレリポジトリを作った話
hol1kgmg
0
320
反脆弱性(アンチフラジャイル)とデータ基盤構築
cuebic9bic
3
170
AIに頼りすぎない新人育成術
cuebic9bic
3
180
金融サービスにおける高速な価値提供とAIの役割 #BetAIDay
layerx
PRO
1
760
アカデミーキャンプ 2025 SuuuuuuMMeR「燃えろ!!ロボコン」 / Academy Camp 2025 SuuuuuuMMeR "Burn the Spirit, Robocon!!" DAY 1
ks91
PRO
0
120
Intro to Software Startups: Spring 2025
arnabdotorg
0
130
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Balancing Empowerment & Direction
lara
1
530
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Bash Introduction
62gerente
614
210k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
430
Producing Creativity
orderedlist
PRO
346
40k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
A Modern Web Designer's Workflow
chriscoyier
695
190k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Transcript
MONGREL 2 Will Speak
A STORY or how Mongrel 2 came to be
RAGEL in the beginning there was the state machine compiler
RAGEL STATE MACHINE COMPILER ⇒ Compiles state machines into code
tokenising, regex & parser combines
fast and efficient parsing
MONGREL then came a
Ruby webserver Rock solid HTTP parser Easily scalable
ØMQ along came a whole lot of nothing
Provides a brokerless messaging architecture where clients and servers communicate
via a Berkeley Sockets style interface “
a standard socket looks just like
a standard socket far more than
MONGREL 2 Add them all together and you get
fast and efficient parsing tried and tested HTTP support brokerless
scalability from Mongrel Ragel ZeroMQ
fast and efficient parsing tried and tested HTTP support brokerless
scalability from Mongrel Ragel ZeroMQ
fast and efficient parsing tried and tested HTTP support brokerless
scalability from Mongrel Ragel ZeroMQ
synchronous http requests offloads
persistent state async protocols &
A PROTOCOL or what Mongrel 2 can do for us
REQUEST/RESPONSE a millisecond in the life of a mongre2 request
None
Request 1 Server IIS-01 Headers { “method”: “post”, … }
Path /LockedQueueNoSql Body { “name”: “willspeak”, “affiliates”: [ …. ]}
Request 1 Server IIS-01 Headers { “method”: “post”, … }
Path /LockedQueueNoSql Body { “name”: “willspeak”, “affiliates”: [ …. ]}
Request 1 Server IIS-01 Response [ { … }, {
… }, …. ]
Request 1 Server IIS-01 Response [ { … }, {
… }, …. ]
None
None
None
None
None
NETSTRINGS simple data serialisation
12:hello world!, prefixed by length data encoded as UTF-8 assemble
the delimiter committee
PACKETS inside the envelope
12:hello world!, prefixed by length data encoded as UTF-8 assemble
the delimiter committee
REQUEST PACKET FORMAT IIS-01 1 hello/world 2:{},4:body, webserver id requested
path numeric request id netstring encoded json request headers netstring encoded request body
RESPONSE PACKET FORMAT IIS-01 1:1, hello Mongrel2 webserver id response
data space-separated netstring of response ids
DEMO what you’ve all been waiting for
USEFUL LINKS Mongrel 2 http://mongrel2.org/ https://github.com/mongrel2/mongrel2 Ragel http://www.colm.net/open-source/ragel/ http://zedshaw.com/archive/ragel-state-charts/ ØMQ
http://zeromq.org/ http://netmq.readthedocs.org/ netstrings https://cr.yp.to/proto/netstrings.txt