Misultin (pronounced mee-sool-t辿en) is an Erlang library for building fast lightweight HTTP(S) servers, which also supports websockets.
https://github.com/ostinelli/misultin
1 of 58
Downloaded 44 times
More Related Content
Misultin 0.7.1 Presentation
1. Misultin
[pron.: Mee-sool-t辿en]
An Erlang library for building fast lightweight HTTP(S) servers
>-|-|(属>
Erlang User Group London - May 16th, 2011
2. Who am I?
Technologist and Entrepreneur. I am
particularly interested in Erlang, Python,
scalability, research, development and
integration of the multiple technologies
behind the creation of ubiquitous
computing. Im currently co-founder
and CTO of WideTag Inc [widetag.com].
e: roberto@ostinelli.net
t: @ostinelli
4. What are Misultins?
Misultin are a culinary specialty of the Lake of Como.
They are lake 鍖shes that go by the latin name of Alosa
fallax lacustris, treated and cooked in a traditional
and speci鍖c way.
5. What is Misultin?
Misultin (pronounced mee-sool-t辿en) is an Erlang
library for building fast lightweight HTTP(S) servers,
which also supports websockets.
>-|-|(属>
6. Why another lib?
When do programmers start a new lib?
Nothing similar exists
Different Approach / Focus
Total Control / Knowledge
Experiment/Hack/Academic
7. Features v0.7.1
Embedded, not application
~ HTTP/1.1
Support for GET, POST, HEAD, PUT, DELETE, TRACE and CONNECT
SSL
Output compression [gzip, de鍖ate]
Chunked / Stream / File sending [attachment, visualization]
Customizable parameters [max_connections, post_max_size, get_url_max_size, ...]
Multiple servers on a single node [custom name / nameless]
Websockets [also on SSL]
Trapping of client closing a browser in Comet applications
With / without Parametrized Modules
39. Benchmarks | Foreword
No such thing as generic benchmarks: speci鍖c case
[fast application times, loads of connections, small data]
Fast is only 1 of the n features you want
[stability, features, ease of maintenance, low standard deviation, code usability, ...]
This is no pissing contest. *Not* what I wanted to see:
40. Benchmarks | Test
Not only Erlang
Chosen libraries are all lightweight & dynamic
[compare apple with apples: no Yaws, no Nginx]
Periodically close down the TCP connection
All tests run on a single CPU
No RAM/CPU considerations
41. Benchmarks | Test
Dynamic tests: no Hello world
The test basically asks servers to:
check if a GET variable is set
if the variable is not set, reply with an XML stating the error:
<http_test><error>no value specified</error></http_test>
if the variable is set, echo it inside an XML
<http_test><value>MYVALUE</value></http_test>
42. Benchmarks | Setup
Patched HttPerf
[for higher 鍖le handling]
Virtualized Up-to-date Ubuntu 10.04 LTS, 2CPU, 1.5G Ram
[tuning of /etc/sysctl.conf and /etc/security/limits.conf]
Libraries:
Misultin 0.7.1 (Erlang R14B02)
Mochiweb 1.5.2 (Erlang R14B02)
Cowboy master 420f5ba (Erlang R14B02)
NodeJS 0.4.7
Tornadoweb 1.2.1 (Python 2.6.5)
All the libraries have been run with the standard settings. Erlang
was launched with Kernel Polling enabled, and with SMP
disabled so that a single CPU was used by all the libraries.
50. Comet | Practical issues
HTTP Logic
Http Process
1. Building Req: {active, once} | gen_tcp:recv/3
2. Spawn HttpLoop, enter socket_loop/3
spawn_link/1
HttpLoop
Application Logic
51. Comet | Practical issues
HTTP Logic
Http Process
1. Building Req: {active, once} | gen_tcp:recv/3
2. Spawn HttpLoop, enter socket_loop/3
Actual TCP
sending
spawn_link/1
Data to be Sent
HttpLoop
Application Logic
52. Comet | Practical issues
HTTP Logic
Http Process
1. Building Req: {active, once} | gen_tcp:recv/3
2. Spawn HttpLoop, enter socket_loop/3
Actual TCP
sending => monitor Socket while in socket_loop?
spawn_link/1
Data to be Sent
HttpLoop
Application Logic
53. Comet | Practical issues
HTTP Logic
Http Process
1. Building Req: {active, once} | gen_tcp:recv/3
2. Spawn HttpLoop, enter socket_loop/3
Actual TCP
sending => monitor Socket while in socket_loop?
spawn_link/1 => get data from Socket while in socket_loop?
Data to be Sent
HttpLoop
Application Logic
54. Comet | Practical issues
HTTP Logic
Http Process
1. Building Req: {active, once} | gen_tcp:recv/3
2. Spawn HttpLoop, enter socket_loop/3
Actual TCP
sending => monitor Socket while in socket_loop?
spawn_link/1 => get data from Socket while in socket_loop?
Data to be Sent CONFLICT:
Catch Clients Socket closed event
HttpLoop Support HTTP pipelining
Application Logic
55. Comet | Practical issues
HTTP Logic
Http Process
1. Building Req: {active, once} | gen_tcp:recv/3
2. Spawn HttpLoop, enter socket_loop/3
Actual TCP
sending => monitor Socket while in socket_loop?
spawn_link/1 => get data from Socket while in socket_loop?
Data to be Sent CONFLICT:
Catch Clients Socket closed event
HttpLoop Support HTTP pipelining
SOLUTION:
Application Logic
handle_http(Req) ->
Req:options([{comet, true}]),
...