SlideShare a Scribd company logo
1 of 30
lev
Tokyo Node Gakuen 7
       periods
    2012/09/18
     @kazupon
     (kazu_pon)
         1
Introduction
@kazupon
name: kazuya kawaguchi
twitter: kazu_pon
Job
OKI -> Bluebridge -> Freelance (now)
Flont-end Engneer? Back-end Engneer?
Work
Zenback, and others ...
Node
connect-kyoto
kyotocabinet-node
SabaDB
                      2
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
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
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
Video message
       from @kristate
http://www.ustream.tv/recorded/25501929
             21:25-25:10


                  6
`lev`
  Fork from luvit, overhaul,
  reimplementation




               $ git diff --shortstat 173c91...master




https://github.com/connectFree/lev/compare/
173c91e383361fb09c1e7f973f6e24bec0d4fcec...master
                                           7
`lev`
connectFree open source
Apache 2.0 license




                 8
Contributors


@hnakamur                @dvv


            @kristate



 @xming                 @kazupon
               9
Community
github
http://github.com/connectFree/lev




IRC
freenode: #levdev, #lev-jp




                     10
Demo
      chat
bit.ly/levchat


      11
Benchmark
Measurement item
 Requests per second
 Memory usage
Measurement Pattern
   ab -n 2000 -c 1
   ab -n 2000 -c 10
   ab -n 2000 -c 100



                12
Benchmark
 Enviroments

                       100BASE-T
                        Ethernet


        Client        direct connect          Server
MacBook Pro Retina, Mid 2012        Macbook, Early 2009
* CPU: 2.6 GHz Intel Core i7        * CPU: 2GHz Intel Core 2 Duo
* RAM: 16GB 1600 MHz DDR3           * RAM: 4GB 667 MHz DDR2 SDRAM
* Disk: 512GB                       * Disk: 256GB
  APPLE SSD SM512E                    FUJITSU MHZ2250BH FFS G1 Media
* OS: Mac OS X 10.8 Mountain        SATA
Lion                                * OS: Mac OS X 10.7.3 Lion

                               13
Benchmark
Version
  Node: 0.8.9
  luvit: 0.5.0
  lev: b03a16d (git commit hash)




                 14
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
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
Implementation
We overhauled luvit, and
reimplementation
 cBuffer
 MessagePack
 Build-in multicore
 Redesigned API
 Modules
 Build system
 Platform

                      17
cBuffer
Buffer module
                 lev_slab_allocator_t mem_1k;                lev_slab_allocator_t mem_8k;

                   MemBlock pool[];                              MemBlock pool[];


C                   bytes: 1024                                  bytes: 1024

                                                                                     ... x8

implementation                    lev_slab_allocator_t mem_16k;


Allocated                              MemBlock pool[];
                                        bytes: 1024

special slab                                                 ... x16



allocator        lev_slab_allocator_t mem_64k;               lev_slab_allocator_t mem_1024k;

                   MemBlock pool[];                              MemBlock pool[];

Byte array          bytes: 1024
                                      ... x64
                                                                 bytes: 1024
                                                                                    ... x1024


Seamless                                        MemSlice

conversion to                                    char *slice;
                                                 size_t until;

string                                lev.Buffer

                    18
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
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
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
Modules
lev               timer
fs                pipe
callbox
mpack
json
dns
tcp
udp
http
             22
Build system
Makefile build system base
 Future: cmake build system (by @xming)
Not use GYP build system




                  23
Platform
*NIX
 Linux, Darwin, Freebsd, and other ...




Not support Windows




                    24
Loadmap (Wishlist)
Build-in Web application framework
Build-in Package managment tool
Choice regular expression library
Resolve callback hell
... etc




                 25
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
Special Thanks !!
@kristate, @hnakamur
lev community
luvit team and luvit commuity
Mike Pall (LuaJIT)
@kengonakajima (lua-msgpack-native)
libuv, Node conributers, and Joyent




                27
Thank you
for listening to my
       session


         28
Question ?



    29
Reference
luvit
  http://luvit.io/
  https://github.com/creationix/
  nodeconf2012
  http://coderwall.com/p/gkokaw
benchmark data
  git://gist.github.com/3727820.git




                     30

More Related Content

What's hot

Kernelvm 201312-dlmopen
Kernelvm 201312-dlmopenKernelvm 201312-dlmopen
Kernelvm 201312-dlmopen
Hajime Tazaki
 
CETH for XDP [Linux Meetup Santa Clara | July 2016]
CETH for XDP [Linux Meetup Santa Clara | July 2016] CETH for XDP [Linux Meetup Santa Clara | July 2016]
CETH for XDP [Linux Meetup Santa Clara | July 2016]
IO Visor Project
 
Direct Code Execution - LinuxCon Japan 2014
Direct Code Execution - LinuxCon Japan 2014Direct Code Execution - LinuxCon Japan 2014
Direct Code Execution - LinuxCon Japan 2014
Hajime Tazaki
 

What's hot (20)

Kernelvm 201312-dlmopen
Kernelvm 201312-dlmopenKernelvm 201312-dlmopen
Kernelvm 201312-dlmopen
 
OpenStack networking juno l3 h-a, dvr
OpenStack networking   juno l3 h-a, dvrOpenStack networking   juno l3 h-a, dvr
OpenStack networking juno l3 h-a, dvr
 
CETH for XDP [Linux Meetup Santa Clara | July 2016]
CETH for XDP [Linux Meetup Santa Clara | July 2016] CETH for XDP [Linux Meetup Santa Clara | July 2016]
CETH for XDP [Linux Meetup Santa Clara | July 2016]
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
 
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
 
Direct Code Execution - LinuxCon Japan 2014
Direct Code Execution - LinuxCon Japan 2014Direct Code Execution - LinuxCon Japan 2014
Direct Code Execution - LinuxCon Japan 2014
 
6. hands on - open mano demonstration in remote pool of servers
6. hands on - open mano demonstration in remote pool of servers6. hands on - open mano demonstration in remote pool of servers
6. hands on - open mano demonstration in remote pool of servers
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
 
Tips of Malloc & Free
Tips of Malloc & FreeTips of Malloc & Free
Tips of Malloc & Free
 
Docker network
Docker networkDocker network
Docker network
 
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
 
Direct Code Execution @ CoNEXT 2013
Direct Code Execution @ CoNEXT 2013Direct Code Execution @ CoNEXT 2013
Direct Code Execution @ CoNEXT 2013
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
 
Libvirt and bhyve under FreeBSD
Libvirt and bhyve under FreeBSDLibvirt and bhyve under FreeBSD
Libvirt and bhyve under FreeBSD
 
PASTE: Network Stacks Must Integrate with NVMM Abstractions
PASTE: Network Stacks Must Integrate with NVMM AbstractionsPASTE: Network Stacks Must Integrate with NVMM Abstractions
PASTE: Network Stacks Must Integrate with NVMM Abstractions
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops way
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
 
Comprehensive XDP Off‌load-handling the Edge Cases
Comprehensive XDP Off‌load-handling the Edge CasesComprehensive XDP Off‌load-handling the Edge Cases
Comprehensive XDP Off‌load-handling the Edge Cases
 

Viewers also liked

「新しい」を生み出すためのWebアプリ開発とその周辺
「新しい」を生み出すためのWebアプリ開発とその周辺「新しい」を生み出すためのWebアプリ開発とその周辺
「新しい」を生み出すためのWebアプリ開発とその周辺
Yusuke Wada
 

Viewers also liked (10)

Node.jsでブラウザメッセンジャー
Node.jsでブラウザメッセンジャーNode.jsでブラウザメッセンジャー
Node.jsでブラウザメッセンジャー
 
「新しい」を生み出すためのWebアプリ開発とその周辺
「新しい」を生み出すためのWebアプリ開発とその周辺「新しい」を生み出すためのWebアプリ開発とその周辺
「新しい」を生み出すためのWebアプリ開発とその周辺
 
Real-time Bus Location System using by node.js
Real-time Bus Location System using by node.jsReal-time Bus Location System using by node.js
Real-time Bus Location System using by node.js
 
NodeFest2014 - Transpiler
NodeFest2014 - TranspilerNodeFest2014 - Transpiler
NodeFest2014 - Transpiler
 
Регуляторна політика як інструмент створення сприятливого бізнес клімату для ...
Регуляторна політика як інструмент створення сприятливого бізнес клімату для ...Регуляторна політика як інструмент створення сприятливого бізнес клімату для ...
Регуляторна політика як інструмент створення сприятливого бізнес клімату для ...
 
Експорт МСП: від А до Я. Випуск №2
Експорт МСП: від А до Я. Випуск №2Експорт МСП: від А до Я. Випуск №2
Експорт МСП: від А до Я. Випуск №2
 
КАМПАНІЯ З АДВОКАЦІЇ ЯК ІНСТРУМЕНТ ВПЛИВУ НА ПОЛІТИКУ ЩОДО МАЛОГО ТА СЕРЕДН...
КАМПАНІЯ З АДВОКАЦІЇ  ЯК ІНСТРУМЕНТ ВПЛИВУ  НА ПОЛІТИКУ ЩОДО МАЛОГО ТА СЕРЕДН...КАМПАНІЯ З АДВОКАЦІЇ  ЯК ІНСТРУМЕНТ ВПЛИВУ  НА ПОЛІТИКУ ЩОДО МАЛОГО ТА СЕРЕДН...
КАМПАНІЯ З АДВОКАЦІЇ ЯК ІНСТРУМЕНТ ВПЛИВУ НА ПОЛІТИКУ ЩОДО МАЛОГО ТА СЕРЕДН...
 
Node-v0.12のTLSを256倍使いこなす方法
Node-v0.12のTLSを256倍使いこなす方法Node-v0.12のTLSを256倍使いこなす方法
Node-v0.12のTLSを256倍使いこなす方法
 
Nodeで操るKurentoメディアサーバー ( Kurento + WebRTC + Node.js )
Nodeで操るKurentoメディアサーバー ( Kurento + WebRTC + Node.js )Nodeで操るKurentoメディアサーバー ( Kurento + WebRTC + Node.js )
Nodeで操るKurentoメディアサーバー ( Kurento + WebRTC + Node.js )
 
power-assert, mechanism and philosophy
power-assert, mechanism and philosophypower-assert, mechanism and philosophy
power-assert, mechanism and philosophy
 

Similar to Lev

Linux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guideLinux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guide
jasembo
 

Similar to Lev (20)

Next Stop, Android
Next Stop, AndroidNext Stop, Android
Next Stop, Android
 
Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)
 
Linux kernel bug hunting
Linux kernel bug huntingLinux kernel bug hunting
Linux kernel bug hunting
 
Hardware accelerated switching with Linux @ SWLUG Talks May 2014
Hardware accelerated switching with Linux @ SWLUG Talks May 2014Hardware accelerated switching with Linux @ SWLUG Talks May 2014
Hardware accelerated switching with Linux @ SWLUG Talks May 2014
 
Kernel Recipes 2019 - BPF at Facebook
Kernel Recipes 2019 - BPF at FacebookKernel Recipes 2019 - BPF at Facebook
Kernel Recipes 2019 - BPF at Facebook
 
Kubernetes - Starting with 1.2
Kubernetes  - Starting with 1.2Kubernetes  - Starting with 1.2
Kubernetes - Starting with 1.2
 
Scaling the Container Dataplane
Scaling the Container Dataplane Scaling the Container Dataplane
Scaling the Container Dataplane
 
kubernetes for beginners
kubernetes for beginnerskubernetes for beginners
kubernetes for beginners
 
XT Best Practices
XT Best PracticesXT Best Practices
XT Best Practices
 
Azure Day Rome Reloaded 2019 - Deconstructing Kubernetes using AKS
Azure Day Rome Reloaded 2019 - Deconstructing Kubernetes using AKSAzure Day Rome Reloaded 2019 - Deconstructing Kubernetes using AKS
Azure Day Rome Reloaded 2019 - Deconstructing Kubernetes using AKS
 
Build Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVMBuild Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVM
 
Linux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guideLinux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guide
 
"One network to rule them all" - OpenStack Summit Austin 2016
"One network to rule them all" - OpenStack Summit Austin 2016"One network to rule them all" - OpenStack Summit Austin 2016
"One network to rule them all" - OpenStack Summit Austin 2016
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in description
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Developing MIPS Exploits to Hack Routers
Developing MIPS Exploits to Hack RoutersDeveloping MIPS Exploits to Hack Routers
Developing MIPS Exploits to Hack Routers
 
Intel DPDK Step by Step instructions
Intel DPDK Step by Step instructionsIntel DPDK Step by Step instructions
Intel DPDK Step by Step instructions
 
Trying and evaluating the new features of GlusterFS 3.5
Trying and evaluating the new features of GlusterFS 3.5Trying and evaluating the new features of GlusterFS 3.5
Trying and evaluating the new features of GlusterFS 3.5
 
Swift Install Workshop - OpenStack Conference Spring 2012
Swift Install Workshop - OpenStack Conference Spring 2012Swift Install Workshop - OpenStack Conference Spring 2012
Swift Install Workshop - OpenStack Conference Spring 2012
 
Haskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHCHaskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHC
 

Recently uploaded

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Lev

  • 1. lev Tokyo Node Gakuen 7 periods 2012/09/18 @kazupon (kazu_pon) 1
  • 2. Introduction @kazupon name: kazuya kawaguchi twitter: kazu_pon Job OKI -> Bluebridge -> Freelance (now) Flont-end Engneer? Back-end Engneer? Work Zenback, and others ... Node connect-kyoto kyotocabinet-node SabaDB 2
  • 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
  • 7. `lev` Fork from luvit, overhaul, reimplementation $ git diff --shortstat 173c91...master https://github.com/connectFree/lev/compare/ 173c91e383361fb09c1e7f973f6e24bec0d4fcec...master 7
  • 9. Contributors @hnakamur @dvv @kristate @xming @kazupon 9
  • 11. Demo chat bit.ly/levchat 11
  • 12. Benchmark Measurement item Requests per second Memory usage Measurement Pattern ab -n 2000 -c 1 ab -n 2000 -c 10 ab -n 2000 -c 100 12
  • 13. Benchmark Enviroments 100BASE-T Ethernet Client direct connect Server MacBook Pro Retina, Mid 2012 Macbook, Early 2009 * CPU: 2.6 GHz Intel Core i7 * CPU: 2GHz Intel Core 2 Duo * RAM: 16GB 1600 MHz DDR3 * RAM: 4GB 667 MHz DDR2 SDRAM * Disk: 512GB * Disk: 256GB APPLE SSD SM512E FUJITSU MHZ2250BH FFS G1 Media * OS: Mac OS X 10.8 Mountain SATA Lion * OS: Mac OS X 10.7.3 Lion 13
  • 14. Benchmark Version Node: 0.8.9 luvit: 0.5.0 lev: b03a16d (git commit hash) 14
  • 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
  • 18. cBuffer Buffer module lev_slab_allocator_t mem_1k; lev_slab_allocator_t mem_8k; MemBlock pool[]; MemBlock pool[]; C bytes: 1024 bytes: 1024 ... x8 implementation lev_slab_allocator_t mem_16k; Allocated MemBlock pool[]; bytes: 1024 special slab ... x16 allocator lev_slab_allocator_t mem_64k; lev_slab_allocator_t mem_1024k; MemBlock pool[]; MemBlock pool[]; Byte array bytes: 1024 ... x64 bytes: 1024 ... x1024 Seamless MemSlice conversion to char *slice; size_t until; string lev.Buffer 18
  • 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
  • 24. Platform *NIX Linux, Darwin, Freebsd, and other ... Not support Windows 24
  • 25. Loadmap (Wishlist) Build-in Web application framework Build-in Package managment tool Choice regular expression library Resolve callback hell ... etc 25
  • 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
  • 28. Thank you for listening to my session 28
  • 30. Reference luvit http://luvit.io/ https://github.com/creationix/ nodeconf2012 http://coderwall.com/p/gkokaw benchmark data git://gist.github.com/3727820.git 30

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n