• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Network with node
 

Network with node

on

  • 1,183 views

Talk about basic networking with nodejs. Originally at MunichJS 5.5.2011 (munichjs.org)

Talk about basic networking with nodejs. Originally at MunichJS 5.5.2011 (munichjs.org)

Statistics

Views

Total Views
1,183
Views on SlideShare
952
Embed Views
231

Actions

Likes
0
Downloads
4
Comments
0

3 Embeds 231

http://sideshowcoder.com 128
http://lanyrd.com 102
http://www.tumblr.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Network with node Network with node Presentation Transcript

  • NETWORKING WITH NODEJS Philipp Fehre http://sideshowcoder.com Inspired by Dirk Haage http://dirk.haage.info/
  • WHY?
  • • Speed
  • • Speed• Event driven programming
  • • Speed• Event driven programming• Javascript
  • • Speed• Event driven programming• Javascript• Because we can!
  • BASICS
  • • Real Simple TCP
  • • Real Simple TCP• Build a binary packet
  • • Real Simple TCP• Build a binary packet• Sent the Packet (UDP/TCP Socket)
  • • Real Simple TCP• Build a binary packet• Sent the Packet (UDP/TCP Socket)• Make DNS Requests
  • TCP SERVER
  • TCP CLIENT
  • DATA
  • ENCODING
  • BUILD PACKET
  • OPEN A SOCKET
  • SENDING
  • EXAMPLE
  • GROWL
  • DOING SOMETHING USEFUL NOW...
  • RDNS ISTRUKTA PROJECT
  • RDNS ISTRUKTA PROJECT• Resolve reverse DNS names
  • RDNS ISTRUKTA PROJECT• Resolve reverse DNS names• Scanthe whole Internet
  • RDNS ISTRUKTA PROJECT• Resolve reverse DNS names• Scanthe whole Internet• 2^32 IPs so better be fast!
  • MAKE A DNS REQUEST
  • REMINDER HOW DNS WORKS
  • 2^32 REQUEST TO 1 DNS SERVER?
  • 2^32 REQUEST TO 1 DNS SERVER?• Does not work, any sensible server will respond with “meh”
  • 2^32 REQUEST TO 1 DNS SERVER?• Does not work, any sensible server will respond with “meh”• Need to spread request across servers
  • 2^32 REQUEST TO 1 DNS SERVER?• Does not work, any sensible server will respond with “meh”• Need to spread request across servers• Handle own recursive resolution
  • 2^32 REQUEST TO 1 DNS SERVER?• Does not work, any sensible server will respond with “meh”• Need to spread request across servers• Handle own recursive resolution• Need to set DNS Server per request
  • EXPOSING SETTING
  • MAKE A DNS REQUEST VIA A SPECIFIC SERVER
  • WHY NODE?
  • WHY NODE?• Requests need to run async
  • WHY NODE?• Requests need to run async• The Javascript way to handle evented systems
  • WHY NODE?• Requests need to run async• The Javascript way to handle evented systems• First implementation in Python did not perform well enough...
  • EVENTED ARCHITECTURE
  • 2^32 IP = NEED FOR SPEED
  • 2^32 IP = NEED FOR SPEED• Sync: Python 4 workers 36000 Requests/min = 82 Days
  • 2^32 IP = NEED FOR SPEED• Sync: Python 4 workers 36000 Requests/min = 82 Days• Async: Node 1 process 500000 Requests/min = 5 Days* * Calculated wrong before sorry it’s not 2.5h
  • DEMO
  • PRO-THOUGHTS
  • PRO-THOUGHTS• Event driven programming
  • PRO-THOUGHTS• Event driven programming• Easily modifiable
  • PRO-THOUGHTS• Event driven programming• Easily modifiable• Node is moving quick
  • PRO-THOUGHTS• Event driven programming• Easily modifiable• Node is moving quick• Javascript is fun!
  • COUNTER-THOUGHTS
  • COUNTER-THOUGHTS• API not “there” yet in some cases
  • COUNTER-THOUGHTS• API not “there” yet in some cases• Really web focused
  • COUNTER-THOUGHTS• API not “there” yet in some cases• Really web focused• Node is moving to quick (from time to time)!
  • REFERENCES• Node DNS Patch: https://github.com/sideshowcoder/Add-NodeJS-DNS-Server-Settings• Growl for Node: https://github.com/sideshowcoder/Nodrrr• Web: http://sideshowcoder.com Twitter: @ischi• Pictures courtesy of google image search ;)
  • AD!