Your SlideShare is downloading. ×
0
6000 Greenwood Plaza Blvd                           Suite 110                           Greenwood Village, CO 80111       ...
Agenda…•    Definitions•    Introduction to Node.js•    Problems it attempts to solve•    Drawbacks and challenges to adop...
Who Am I?       •     Consultant at Aspenware Internet Solutions Inc.       •     Background in Open Source technologies  ...
Who Are You?Business Considerationsfor Node.js Applications
AcknowledgementsBusiness Considerationsfor Node.js Applications
Key Terms…              •  API: A collection of publically exposed methods to                 facilitate use of a library ...
What Is Node?Business Considerationsfor Node.js Applications
What does Node do?•  API for interacting with low-level system libraries   asynchronously•  Leverages features inherent in...
Visualizing Latency                                  300000000	                                    250000000	             ...
Web Application Life Cycle?                                           Route Request to Controller Action                  ...
Traditional Scaling Model…                        Route Request to Controller Action                                      ...
Resource Limited Scaling                                          Load	  Balancer	                              Web	      ...
Resource Limited ScalingBusiness Considerationsfor Node.js Applications
Node’s Execution Model •  Using an event loop     •  Event occurs (emitted)     •  Non-I/O operations return immediately  ...
Event Loop AnalogyRESTful Web Serviceswith Node.js
Node Architecture…                                                                       Async	  DNS	                     ...
Scaling Node Applications:                           Load	  Balancer	  /	  Reverse	  Proxy	                               ...
Managing Node Dependencies•  ‘Requiring’ external libraries is handled though the   CommonJS module pattern.•  3rd party l...
Including Dependencies          <script type="text/javascript" src="scripts/myscript.js"></script>Business Considerationsf...
Including Dependencies                           // System-wide (global) libraries/modules                           // St...
Use Cases for Node.js•     Creating REST APIs (JSON APIs)•     Creating chat servers or messaging clients•     Single-page...
Challenges toAdoptionBusiness Considerationsfor Node.js Applications
Evolving API •  (2012.01.06 – 24.10.2012): 46 Releases! •  Minor, even release number is stable •  Minor, odd release numb...
Windows Support•  Was written originally for *NIX systems•  Node core largely supports WIN, 3rd party libs… not so   much•...
Error Handling & Debugging•  Asynchronous code breaks call stacks•  For synchronous code, you must handle exceptions   car...
Example:outerFunction(arg1, arg2, function (callback){     if(!arg1 || !arg2){           return callback(new Error("Are yo...
Asynchronous Code is Complex•  Deeply nested callbacks can become difficult to read &   maintain  Business Considerations ...
Single ThreadedBusiness Considerationsfor Node.js Applications
Entire Stack Must Be Non-BlockingBusiness Considerationsfor Node.js Applications
Case StudiesBusiness Considerationsfor Node.js Applications
Linkedin•  Originally build on Rails Application Framework•  Need to composite service calls for the client•  Persistent s...
Linkedin Mobile Architecture                     iOS	                  Android	                    Mobile	                ...
Yammer•  Similar use case as LinkedIn (cross-domain proxy)•  JSON Out/JSON In  Business Considerations  for Node.js Applic...
Resources:       •  Concurrent Programming for Scalable Web Architectures, Benjamine Erb.          http://berb.github.com/...
ConclusionBusiness Considerationsfor Node.js Applications
Summation       •  Node.js leverages an evented programming model          to handle concurrency and availability       • ...
6000 Greenwood Plaza Blvd                                                            Suite 110                            ...
Upcoming SlideShare
Loading in...5
×

Business considerations for node.js applications

3,255

Published on

Node.js is one of the newest and most exciting open web technologies to surface in the last few years. This presentation explores considerations for business stakeholders and technology decision-makers looking to switch their existing stacks to Node.js. Mike examines questions like: What is Node.js? What are the benefits from using Node.js? What are the drawbacks? Who is using this technology today? In a world of people demanding responsive, real-time applications, Node.js makes a compelling argument for change. Mike includes case studies from companies like LinkedIn and Yammer to illustrate the business cases that make sense.

About Node.js:
Node.js (Node) , the brain child of Ryan Dahl, was released in 2009 when he worked for Joyent, Inc. Node is one of the most hyped technologies to arrive on the web development scene, though it is also one of the most misunderstood.

So what is Node? Is it a programming language like Python, Java, or C++? Is it an application framework like Django, Rails, or Symphony? Is it maybe some type of middleware that can be plugged into existing web stacks like Memcached or RabbitMQ? Actually, it is none of the above. Node is simply a set of JavaScript language bindings to Google's powerful V8 engine. This begs the question: "what is a language binding and what is V8?"

Published in: Technology

Transcript of "Business considerations for node.js applications"

  1. 1. 6000 Greenwood Plaza Blvd Suite 110 Greenwood Village, CO 80111 303.798.5458 www.aspenware.comBusinessConsiderationsfor Node.js Applications Michael Filbin m.filbin@aspenware.com
  2. 2. Agenda…•  Definitions•  Introduction to Node.js•  Problems it attempts to solve•  Drawbacks and challenges to adoption•  Use cases and case studies•  Hello World example (if time)•  Summary and conclusionBusiness Considerationsfor Node.js Applications
  3. 3. Who Am I? •  Consultant at Aspenware Internet Solutions Inc. •  Background in Open Source technologies •  Currently JavaScript engineer at Pearson •  Member of Linux and Free Software foundations •  Co-founder of Gogy Inc.Business Considerationsfor Node.js Applications
  4. 4. Who Are You?Business Considerationsfor Node.js Applications
  5. 5. AcknowledgementsBusiness Considerationsfor Node.js Applications
  6. 6. Key Terms… •  API: A collection of publically exposed methods to facilitate use of a library •  Asynchronous: The execution of a function and its result are not mutually exclusive. •  JavaScript Runtime: Optimizes and executes JavaScript code •  Language Binding: Uses of one programming language to ‘wrap’ a library in another •  Callback: A reference to executable code that is passed as an argument to a function. •  I/O Operations: Operations that involve reading/writing data through some time of interface. •  Procedural Programming: Programs are expressed in terms of steps (procedures) to be carried out •  Event-driven Programming: Execution of a program is carried out in response to events. •  Blocking Process: A process that prevents the continuation of execution until it returns.Business Considerations Brief Introduction to Nodefor Node.js Applications
  7. 7. What Is Node?Business Considerationsfor Node.js Applications
  8. 8. What does Node do?•  API for interacting with low-level system libraries asynchronously•  Leverages features inherent in the JavaScript language•  Intends to manage concurrency, latency, parallelism Business Considerations for Node.js Applications
  9. 9. Visualizing Latency 300000000   250000000   240000000   Processor  Cycles   200000000   150000000   100000000   41000000   50000000   3   14   250   0   1   L1  Cache   3   L2  Cache   14   RAM   250   Hard  Disk   41000000   Network   240000000  Business Considerationsfor Node.js Applications
  10. 10. Web Application Life Cycle? Route Request to Controller Action Respond to Request Make Database Query Write to log file Operate on resultsBusiness Considerationsfor Node.js Applications
  11. 11. Traditional Scaling Model… Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Respond to Request Respond to Request Respond to Request Respond to Request Respond to Request Make Database Query Make Database Query Make Database Query Make Database Query Make Database Query Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Respond to Request Respond to Request Respond to Request Respond to Request Respond to Request Make Database Query Make Database Query Make Database Query Make Database Query Make Database Query Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Route Request to Controller Action Respond to Request Respond to Request Respond to Request Respond to Request Respond to Request Make Database Query Make Database Query Make Database Query Make Database Query Make Database Query Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on results Operate on resultsBusiness Considerationsfor Node.js Applications
  12. 12. Resource Limited Scaling Load  Balancer   Web   App   App   Server   Server   Server   Search   Database   Engine  Business Considerationsfor Node.js Applications
  13. 13. Resource Limited ScalingBusiness Considerationsfor Node.js Applications
  14. 14. Node’s Execution Model •  Using an event loop •  Event occurs (emitted) •  Non-I/O operations return immediately •  I/O operations defer to libeio or libuv •  I/O interrupt received and callback is executed •  Data returned to client Event  1   libeio   FS   …   Network   Crypto   Event  N   libuv   All  on  a  single  thread  on  a  single  processor  RESTful Web Serviceswith Node.js
  15. 15. Event Loop AnalogyRESTful Web Serviceswith Node.js
  16. 16. Node Architecture… Async  DNS   V8  RunLme   OpenSSL   libuv   libeio  Business Considerationsfor Node.js Applications
  17. 17. Scaling Node Applications: Load  Balancer  /  Reverse  Proxy   App   Content   Server   Delivery   Network   (CDN)   Search   Database   Engine  Business Considerationsfor Node.js Applications
  18. 18. Managing Node Dependencies•  ‘Requiring’ external libraries is handled though the CommonJS module pattern.•  3rd party libraries distributed though NPM package management tool•  Packages can be installed globally or locally•  Application dependencies can be expressed in a manifest file (package.json) Business Considerations for Node.js Applications
  19. 19. Including Dependencies <script type="text/javascript" src="scripts/myscript.js"></script>Business Considerationsfor Node.js Applications
  20. 20. Including Dependencies // System-wide (global) libraries/modules // Stored in /usr/local/lib/node_modules var path = require(path); var fileSystem = require(fileSystem) // Local (project) libraries // ./node_modules var restify = require(restify); var nconf = require(nconf); // Including scripts from somewhere in // the file system var MyModel = require("./lib/models/ MyModel");Business Considerationsfor Node.js Applications
  21. 21. Use Cases for Node.js•  Creating REST APIs (JSON APIs)•  Creating chat servers or messaging clients•  Single-page RIA•  Data Streaming Business Considerations for Node.js Applications
  22. 22. Challenges toAdoptionBusiness Considerationsfor Node.js Applications
  23. 23. Evolving API •  (2012.01.06 – 24.10.2012): 46 Releases! •  Minor, even release number is stable •  Minor, odd release number is developmentBusiness Considerationsfor Node.js Applications
  24. 24. Windows Support•  Was written originally for *NIX systems•  Node core largely supports WIN, 3rd party libs… not so much•  Build tools recently switched to better support WIN Business Considerations for Node.js Applications
  25. 25. Error Handling & Debugging•  Asynchronous code breaks call stacks•  For synchronous code, you must handle exceptions carefully (try/catch)•  For asynchronous code, you must pass errors around to callbacks Business Considerations for Node.js Applications
  26. 26. Example:outerFunction(arg1, arg2, function (callback){ if(!arg1 || !arg2){ return callback(new Error("Are you forgetting something?")); } else { return innerFunction(ar1, arg2, function (error, data){ if(error){ callback(error); } else { try{ var json = JSON.parse(data) callback(null, json); } catch(error){ callback(error); } } }) }});Business Considerationsfor Node.js Applications
  27. 27. Asynchronous Code is Complex•  Deeply nested callbacks can become difficult to read & maintain Business Considerations for Node.js Applications
  28. 28. Single ThreadedBusiness Considerationsfor Node.js Applications
  29. 29. Entire Stack Must Be Non-BlockingBusiness Considerationsfor Node.js Applications
  30. 30. Case StudiesBusiness Considerationsfor Node.js Applications
  31. 31. Linkedin•  Originally build on Rails Application Framework•  Need to composite service calls for the client•  Persistent socket connections•  Much smaller code base (~50Kb when minified)•  Reduce the amount of memory leak (from mongrel)•  Benchmarked at 20X faster•  Using 10% original resource (from 30 servers to just 3! & 300MB or RAM to just over 30MB)•  More Stable Business Considerations for Node.js Applications
  32. 32. Linkedin Mobile Architecture iOS   Android   Mobile   Client   Web   Libraries   Node.js   Mobile  Server   MongoDB  Database   ApplicaLon   Bg.   Data   Data   Other   Tracking   Queue   Service   Service   Process  Business Considerations Credit: Kirin Prasad, Linkedin Mobile Engineerfor Node.js Applications
  33. 33. Yammer•  Similar use case as LinkedIn (cross-domain proxy)•  JSON Out/JSON In Business Considerations for Node.js Applications
  34. 34. Resources: •  Concurrent Programming for Scalable Web Architectures, Benjamine Erb. http://berb.github.com/diploma-thesis/community/042_serverarch.html •  Benchmark Comparisons: http://shootout.alioth.debian.org/u64/benchmark.php? test=all&lang=nodejs&lang2=fsharpBusiness Considerationsfor Node.js Applications
  35. 35. ConclusionBusiness Considerationsfor Node.js Applications
  36. 36. Summation •  Node.js leverages an evented programming model to handle concurrency and availability •  Because Node does not rely on threads/processes to scale, it can use considerably fewer resources •  Fewer resources means lower cost •  More concurrent users means greater revenue potential •  Because node support the real-time web, you can improve your user’s experienceBusiness Considerationsfor Node.js Applications
  37. 37. 6000 Greenwood Plaza Blvd Suite 110 Greenwood Village, CO 80111 303.798.5458 www.aspenware.comMichaelFilbinMichael Filbin, Software Developer m.filbin@aspenware.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×