3. Background
• Server Side JavaScript
• Developed by Ryan Dhal (2009)
• Currently owned by Joyent
• Based off Google’s V8 JavaScript Engine
(which is written in C and C++)
• Open Source
4. It’s Asynchronous
• Non-blocking due to system event notifications
• Not having to deal with common multithreading
problems such as deadlocks, resource sharing
and etc. (See [6] for more details)
• Scalability (930k[tested] to 1500k[claimed]
connections) [4]
• Most of the server and client side work can be
done in JavaScript
5. Usage domain areas/users
Microsoft
Node gives Azure users the first end-to-end JavaScript experience for the
development of a whole new class of real-time applications.
eBay
Node’s evented I/O model freed us from worrying about locking and
concurrency issues that are common with multithreaded async I/O.
Linkedin
On the server side, our entire mobile software stack is completely built in Node.
One reason was scale. The second is Node showed us huge performance gains.
Yahoo
Node.js is the execution core of Manhattan. Allowing developers to build one
code base using one language – that is the nirvana for developers.
http://nodejs.org/
6. Google Trends – “node.js”
http://www.google.com/trends/?q=node.js
7. Ample Resources
• Free e-Books
• Code Samples including 3rd party sources
• Modules usage guides/samples
• Benchmarking and comparisons to other
technologies
• However, it is missing scholarly papers and
research.
8. Modules
• Modules are plugins/add-ons/extensions for
Node to help with development process.
• Often code examples are included
alongside the module.
• Several categories of modules.
• Modules are plugins/add-ons/extensions for
Node to help with development process.
9. 3000+ modules in the areas below
• Web frameworks • Templating • Parsers
• Routers • CSS Engines • JSON
• Static file servers • Content Management Systems • XML
• Microframeworks • Build and Deployment • Command Line Option
• Frameworks • Package Management Systems Parsers
• Middleware • Module Loader • Parser Generators
• JSGI • OpenSSL / Crypto / Hashing • Other Parsers
• Connect • SMTP • Debugging / Console Utilities
• Other middleware • TCP / IP • Compression
• Other • Multiple protocols • Graphics
• Database • HTTP • Sound
• MS SQL Server • FTP • Payment Gateways
• PostgreSQL • E-mail • API clients
• MySQL • XMPP • Control flow / Async goodies
• SQLite • Other networking • I18n and L10n modules
• Oracle • RPC • Boilerplates
• NoSQL and Key/Value • Web Sockets & Ajax • Continuous Integration Tools
• Mongo • Message Queues • DDD, CQRS, EventSourcing
• Hive • Class systems • Desktop application related
• Redis • Testing / Spec Frameworks • JavaScript threads
• CouchDB • Wrappers • Other
https://github.com/joyent/node/wiki/modules
14. Benchmarks [1 , 4 ]
• Analysis
• Conducted by the owner of Erwin
• Comparison of all event based languages
• Tested on a single core
• Recognized by Tom Hughes-Croucher (representing Node)
• Node is fairly new and yet it can compete with other mature technologies
• Performance is not everything. Other factors (Usability, stability, etc)
should be considered as well.
• THEY ARE ALL AVERAGES BEING PLOTTED. Concern about exceptional
cases (unusually long calls) may bring down the overall performance down.
16. Benchmarks
Analysis
• Conducted by 3rd party
• Comparing Node against Apache + PHP is
an unfair experiment but is a realistic case.
• Benchmarking tool was sharing resources
while the tests were run.
18. Benchmarks
Analysis
• Conducted by 3rd party
• Heavier work loads being tested – DB
access was involved.
• Run on a single machine and was not
distributed.
19. Benchmarks [3]
Analysis
• Conducted by 3rd party
• Simple random number generation / return
test.
• Missing physical hardware set information.
20. Benchmarks – Final thoughts
• Node is worth investigating as it shows
rapid growth in 3 years of existence.
• Needs higher quality benchmarking tests
conducted in real life scenarios.
• Scholarly research is still scarce.
• Recommended domain areas – scalable
web services, non critical software.
34. Express & REST
app.post('/register', function(req, res) {
var newUser = new User();
newUser.username = req.body.username;
newUser.password = req.body.password;
newUser.display_name = req.body.displayname;
newUser.date_created = new Date();
newUser.save(function(err) {
if (err) {
res.redirect('error');
} else {
res.redirect('home');
}
});
});
35. Mongoose
var UserSchema = new Schema({
username: {
type: String,
index: { unique: true }
},
password: String,
salt: String,
display_name: String
date_created: Date
});
var User = mongoose.model('User', UserSchema);
36. socket.io
socket.on('disconnect', function() {
if (socket.handshake.session.user) {
var user =
socket.handshake.session.user.username;
io.sockets.in(user).emit('exit', { user:
user });
}
});
40. Problems
• mongoose schemas
• Socket.io access to sessions
• Handling groups of sockets
• Passing server-side data to front-end
• YouTube API and HTML5
42. What I Learned
• Easy to get an app up and running
• MongoDB is incredibly simple
• YouTube API is great to work with
43. Contact
Shael Joon Matt Simonis
Rochester Institute of Technology Rochester Institute of Technology
website: www.shaeljoon.com website: www.mattsimonis.com
email: shaeljoon@gmail.com email: matts12290@gmail.com
twitter: @mattsimonis