Your SlideShare is downloading. ×
0
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

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

4,858

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,858
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \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
  • Transcript

    • 1. Streams are awesome.@sh1mmer
    • 2. Tom Hughes-Croucher @sh1mmer
    • 3. 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
    • 4. Client → ServerServer → DB Computation Computation@sh1mmer
    • 5. Non event-driven frontend@sh1mmer
    • 6. @sh1mmer
    • 7. Server@sh1mmer
    • 8. Request@sh1mmer
    • 9. @sh1mmer
    • 10. Event-driven frontend@sh1mmer
    • 11. Place- holder@sh1mmer
    • 12. @sh1mmer
    • 13. Shared WorkResources@sh1mmer
    • 14. Memory operations@sh1mmer
    • 15. 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
    • 16. @sh1mmer
    • 17. Mobile data latency@sh1mmer
    • 18. @sh1mmer
    • 19. 100 Blue Whales Cat@sh1mmer
    • 20. Node.js Streams@sh1mmer
    • 21. Streams• Readable • Pause • Resume • data event• Writable • Write• Pipe
    • 22. Event Loop Fail node.cc add-ons v8 libuv libev iocp
    • 23. 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
    • 24. stream.pause()@sh1mmer
    • 25. 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
    • 26. New Streams• Writable • Same (hooray!)• Readable • Configure buffer waterline • readable event • read(len) -> returns data• Pipe • Doesnt mix with direct access
    • 27. Node.js Domains@sh1mmer
    • 28. 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
    • 29. Questions!@sh1mmer

    ×