summaryrefslogtreecommitdiffstats
path: root/talks/ranch-msgpack/ranch-msgpack.html
blob: acc87a047defcec912b1e4acfb9005f555b02651 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Build custom protocols with Ranch and msgpack</title>
<!-- metadata -->
<meta charset="utf8" />
<meta name="generator" content="S5" />
<meta name="version" content="S5 1.1" />
<meta name="presdate" content="20130209" />
<meta name="author" content="Loïc Hoguin" />
<meta name="company" content="Nine Nines" />
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
<meta name="controlVis" content="visible" />
<!-- style sheet links -->
<link rel="stylesheet" href="ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
<link rel="stylesheet" href="ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
<link rel="stylesheet" href="ui/default/print.css" type="text/css" media="print" id="slidePrint" />
<link rel="stylesheet" href="ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
<!-- S5 JS -->
<script src="ui/default/slides.js" type="text/javascript"></script>
</head>
<body>

<div class="layout">
<div id="controls"><!-- DO NOT EDIT --></div>
<div id="currentSlide"><!-- DO NOT EDIT --></div>
<div id="header">
	<div id="sub_header"></div>
	<div id="logo"><img src="ui/img/logo.svg"/></div>
</div>
<div id="footer">
<div id="footer_shadow"></div>
<h1>Build custom protocols with Ranch and msgpack</h1>
<h2>Erlang Factory Lite Munich 2013, Nine Nines</h2>
</div>

</div>


<div class="presentation">

<div class="slide">
<h1>Build custom protocols with Ranch and msgpack</h1>
<h2>Building protocols is fun!</h2>
<h3>Loïc Hoguin - @lhoguin</h3>
<h4>Erlang Cowboy and Nine Nines Founder</h4>
</div>


<div class="slide">
<h1>Essentials</h1>
</div>


<div class="slide">
<h1>Ranch</h1>
<ul>
<li>Spin-off from Cowboy</li>
<li>Transport and protocol agnostic acceptor pool</li>
<li>Fully dynamic</li>
<li>Well documented</li>
<li>Production ready</li>
<li>Tested with &gt; 1 million Websocket connections</li>
</ul>
</div>


<div class="slide">
<h1>msgpack 1/2</h1>
<ul>
<li>"It's like JSON. but fast and small."</li>
<li>Binary serialization library</li>
<li>Deserialization is streamable</li>
<li>http://msgpack.org</li>
</ul>
</div>


<div class="slide">
<h1>msgpack 2/2</h1>
<ul>
<li>Available for Ruby, Python, Perl, C/C++, Java, Scala, PHP, Lua, JavaScript, Node.js, Haskell, C#, Objective-C, Erlang, D, OCaml, Go, LabVIEW, Smalltalk</li>
</ul>
</div>


<div class="slide">
<h1>Using msgpack with Ranch</h1>
<ul>
<li>PASTE LIVE DEMO HERE</li>
</ul>
</div>


<div class="slide">
<h1>Guide to building a msgpack RPC service</h1>
<ul>
<li>You most likely won't need async, sync is easier to pull off</li>
<li>You most likely don't need connection pooling</li>
<li>Follow the HTTP request/response model</li>
<li>Send a request, expect a response, continue if successful</li>
<li>Don't forget to close the connection when done</li>
</ul>
</div>


<div class="slide">
<h1>The future of Ranch</h1>
</div>


<div class="slide">
<h1>Custom connections supervisor</h1>
<ul>
<li>Remove the need to monitor processes twice</li>
<li>Reduce the overhead to a minimal</li>
<li>No gen.erl, gen_server.erl</li>
<li>No options to take care of, no restart strategy</li>
<li>Bare minimum</li>
</ul>
</div>


<div class="slide">
<h1>Minimal supervisor</h1>
<ul>
<li>Special process</li>
<li>Traps exits</li>
<li>Exit when parent exits</li>
<li>Handle '$gen_call' messages</li>
<li>Reply properly to which_children message</li>
</ul>
</div>


<div class="slide">
<h1>Results</h1>
<ul>
<li>About 100LOCs for the supervisor</li>
<li>Greatly simplified architecture of the project</li>
<li>Much improved performance, especially with many connections</li>
<li>Still OTP</li>
</ul>
</div>


<div class="slide">
<h1>Thanks!</h1>
<ul>
<li>http://ninenines.eu</li>
<li>https://github.com/extend/ranch</li>
<li>#ninenines on Freenode</li>
<li>@lhoguin on Twitter</li>
</ul>
</div>


<div class="slide">
<h1>Questions?</h1>
</div>


</div>

</body>
</html>