summaryrefslogblamecommitdiffstats
path: root/talks/cowboy-0.8/cowboy-0.8.html
blob: e3e1d7dd511916b38eed352285c8d4d6f8ea3225 (plain) (tree)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612



































































































































































































































































































































































































































































































































































































































                                                                                                         
<!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>The new Cowboy</title>
<!-- metadata -->
<meta charset="utf8" />
<meta name="generator" content="S5" />
<meta name="version" content="S5 1.1" />
<meta name="presdate" content="20130322" />
<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>Erlang Factory SF 2013</h1>
<h2>The new Cowboy, Nine Nines</h2>
</div>

</div>


<div class="presentation">

<div class="slide">
<h1>The new Cowboy</h1>
<h2>Le Cowboy nouveau est arrivé !</h2>
<h3>Loïc Hoguin - @lhoguin</h3>
<h4>Erlang Cowboy and Nine Nines Founder</h4>
</div>


<div class="slide">
<h1>The Cowboy guy</h1>
</div>


<div class="slide">
<h1>Fact 1</h1>
<ul>
<li>I know you but I forgot your name or face, remind me!</li>
</ul>
</div>


<div class="slide"> 
<h1>Fact 2</h1>
<ul>
<li>Not drinking alcohol, offer me a coke, not a beer!</li>
</ul>
</div>


<div class="slide">
<h1>Fact 3</h1>
<ul>
<li>I forget my hat all the time. :(</li>
</ul>
</div>


<div class="slide">
<h1>The road so far</h1>
</div>


<div class="slide">
<h1>Beginnings</h1>
<ul>
<li>Unsatisfied with existing solutions</li>
<li>Wanted a mix of Webmachine and Misultin<ul>
	<li>With binaries</li>
	<li>And dynamic "listeners"</li>
	<li>And some icing on top</li>
</ul></li>
<li>First commit on March 7th 2011</li>
</ul>
</div>


<div class="slide">
<h1>Initial goals</h1>
<ul>
<li>Binary</li>
<li>Dynamic listeners</li>
<li>Low latency and memory usage</li>
<li>One Erlang process per connection</li>
<li>Small codebase</li>
<li>Clean Erlang code</li>
</ul>
</div>


<div class="slide">
<h1>Initial reactions</h1>
<ul>
<li>Encouraging</li>
<li>Community started growing slowly</li>
<li>People started recommending Cowboy to others</li>
<li>First Cowboy talk at EUC 2011 had a full room</li>
</ul>
</div>


<div class="slide">
<h1>Misultin's help</h1>
<ul>
<li>Great project</li>
<li>Still unmatched in usability</li>
<li>Development stopped in favor of Cowboy</li>
<li>Boosted Cowboy's adoption</li>
<li>My thanks go to Roberto Ostinelli</li>
</ul>
</div>


<div class="slide">
<h1>The road to stable</h1>
<ul>
<li>Few changes for about 6 months</li>
<li>Spent a lot of time figuring things out</li>
<li>Then spent a lot more time getting things done</li>
<li>A few improvements remain to be done</li>
</ul>
</div>


<div class="slide">
<h1>Recent changes</h1>
</div>


<div class="slide">
<h1>Mascot</h1>
<img src="pics/cowboy.png"/>
</div>


<div class="slide">
<h1>New goals</h1>
<ul>
<li>Complete HTTP stack</li>
<li>Complete support for the modern web</li>
<li>Good documentation</li>
<li>Stable version</li>
<li>Target non-Erlang developers</li>
</ul>
</div>


<div class="slide">
<h1>New conventions</h1>
<ul>
<li>Everything is a binary, including method and header names</li>
<li>HTTP header names are lowercase</li>
<li>cowboy_http_req -&gt; cowboy_req</li>
<li>cowboy_http_* -&gt; cowboy_*</li>
</ul>
</div>


<div class="slide">
<h1>HTTP</h1>
<ul>
<li>Improved HTTP/1.1 and HTTP/1.0 support</li>
<li>Built-in response compression</li>
<li>Built-in parsing of HTTP headers</li>
<li>Much faster request body streaming code</li>
<li>Properly detect socket close in long-polling</li>
</ul>
</div>


<div class="slide">
<h1>HTTP Req</h1>
<ul>
<li>Normalized cowboy_req API</li>
<li>Access: {Value, Req}</li>
<li>Action: {Result, Req} | {Result, Value, Req} | {error, atom()}</li>
<li>Modification: Req</li>
<li>Question: boolean()</li>
</ul>
</div>


<div class="slide">
<h1>Websocket</h1>
<ul>
<li>Fully passes the Autobahn test suite</li>
<li>Much faster at processing frames</li>
<li>Text frames now required to be valid UTF-8</li>
</ul>
</div>


<div class="slide">
<h1>REST</h1>
<ul>
<li>Better error reporting</li>
<li>PATCH method support</li>
<li>Still experimental, no documentation</li>
<li>Widely adopted by users</li>
</ul>
</div>


<div class="slide">
<h1>More powerful routing</h1>
<ul>
<li>Routes must now be compiled</li>
<li>Nicer string-based syntax</li>
<li>Constraints: apply functions on bound values</li>
<li>Allows distinguishing between these two:<ul>
	<li>/api/42/add</li>
	<li>/api/blue/add</li>
</ul></li>
</ul>
</div>


<div class="slide">
<h1>Middlewares</h1>
<ul>
<li>Hook code at any point in request handling</li>
<li>Replace routing or handling components of request processing</li>
<li>Not WSGI</li>
<li>WSGI: data centric, chain request, then reverse chain response</li>
<li>Cowboy: chain of execution, only chain request, response happens at any point</li>
</ul>
</div>


<div class="slide">
<h1>Documentation</h1>
<ul>
<li>Cowboy now has a guide!</li>
<li>Still many improvements can be made</li>
<li>Feedback needed</li>
</ul>
</div>


<div class="slide">
<h1>Focus on performance</h1>
</div>


<div class="slide">
<h1>Improvements</h1>
<img src="pics/adgear.png"/>
</div>


<div class="slide">
<h1>Testing in production</h1>
<ul>
<li>Synthetic benchmarks don't help</li>
<li>Most interesting results are under heavy load</li>
<li>Users' production systems are the best benchmark</li>
<li>The PROWESS Project might deliver benchmarking tools later on</li>
</ul>
</div>


<div class="slide">
<h1>NIFs and BIFs</h1>
<ul>
<li>NIFs considered harmful</li>
<li>BIFs can be harmful too!</li>
<li>BIF doesn't mean "fast" or "scheduler friendly"</li>
</ul>
</div>


<div class="slide">
<h1>Example of BIFs killing scalability</h1>
<ul>
<li>erlang:decode_packet/3</li>
<li>binary:match/2</li>
<li>lists:length/1</li>
<li>...</li>
</ul>
</div>


<div class="slide">
<h1>Performance tips</h1>
<ul>
<li>Measure, measure, measure</li>
<li>Don't assume something is faster, measure it</li>
<li>Optimize the critical code path</li>
<li>Don't waste your time on code that is rarely ran</li>
</ul>
</div>


<div class="slide">
<h1>Project status</h1>
</div>


<div class="slide">
<h1>Actively developed</h1>
<ul>
<li>Cowboy is Nine Nines' main product</li>
<li>Cowboy is the central project of a family</li>
<li>Cowboy is key to Nine Nines' future SaaS solution</li>
</ul>
</div>


<div class="slide">
<h1>Popular</h1>
<img src="pics/popularity-feb-2013.png"/>
</div>


<div class="slide">
<h1>Many contributors</h1>
<ul>
<li>Exponential growth</li>
<li>More than 50 total contributors in 2 years</li>
<li>Half of them over the past 9 months!</li>
<li>470+ total tickets</li>
<li>200+ total pull requests</li>
</ul>
</div>


<div class="slide">
<h1>Many success stories</h1>
<ul>
<li>Kóði for realtime financial market data streaming</li>
<li>2600Hz in Kazoo, their telecom platform</li>
<li>Heroku for Logplex, a high-performance, realtime system for log delivery</li>
<li>Linden Lab for Versu, an interactive storytelling platform</li>
<li>BLOOM for AdGear, their realtime ad bidding system</li>
</ul>
</div>


<div class="slide">
<h1>More success stories</h1>
<ul>
<li>jtendo.com for a dynamic mobile provisioning system</li>
<li>Tambur.IO for realtime web and mobile messaging PaaS</li>
<li>Unison for realtime collaborative environment</li>
<li>LeChat.im for their realtime team chat system</li>
<li>Others: TV, Sports, Set-top boxes, ...</li>
</ul>
</div>


<div class="slide">
<h1>Success story template</h1>
<ul>
<li>Service needs high-performance, realtime capabilities</li>
<li>Service is using HTTP either directly or for inter-connecting systems</li>
<li>Service needs a REST API and Websocket support</li>
<li>Service may be used for web or mobile applications</li>
<li>Bonus points for gaming related projects</li>
</ul>
</div>


<div class="slide">
<h1>Many open source projects</h1>
<ul>
<li>Compatible web frameworks: Nitrogen, ChicagoBoss, axiom...</li>
<li>Open source users:<ul>
	<li>RabbitMQ</li>
	<li>LeoFS</li>
	<li>Project-FiFo</li>
	<li>Ybot</li>
	<li>fipelines</li>
	<li>Bigwig (needs a maintainer!)</li>
</ul></li>
</ul>
</div>


<div class="slide">
<h1>Repository of Cowboy applications</h1>
<ul>
<li>Chapter in the guide for listing Cowboy applications</li>
<li>Please open pull requests to add your project</li>
</ul>
</div>


<div class="slide">
<h1>Related projects</h1>
</div>


<div class="slide">
<h1>Ranch</h1>
<ul>
<li>Listener and acceptor code spin-off from Cowboy</li>
<li>Supervises connections automatically</li>
<li>Abstracts transport and protocol code</li>
<li>Can be embedded into your own supervision tree</li>
</ul>
</div>


<div class="slide">
<h1>Bullet</h1>
<ul>
<li>Cowboy handler</li>
<li>Websocket-like behavior on all browsers</li>
<li>Permanent connection, reconnects on failure</li>
</ul>
</div>


<div class="slide">
<h1>Farwest</h1>
<ul>
<li>A mix of web framework and CMS</li>
<li>Gives users autonomy to build and manage Erlang web applications</li>
<li>First alpha version just released!</li>
<li>Huge amount of development needed</li>
<li><a href="http://bountysource.com">Bountysource.com Farwest fundraiser</a> just started</a></li>
</ul>
</div>


<div class="slide">
<h1>LeoFS</h1>
<ul>
<li>The Lion of storage systems</li>
<li>Distributed file system compatible with Amazon S3 API</li>
<li>Powered by Cowboy</li>
<li>Focuses on high throughput instead of latency</li>
</ul>
</div>


<div class="slide">
<h1>Future works</h1>
</div>


<div class="slide">
<h1>Remaining API breaking changes</h1>
<ul>
<li>Improved POST handling in REST</li>
<li>Improved request body reading</li>
<li>Removal of cowboy_req:peer_addr/1</li>
</ul>
</div>


<div class="slide">
<h1>Connections supervisor</h1>
<ul>
<li>Duplicate work with 'max_connections' related monitors</li>
<li>Overhead on creation and especially termination</li>
<li>Custom supervisor can fill in both roles</li>
<li>Makes other optimizations possible</li>
</ul>
</div>


<div class="slide">
<h1>SPDY</h1>
<ul>
<li>Asynchronous, fully compressed, binary HTTP</li>
<li>One process per connection + one process per request</li>
<li>Same code for HTTP and SPDY requests</li>
<li>Headers in SPDY are lowercase too, no conversion needed</li>
</ul>
</div>


<div class="slide">
<h1>Complete HTTP support</h1>
<ul>
<li>Parsing code for all standard HTTP headers</li>
<li>Allow users to build any HTTP compatible technology on top of Cowboy</li>
<li>Support for Websocket extensions</li>
<li>Support for SPDY based HTTP/2.0 when implementations come out</li>
</ul>
</div>


<div class="slide">
<h1>Version 1.0</h1>
<ul>
<li>All of the above</li>
<li>Stable API</li>
<li>Fully documented</li>
<li>Work won't stop there!</li>
</ul>
</div>


<div class="slide">
<h1>Getting help</h1>
</div>


<div class="slide">
<h1>Community support</h1>
<ul>
<li>#ninenines on Freenode</li>
<li>Mailing list on http://ninenines.eu</li>
</ul>
</div>


<div class="slide">
<h1>Consulting and commercial support</h1>
<ul>
<li>Hourly remote or on-site consulting</li>
<li>A la carte commercial support<ul>
	<li>Specific developments</li>
	<li>System optimization</li>
	<li>Code reviews</li>
	<li>On-call support</li>
	<li>For both Erlang and Cowboy</li>
</ul></li>
</ul>
</div>


<div class="slide">
<h1>Getting involved</h1>
</div>


<div class="slide">
<h1>Contributing</h1>
<ul>
<li>Tell me where you use Cowboy and for what</li>
<li>Send me graphs showing how new Cowboy versions improve things</li>
<li>Report bugs on Github</li>
<li>Send patches, see CONTRIBUTING.md file</li>
</ul>
</div>


<div class="slide">
<h1>Sponsoring</h1>
<ul>
<li>Gives you visibility</li>
<li>Gives us a budget</li>
</ul>
</div>


<div class="slide">
<h1>The Cowboy book</h1>
<ul>
<li>The Bible of writing web applications with Erlang and Cowboy</li>
<li>Accessible by people who never programmed Erlang</li>
<li>Goes into and explains advanced web development concepts</li>
<li>Published online for free as it is written</li>
<li>Hard-copy will be released when the book is completed</li>
</ul>
</div>


<div class="slide">
<h1>One more thing</h1>
</div>


<div class="slide">
<h1>Hello, Joe</h1>
<ul>
<li>Cowboy will make an appearance in Programming Erlang 2nd Edition!</li>
</ul>
</div>


<div class="slide">
<h1>Contact info</h1>
<ul>
<li>IRC: essen on #erlang or #ninenines on Freenode</li>
<li>Twitter: @lhoguin</li>
<li>Sales: [email protected]</li>
</ul>
</div>


</div>

</body>
</html>