• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Streams are Awesome - (Node.js) TimesOpen Sep 2012
 

Streams are Awesome - (Node.js) TimesOpen Sep 2012

on

  • 4,810 views

 

Statistics

Views

Total Views
4,810
Views on SlideShare
4,561
Embed Views
249

Actions

Likes
3
Downloads
0
Comments
0

14 Embeds 249

http://localhost 217
https://twitter.com 9
http://www.linkedin.com 6
http://www.onlydoo.com 3
http://faxo.com 3
http://twitter.com 2
http://fr.slideshare.net 2
http://flashattackcrew.blogspot.mx 1
https://si0.twimg.com 1
http://kred.com 1
http://novaxarxabusos.omitsis.com 1
http://www.caucapino4u.com 1
http://flashattackcrew.blogspot.com 1
http://photos1.servepics.com 1
More...

Accessibility

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Streams are Awesome - (Node.js) TimesOpen Sep 2012 Streams are Awesome - (Node.js) TimesOpen Sep 2012 Presentation Transcript

  • Streams are awesome.@sh1mmer
  • Tom Hughes-Croucher @sh1mmer
  • Scalable Server-Side Code with JavaScript Node Up and Running Tom Hughes-Croucher http://ofps.oreilly.com/titles/9781449398583/http://shop.oreilly.com/product/0636920015956.do
  • Client → ServerServer → DB Computation Computation@sh1mmer
  • Non event-driven frontend@sh1mmer
  • @sh1mmer
  • Server@sh1mmer
  • Request@sh1mmer
  • @sh1mmer
  • Event-driven frontend@sh1mmer
  • Place- holder@sh1mmer
  • @sh1mmer
  • Shared WorkResources@sh1mmer
  • Memory operations@sh1mmer
  • var x = "I am a string" ~1ns Running 1 instruction 2ns Data from l1 cpu cache 5ns Data from l2 cpu cache 80ns Data from ram@sh1mmer
  • @sh1mmer
  • Mobile data latency@sh1mmer
  • @sh1mmer
  • 100 Blue Whales Cat@sh1mmer
  • Node.js Streams@sh1mmer
  • Streams• Readable • Pause • Resume • data event• Writable • Write• Pipe
  • Event Loop Fail node.cc add-ons v8 libuv libev iocp
  • nextTick Event Loop FailnextTick Run stuff TCP Conn node.cc FS Read add-ons v8 TCP Conn v8 func libuv v8 TCP func Conn libev iocp v8 FS func Read FS Read
  • stream.pause()@sh1mmer
  • nextTick Event Loop FailnextTick stream.pause() TCP Conn node.cc FS Read add-ons v8 TCP Conn v8 func libuv v8 TCP func Conn libev iocp v8 FS func Read FS Read
  • New Streams• Writable • Same (hooray!)• Readable • Configure buffer waterline • readable event • read(len) -> returns data• Pipe • Doesnt mix with direct access
  • Node.js Domains@sh1mmer
  • var d = domain.create(); function readSomeFile(filename, cb) { fs.readFile(filename, utf8, d.bind(function(er, data) { // if this throws, it will also be passed to the domain return cb(er, data ? JSON.parse(data) : null); })); } d.on(error, function(er) { // an error occurred somewhere. // if we throw it now, it will crash the program // with the normal line number and stack message. });@sh1mmer
  • Questions!@sh1mmer