SlideShare a Scribd company logo
Node Version 0.8.x
           What’s new in Node?




http://www.meetup.com/Pittsburgh-Node-js/
NicholasDeveloper
UX Designer &
              McClay



 @nickmcclay
Speed Improvements

http://blog.nodejs.org/2012/06/25/node-v0-8-0/
How much faster is it?!?!

    A.) 1%
    B.) 10%
    C.) 50%
    D.) 100%
Ehh... its not really clear...


Somewhere between 1% and 10% as far as I can tell...
A note about benchmarking node


Remember it’s “./node”
Huge deviation in repeated tests (3829 - 6462 #/sec)
Node 0.4.x has issues running io.js (constant duration)
Write Speed Improvements
                           0.8                0.6

             500

             375
Write 1MB    250

             125

              0
                   1kb   4kb     8kb   16kb   32kb   64kb
Read Speed Improvements
                           0.8                0.6

             400

             300
Read 1MB     200

             100

              0
                   1kb   4kb     8kb   16kb   32kb   64kb
HTTP Server Improvements
                              0.8   0.6     0.4

                       6000

                       4500
Serve “Hello World!”   3000

                       1500

                         0
                                    #/Sec
Uh... Apache Bench?
                                 0.8   0.6     0.4

                          2500

100000 total requests     1875


100 concurrent requests   1250

                          625

                            0
                                       #/Sec
API Changes
Deprecated

http.Client()
path.{exists,existsSync} -> fs.{exists,existsSync}
tty.setRawMode(mode) -> tty.ReadStream#setRawMode()
direct usage of ev_* and eio_*, should use uv_*
Removed

waf build system -> gyp
require(‘sys’) -> require(‘util’)
process.installPrefix
node --vars
Lots more changes and additions
    process
                                                                                                                                     •     buffer

      ◦        process.stdin.on('keypress') will not be emitted by default, as it's an internal API. Use the keypress module now.
                                                                                                                                                ◦    'utf16le' encoding.
      ◦        process.stdin.pipe(dest) will automatically call process.stdin.resume().
                                                                                                                                     •     child_process
•   cluster


                                                                                                                                                ◦    silent option to child_process.fork() - stdout and stderr won't be shared with parent.
      ◦        cluster.fork() no longer return a child_process.fork() object use cluster.fork().process to get the object.
                                                                                                                                                ◦    .disconnect() when using child_process.fork() this will allow the child to die gracefully.
      ◦        the 'death' event on the cluster object is renamed to 'exit'.
                                                                                                                                                ◦    stdio option for child_process.spawn() - configuration of child's stdio (file descriptors).
      ◦        the kill() method is renamed to destroy().
                                                                                                                                                ◦    detached option for child_process.spawn() - make the child a process group leader (see docs)
      ◦        the CLUSTER_WORKER_ID env is now called CLUSTER_UNIQUE_ID, but you should not have used that anyway.
                                                                                                                                                ◦    child.send() can now send net.Server and net.Socket as second argument.
      ◦        workers now kill themselves when they accidentally lose their connection to the master.
                                                                                                                                     •     cluster
•   http


                                                                                                                                                ◦    'fork', 'online', 'listening', and 'setup' events.
      ◦        http.Server emits 'connect' event instead of 'upgrade' when the CONNECT method is requested.
                                                                                                                                                ◦    Worker object which is provided from cluster.workers (in the master) or cluster.worker (in the worker).
      ◦        http.ServerResponse sends Date: header by default. You can disable it by setting response.sendDate to false.
                                                                                                                                                ◦    env optional argument to cluster.fork().
      ◦        http.ClientRequest emits 'connect' event instead of 'request' when the CONNECT method is responded.
                                                                                                                                                ◦    cluster.setupMaster() and cluster.settings.
•   net
                                                                                                                                                ◦    cluster.disconnect() and worker.disconnect().

      ◦        net.listen(socketPath) no longer unlinks the socket unless you call server.close(). Automatic unlinking was                      ◦    worker.id what there before was internally known as workerID.

               subject to race conditions in multi-process setups. Also applies to http.listen(socketPath).                                     ◦    worker.suicide flag set when worker disconnect or die, indicate if this was an accidental death.

•   child_process                                                                                                                    •     crypto



      ◦        arguments and options arguments of child_process.fork() became an option.                                                        ◦    crypto.getDiffieHellman().

      ◦        the 'exit' event is now emitted right after the child process exits. It no longer waits for all stdio pipes to be closed.        ◦    cipher.setAutoPadding() and decipher.setAutoPadding().

      ◦        the 'close' event was added that has is emitted after the child has exited and all the stdio pipes are closed.                   ◦    ciphers option to crypto.createCredentials().

•   readline                                                                                                                         •     domain



      ◦        arguments of rl.createInterface became an option as rl.createInterface(options) but still took an old style                      ◦    see http://nodejs.org/docs/v0.8.0/api/domain.html

                                                                                                                                     •     fs
Lots more changes and additions
    process




                                                                                                                                        l f:
                                                                                                                                     •     buffer




                                                                                                                                     rse
      ◦        process.stdin.on('keypress') will not be emitted by default, as it's an internal API. Use the keypress module now.




                                                                                                                                  ou
                                                                                                                                                ◦    'utf16le' encoding.
      ◦        process.stdin.pipe(dest) will automatically call process.stdin.resume().




                                                                                                                                ry
                                                                                                                                     •     child_process
•   cluster




                           ad   fo                  wiki/
                                                                                                                                                ◦    silent option to child_process.fork() - stdout and stderr won't be shared with parent.
      ◦        cluster.fork() no longer return a child_process.fork() object use cluster.fork().process to get the object.




                        re                       de/
                                                                                                                                                ◦    .disconnect() when using child_process.fork() this will allow the child to die gracefully.
      ◦        the 'death' event on the cluster object is renamed to 'exit'.




                  Go .com/joyent d-v0.8     /no
                                                                                                                                                ◦    stdio option for child_process.spawn() - configuration of child's stdio (file descriptors).
      ◦        the kill() method is renamed to destroy().
                                                                                                                                                ◦    detached option for child_process.spawn() - make the child a process group leader (see docs)
      ◦        the CLUSTER_WORKER_ID env is now called CLUSTER_UNIQUE_ID, but you should not have used that anyway.
                                                                                                                                                ◦    child.send() can now send net.Server and net.Socket as second argument.
      ◦        workers now kill themselves when they accidentally lose their connection to the master.
                                                                                                                                     •     cluster
•   http




                      git hub              0.6 -an
                                                                                                                                                ◦    'fork', 'online', 'listening', and 'setup' events.




                                       n-v
      ◦        http.Server emits 'connect' event instead of 'upgrade' when the CONNECT method is requested.




              tps: //               wee
                                                                                                                                                ◦    Worker object which is provided from cluster.workers (in the master) or cluster.worker (in the worker).
      ◦        http.ServerResponse sends Date: header by default. You can disable it by setting response.sendDate to false.




           ht                    et
                                                                                                                                                ◦    env optional argument to cluster.fork().
      ◦        http.ClientRequest emits 'connect' event instead of 'request' when the CONNECT method is responded.




                            es-b
                                                                                                                                                ◦    cluster.setupMaster() and cluster.settings.




                       ang
•   net
                                                                                                                                                ◦    cluster.disconnect() and worker.disconnect().




                   I-ch
      ◦        net.listen(socketPath) no longer unlinks the socket unless you call server.close(). Automatic unlinking was                      ◦    worker.id what there before was internally known as workerID.




                AP
               subject to race conditions in multi-process setups. Also applies to http.listen(socketPath).                                     ◦    worker.suicide flag set when worker disconnect or die, indicate if this was an accidental death.

•   child_process                                                                                                                    •     crypto



      ◦        arguments and options arguments of child_process.fork() became an option.                                                        ◦    crypto.getDiffieHellman().

      ◦        the 'exit' event is now emitted right after the child process exits. It no longer waits for all stdio pipes to be closed.        ◦    cipher.setAutoPadding() and decipher.setAutoPadding().

      ◦        the 'close' event was added that has is emitted after the child has exited and all the stdio pipes are closed.                   ◦    ciphers option to crypto.createCredentials().

•   readline                                                                                                                         •     domain



      ◦        arguments of rl.createInterface became an option as rl.createInterface(options) but still took an old style                      ◦    see http://nodejs.org/docs/v0.8.0/api/domain.html

                                                                                                                                     •     fs
req.pause actually pauses requests
Domains

http://nodejs.org/api/domain.html
highlights

Domains provide a way to handle multiple different IO
operations as a single group.
Keeps context unlike“process.on(‘uncaughtException’)”
Disabled by default
Node.js 0.8 features
An async callback
Without domains
Adding domains
With domains
Cluster

http://nodejs.org/api/domain.html
highlights

Take advantage of multi-core system to handle load
easily create a network of processes that share common
ports
setup and manage master-slave worker relationships
Disabled by default
Adding cluster
More cores = more node
Cluster messaging
What about isolates?
Was intended to make child_process.fork() in a thread,
rather than a full process.
Make it cheaper to spin up new child node instances as well
as fast message-passing using shared memory.
Experiments sometimes fail
Caused too much instability
Requires a lot of complexity added to libuv and node
Isn’t likely to yield enough gains as the work requires
What’s next! Node v0.9

More speed improvements
Major overhaul of streams
???
@nickmcclay




See you for Node v0.10!
       Thanks!

More Related Content

PDF
Intro to Sail.js
PPTX
Node.js debugging
PDF
soft-shake.ch - Hands on Node.js
PPTX
Intro to Node.js (v1)
KEY
Writing robust Node.js applications
PDF
Building servers with Node.js
PPTX
introduction to node.js
KEY
Node.js - Best practices
Intro to Sail.js
Node.js debugging
soft-shake.ch - Hands on Node.js
Intro to Node.js (v1)
Writing robust Node.js applications
Building servers with Node.js
introduction to node.js
Node.js - Best practices

What's hot (20)

KEY
Introduction to node.js
PDF
What is nodejs
PDF
Node.js - A Quick Tour
PDF
Node.js and How JavaScript is Changing Server Programming
PDF
Introduction to Nodejs
KEY
A million connections and beyond - Node.js at scale
PPTX
Node.js Patterns for Discerning Developers
PPTX
The State of JavaScript (2015)
KEY
OSCON 2011 - Node.js Tutorial
KEY
Building a real life application in node js
PPT
Building your first Node app with Connect & Express
PPT
Node js presentation
KEY
node.js: Javascript's in your backend
PDF
Comet with node.js and V8
PPTX
Introduction Node.js
PPTX
Java script at backend nodejs
PDF
Node Architecture and Getting Started with Express
KEY
NodeJS
PDF
Express node js
PDF
Introduction to node.js
What is nodejs
Node.js - A Quick Tour
Node.js and How JavaScript is Changing Server Programming
Introduction to Nodejs
A million connections and beyond - Node.js at scale
Node.js Patterns for Discerning Developers
The State of JavaScript (2015)
OSCON 2011 - Node.js Tutorial
Building a real life application in node js
Building your first Node app with Connect & Express
Node js presentation
node.js: Javascript's in your backend
Comet with node.js and V8
Introduction Node.js
Java script at backend nodejs
Node Architecture and Getting Started with Express
NodeJS
Express node js
Ad

Viewers also liked (12)

PPT
Node.js Cloud deployment
PDF
AngularJS + React
PDF
Node.js and Parse
PPT
Coffee script throwdown
PPTX
Angular JS 2.0 & React with Kendo UI
PPTX
React Vs AnagularJS
PPTX
Combining Angular and React Together
PPT
Get MEAN! Node.js and the MEAN stack
PDF
MEAN Stack
PDF
Using ReactJS in AngularJS
PPT
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
KEY
Node.js and NoSQL
Node.js Cloud deployment
AngularJS + React
Node.js and Parse
Coffee script throwdown
Angular JS 2.0 & React with Kendo UI
React Vs AnagularJS
Combining Angular and React Together
Get MEAN! Node.js and the MEAN stack
MEAN Stack
Using ReactJS in AngularJS
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
Node.js and NoSQL
Ad

Similar to Node.js 0.8 features (20)

PDF
Original slides from Ryan Dahl's NodeJs intro talk
PDF
Twisted
PDF
How do event loops work in Python?
PDF
Planning for the Horizontal: Scaling Node.js Applications
PDF
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
PPTX
Node.js Spplication Scaling
PPTX
Zurg part 1
PDF
Web Hooks
PDF
[Node] Multiprocessing and runs continuously
PDF
Netty: asynchronous data transfer
PDF
Tornado Web Server Internals
KEY
Node.js - As a networking tool
PDF
Web server
PDF
Node.js in production
PPT
Mufix Network Programming Lecture
PDF
Monitoraggio del Traffico di Rete Usando Python ed ntop
PDF
Nodejsexplained 101116115055-phpapp02
PDF
Nodejs Explained with Examples
PDF
Ethernet Shield
PDF
Ethernet Shield
Original slides from Ryan Dahl's NodeJs intro talk
Twisted
How do event loops work in Python?
Planning for the Horizontal: Scaling Node.js Applications
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
Node.js Spplication Scaling
Zurg part 1
Web Hooks
[Node] Multiprocessing and runs continuously
Netty: asynchronous data transfer
Tornado Web Server Internals
Node.js - As a networking tool
Web server
Node.js in production
Mufix Network Programming Lecture
Monitoraggio del Traffico di Rete Usando Python ed ntop
Nodejsexplained 101116115055-phpapp02
Nodejs Explained with Examples
Ethernet Shield
Ethernet Shield

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
cuic standard and advanced reporting.pdf
PPT
Teaching material agriculture food technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Machine learning based COVID-19 study performance prediction
MIND Revenue Release Quarter 2 2025 Press Release
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
Teaching material agriculture food technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Understanding_Digital_Forensics_Presentation.pptx

Node.js 0.8 features

  • 1. Node Version 0.8.x What’s new in Node? http://www.meetup.com/Pittsburgh-Node-js/
  • 2. NicholasDeveloper UX Designer & McClay @nickmcclay
  • 4. How much faster is it?!?! A.) 1% B.) 10% C.) 50% D.) 100%
  • 5. Ehh... its not really clear... Somewhere between 1% and 10% as far as I can tell...
  • 6. A note about benchmarking node Remember it’s “./node” Huge deviation in repeated tests (3829 - 6462 #/sec) Node 0.4.x has issues running io.js (constant duration)
  • 7. Write Speed Improvements 0.8 0.6 500 375 Write 1MB 250 125 0 1kb 4kb 8kb 16kb 32kb 64kb
  • 8. Read Speed Improvements 0.8 0.6 400 300 Read 1MB 200 100 0 1kb 4kb 8kb 16kb 32kb 64kb
  • 9. HTTP Server Improvements 0.8 0.6 0.4 6000 4500 Serve “Hello World!” 3000 1500 0 #/Sec
  • 10. Uh... Apache Bench? 0.8 0.6 0.4 2500 100000 total requests 1875 100 concurrent requests 1250 625 0 #/Sec
  • 12. Deprecated http.Client() path.{exists,existsSync} -> fs.{exists,existsSync} tty.setRawMode(mode) -> tty.ReadStream#setRawMode() direct usage of ev_* and eio_*, should use uv_*
  • 13. Removed waf build system -> gyp require(‘sys’) -> require(‘util’) process.installPrefix node --vars
  • 14. Lots more changes and additions process • buffer ◦ process.stdin.on('keypress') will not be emitted by default, as it's an internal API. Use the keypress module now. ◦ 'utf16le' encoding. ◦ process.stdin.pipe(dest) will automatically call process.stdin.resume(). • child_process • cluster ◦ silent option to child_process.fork() - stdout and stderr won't be shared with parent. ◦ cluster.fork() no longer return a child_process.fork() object use cluster.fork().process to get the object. ◦ .disconnect() when using child_process.fork() this will allow the child to die gracefully. ◦ the 'death' event on the cluster object is renamed to 'exit'. ◦ stdio option for child_process.spawn() - configuration of child's stdio (file descriptors). ◦ the kill() method is renamed to destroy(). ◦ detached option for child_process.spawn() - make the child a process group leader (see docs) ◦ the CLUSTER_WORKER_ID env is now called CLUSTER_UNIQUE_ID, but you should not have used that anyway. ◦ child.send() can now send net.Server and net.Socket as second argument. ◦ workers now kill themselves when they accidentally lose their connection to the master. • cluster • http ◦ 'fork', 'online', 'listening', and 'setup' events. ◦ http.Server emits 'connect' event instead of 'upgrade' when the CONNECT method is requested. ◦ Worker object which is provided from cluster.workers (in the master) or cluster.worker (in the worker). ◦ http.ServerResponse sends Date: header by default. You can disable it by setting response.sendDate to false. ◦ env optional argument to cluster.fork(). ◦ http.ClientRequest emits 'connect' event instead of 'request' when the CONNECT method is responded. ◦ cluster.setupMaster() and cluster.settings. • net ◦ cluster.disconnect() and worker.disconnect(). ◦ net.listen(socketPath) no longer unlinks the socket unless you call server.close(). Automatic unlinking was ◦ worker.id what there before was internally known as workerID. subject to race conditions in multi-process setups. Also applies to http.listen(socketPath). ◦ worker.suicide flag set when worker disconnect or die, indicate if this was an accidental death. • child_process • crypto ◦ arguments and options arguments of child_process.fork() became an option. ◦ crypto.getDiffieHellman(). ◦ the 'exit' event is now emitted right after the child process exits. It no longer waits for all stdio pipes to be closed. ◦ cipher.setAutoPadding() and decipher.setAutoPadding(). ◦ the 'close' event was added that has is emitted after the child has exited and all the stdio pipes are closed. ◦ ciphers option to crypto.createCredentials(). • readline • domain ◦ arguments of rl.createInterface became an option as rl.createInterface(options) but still took an old style ◦ see http://nodejs.org/docs/v0.8.0/api/domain.html • fs
  • 15. Lots more changes and additions process l f: • buffer rse ◦ process.stdin.on('keypress') will not be emitted by default, as it's an internal API. Use the keypress module now. ou ◦ 'utf16le' encoding. ◦ process.stdin.pipe(dest) will automatically call process.stdin.resume(). ry • child_process • cluster ad fo wiki/ ◦ silent option to child_process.fork() - stdout and stderr won't be shared with parent. ◦ cluster.fork() no longer return a child_process.fork() object use cluster.fork().process to get the object. re de/ ◦ .disconnect() when using child_process.fork() this will allow the child to die gracefully. ◦ the 'death' event on the cluster object is renamed to 'exit'. Go .com/joyent d-v0.8 /no ◦ stdio option for child_process.spawn() - configuration of child's stdio (file descriptors). ◦ the kill() method is renamed to destroy(). ◦ detached option for child_process.spawn() - make the child a process group leader (see docs) ◦ the CLUSTER_WORKER_ID env is now called CLUSTER_UNIQUE_ID, but you should not have used that anyway. ◦ child.send() can now send net.Server and net.Socket as second argument. ◦ workers now kill themselves when they accidentally lose their connection to the master. • cluster • http git hub 0.6 -an ◦ 'fork', 'online', 'listening', and 'setup' events. n-v ◦ http.Server emits 'connect' event instead of 'upgrade' when the CONNECT method is requested. tps: // wee ◦ Worker object which is provided from cluster.workers (in the master) or cluster.worker (in the worker). ◦ http.ServerResponse sends Date: header by default. You can disable it by setting response.sendDate to false. ht et ◦ env optional argument to cluster.fork(). ◦ http.ClientRequest emits 'connect' event instead of 'request' when the CONNECT method is responded. es-b ◦ cluster.setupMaster() and cluster.settings. ang • net ◦ cluster.disconnect() and worker.disconnect(). I-ch ◦ net.listen(socketPath) no longer unlinks the socket unless you call server.close(). Automatic unlinking was ◦ worker.id what there before was internally known as workerID. AP subject to race conditions in multi-process setups. Also applies to http.listen(socketPath). ◦ worker.suicide flag set when worker disconnect or die, indicate if this was an accidental death. • child_process • crypto ◦ arguments and options arguments of child_process.fork() became an option. ◦ crypto.getDiffieHellman(). ◦ the 'exit' event is now emitted right after the child process exits. It no longer waits for all stdio pipes to be closed. ◦ cipher.setAutoPadding() and decipher.setAutoPadding(). ◦ the 'close' event was added that has is emitted after the child has exited and all the stdio pipes are closed. ◦ ciphers option to crypto.createCredentials(). • readline • domain ◦ arguments of rl.createInterface became an option as rl.createInterface(options) but still took an old style ◦ see http://nodejs.org/docs/v0.8.0/api/domain.html • fs
  • 18. highlights Domains provide a way to handle multiple different IO operations as a single group. Keeps context unlike“process.on(‘uncaughtException’)” Disabled by default
  • 25. highlights Take advantage of multi-core system to handle load easily create a network of processes that share common ports setup and manage master-slave worker relationships Disabled by default
  • 27. More cores = more node
  • 30. Was intended to make child_process.fork() in a thread, rather than a full process. Make it cheaper to spin up new child node instances as well as fast message-passing using shared memory.
  • 32. Caused too much instability Requires a lot of complexity added to libuv and node Isn’t likely to yield enough gains as the work requires
  • 33. What’s next! Node v0.9 More speed improvements Major overhaul of streams ???
  • 34. @nickmcclay See you for Node v0.10! Thanks!

Editor's Notes