- lev is a platform for building servers more easily than Node. It is based on Lua and libuv and is faster and uses less memory than Node.
- The founders of lev overhauled lua-event and reimplemented many parts like cBuffer and MessagePack for better performance.
- lev supports multicore processing out of the box and has a redesigned API compared to lua-event.
3. What is `lev` ?
Lua for Event-based IO
libuv + LuaJIT
EventLoop Lua, JIT Engine
`lev` is platform/language that start
up a server more easily than Node
3
4. Concepts of `lev`
Fast !!
`lev` can easily reach over 10,000 requests per
core , machine and scales near-linearly.
Low Memory !!
At start-up, `lev` only allocates around 2MB
and after benchmarking HTTP a little over 3MB.
Easy C-libraries integration !!
`lev` is based on lua which has a very simple
and compact C ABI.
4
5. Who founded `lev` ?
founder: @kristate
cofounder: @hkanamur
`lev` is everything great about Node,without
the "BS" of JS.
― kristopher tate, lev founder
@kristate @hnakamur
5
6. Video message
from @kristate
http://www.ustream.tv/recorded/25501929
21:25-25:10
6
15. Benchmark
Results - Requests per second
ab -n 2000 -c 1
ab -n 2000 -c 10
ab -n 2000 -c 100
0 3750 7500 11250 15000
Node luvit lev
15
16. Benchmark
Results - Memory usage (output of ps)
startup
after ab -n 2000 -c 1
after ab -n 2000 -c 10
after ab -n 2000 -c 100
0 5 10 15 20
Node luvit lev
16
17. Implementation
We overhauled luvit, and
reimplementation
cBuffer
MessagePack
Build-in multicore
Redesigned API
Modules
Build system
Platform
17
19. MessagePack
lua-msgpack-native (*1)
author: @kengonakajima
full scratch
C implementation
5x ~ 10x faster than mplua (*2)
20x ~ 50x faster than luvit's JSON
Customization for cBuffer
build-in module
*1 https://github.com/kengonakajima/lua-msgpack-native
*2 https://github.com/nobu-k/mplua
19
20. Build-in multicore
Default build-in
Specify number of core at start up
$ lev -c 8 ./examples/http-simple-server.lua
Master-Worker process model
Shared listening socket
Communication: IPC
Messge format: Messagepack
Event notification: callbox
20
21. Redesigned API
Ex: fs
sync
local fs = require('lev').fs
local err, fd = fs.open('LICENSE.txt', 'r', '0666')
...
async
local fs = require('lev').fs
fs.open('LICENSE.txt', 'r', '0666', function(err, fd)
...
end)
21
22. Modules
lev timer
fs pipe
callbox
mpack
json
dns
tcp
udp
http
22
23. Build system
Makefile build system base
Future: cmake build system (by @xming)
Not use GYP build system
23
26. Conclusion
`lev` is platform/language that start up
a server more easily than Node
Fast
Low memory
Easy C-libraries integration
Overhauled and redesigned cBuffer base
Support multicore with build-in
26
27. Special Thanks !!
@kristate, @hnakamur
lev community
luvit team and luvit commuity
Mike Pall (LuaJIT)
@kengonakajima (lua-msgpack-native)
libuv, Node conributers, and Joyent
27