Greetings, Jesse and Community!
We at Synrc Research Center want to present a new fork from Nitrogen.
We've been used Nitrogen in production and have some experience in it.
Our main aim is to investigate far further ways of Nitrogen evolution.
Project highlights:
-- Binary page construction
-- Binary data transfer
-- Pure WebSockets nature of events
-- Optimization for latency and capacity
-- Clean codebase
We called it Nitrogen 2 Optimized (N2O). Main feature is WebSockets
async interface for page updates. No processes spawn, works within
Cowboy processes. Page render is several times faster than
original Nitrogen.
We choose Nitrogen for simple and elegant way of typed HTML page
construction like in Scala Lift, OCaml Ocsigen and Haskell Happstack.
Templated based approach pushes to to deal with raw HTML, like
Yesod, ASP, PHP, JSP, Rails, Yaws, ChicagoBoss. N2O goes further
and optimize rendering from binary iolists instead of slow Erlang
lists originated by Nitrogen.
We’ve measured all existing modern web frameworks with latest
functional languages and Cowboy still the king. You can see raw
HTTP performance of functional and C-like languages with concurrent
primitives (Go, D and Rust) on VAIO Z notebook with i7640M processor:
We outperform full Nitrogen stack with only 2X downgrade of
raw HTTP Cowboy performance thus rise rendering performance
several times in compare to any other functional web framework
and for sure it is faster than raw HTTP node.js performance.
N2O doesn’t use JSON, all message data passed over WebSockets
encoded with native Erlang External Term Format which is easily
parsed in JavaScript with Bert.decode(msg) and helps to avoid
complexity on server-side.
Original Nitrogen was tested in production under high-load and
we decided to drop out nprocreg process registry along with
action_comet heavy process creation. N2O now creates only
one process for async websocket handler, all async operations
are handled withing Cowboy processes.
We feel free to brake original Nitrogen compatibility because
we want to have clean codebase and investigate future ways
of evolution. However we still able to easily port old Nitrogen
web sites to N2O.
We return back id and class semantics of HTML and removed html_id.
We simplify render without html_encode which should be handled by
application layer. nitrogen.js originaly created by Rusty for XHR
was removed due to pure WebSocket nature of N2O and native
jQuery handling. E.g.
#button { id=sendButton, text=<<"Send">>, postback=chat }
renders to:
<input id="sendButton" type="button" class="sendButton button" value="Send"/>
<script>$('#sendButton').bind('click',function anonymous(event) {
ws.send(Bert.encodebuf({source: Bert.binary('sendButton'),
pickle: Bert.binary('R2LH0INQAAAAWXicy2DKYEt...'),
x: Bert.binary('undefined')}));});</script>
Despite early stages of project we decided to write this letter to
all users of Nitrogen. Our intention is to make all of them more
happy from using Nitrogen.
However we still continue to use original Nitrogen over XHR basically due
to customer's browser compatibility needs. Also we want to thank all
users who contributes code to the greatest Erlang Web Framework.
You can give stars, spawn forks and follow us here:
--
Maxim Sokhatsky
Synrc Research Center