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?"
This presentation introduces Node from an architectural perspective by discussing its implementation followed by a practical demonstration of how to build an application using it through a real-world example. Michael Filbin of Aspenware explains how Ryan liberated JavaScript from the browser and brought the power of event-driven, non-blocked programming to every developer by using the world's most popular programming language.
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Â
Restful web services with nodejs
1. 6000 Greenwood Plaza Blvd
Suite 110
Greenwood Village, CO 80111
303.798.5458
www.aspenware.com
RESTful Web
Services
with Node.js Michael Filbin
m.filbin@aspenware.com
3. What is Node.js?
• A set of bindings to Google’s V8 JavaScript engine
• Originally intended creating asynchronous TCP servers
• Other use cases:
• Web application frameworks
• Language interpreters/preprocessors
• Command-line interface utilities8
https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node
RESTful Web Services Brief Introduction to Node
with Node.js
4. Node Architecture?
• Standard Library is written in JavaScript
• JS binding written in C/C++
• Single-threaded
• Event-driven
• Non-blocking I/O
• Modular dependency system
• Allows for extension through C/C++ add-ons
RESTful Web Services Brief Introduction to Node
with Node.js
5. What problems does it solve?
• Concurrency
• Latency
• Complexity
• Stability
RESTful Web Services Brief Introduction to Node
with Node.js
6. Token Example:
• Apache utilize multi-threading
• Nginx utilizes asynchronous I/O
C10K problem – Dan Kegel
RESTful Web Services Brief Introduction to Node
with Node.js
9. What is Asynchronous I/O?
• Using an event loop
• Request is received
• Non-IO operations return immediately
• IO operations defer to system asych API (epoll,
kqueue, select)
• IO interrupt received and callback is executed
• Data returned to client
RESTful Web Services Brief Introduction to Node
with Node.js
10. 2.5 Ă— 10 8 2.4 x 10 8
Network
2 Ă— 10 8
1.5 Ă— 10 8
Com puting Cycles
1 Ă— 10 8
4.1 x 10 7
5 Ă— 10 7 Disk
3 cycles 14 cycles 240 cycles
L1 Cache L2 Cache RAM
0
Process
RESTful Web Services Brief Introduction to Node
with Node.js
11. Paradigm change doesn’t
have to be difficult…
RESTful Web Services Brief Introduction to Node
with Node.js
15. Project Goals:
• Single-page application
• Server calls completely asynchronous
• Utilize web sockets for real-time updates
• RESTful service tier
• More than just “Hello World”
RESTful Web Services Shouting Match
with Node.js
16. Project Constraints:
• Crowd-source data
• No way to authenticate users
• Distributed development team
• Simple deployment strategy
• Very little time
• Request throttling
RESTful Web Services Section Title Goes Here
with Node.js
17. Technology Used:
• Express application framework
• Coffeescript
• Jade markup templates
• Less CSS preprocessor
• “Twit” twitter client
• “js-yaml” YAML parser
• Mocha testing framwork
• Chai DSL
RESTful Web Services Shouting Match
with Node.js
19. Summation & Thank you’s:
• Node is
• not a fad…
• not the answer to all your problems
• gives you flexibility
• fun to use
RESTful Web Services Conclusion
with Node.js
20. More on Shouting Match:
Rob Clark Mike Filbin Adam Roderick
# 1130
# 1610 # 1204 16:30 – 17:30
09:30 – 10:30 10:45 – 11:45 Application
A new Photoshop RESTful Services architecture using
workflow with Node.js Backbone and
Node
RESTful Web Services Conclusion
with Node.js
21. 6000 Greenwood Plaza Blvd
Suite 110
Greenwood Village, CO 80111
303.798.5458
www.aspenware.com
Michael
Filbin
This is where you can put your biographical info, but
try to keep it short otherwise it’ll push the signature too low.
Michael Filbin, Software Developer m.filbin@aspenware.com
Editor's Notes
ConcurrencyHandle multiple requests simultaneously and gracefullyManage memory for each request efficientlyLatencyThe delay between in computing cycles between instruction executionComputationally intensive tasks may induce grater latency (blocking)ComplexityImplementing parallel computing is difficultThread managementRace conditionsContention for locked structuresThread deadlocksStabilityUsing event loops avoids the need for multithreadingMemory utilization is stable as request frequency increases