• Like
  • Save
node.js
Upcoming SlideShare
Loading in...5
×
 

node.js

on

  • 384 views

 

Statistics

Views

Total Views
384
Views on SlideShare
384
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

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

    node.js node.js Presentation Transcript

    • node.jsJames Singh
    • Node.js is a software platform for scalable server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on Windows, Mac OS X and Linux with no changes. Node.js applications are designed to maximize throughput and efficiency, using non-blocking I/O and asynchronous events. Node.js applications run single-threaded, although Node uses multiple threads for file and network events. Node.js internally uses the Google V8 JavaScript engine to execute code, and a large percentage of the basic modules are written in JavaScript. Node.js contains a built-in HTTP server library, making it possible to run a web server without Apache or Lighttpd. -Wikipedia
    • I/O needs to be done differently.
    • Many web applications have code like this: var result = db.query("select * from T"); // use result What is the software doing while it queries the database?
    • In many cases, just waiting for the response.
    • I/O latency L1: 3 cycles L2: 14 cycles RAM: 250 cycles DISK: 41,000,000 cycles NETWORK: 240,000,000 cycles
    • Better software can multitask. Other threads of execution can run while waiting.
    • Apache vs NGINX
    • Apache vs NGINX
    • Apache vs NGINX The difference? Apache uses one thread per Connection. NGINX doesn’t use threads. It uses an event loop.
    • Code like this var result = db.query("select.."); // use result either blocks the entire process or implies multiple execution stacks.
    • But a line of code like this db.query("select..", function (result) { // use result }); allows the program to return to the event loop immediately.
    • So why isn’t everyone using event loops, callbacks, and non-blocking I/O? For reasons both cultural and infrastructural.
    • What can you make with it?
    • Who is using it?
    • Is it easy to use?
    • What client libraries are available? Memcached, Redis, MySQL, MongoDB, Solr, RabbitMQ
    • MEAN framework
    • How to install? http://nodejs.org
    • Questions?