A Detailed Introduction to Node.js

Aaron Wang 2013/3/30

My purpose is bring things up so you can dig into if you are intrested

Agenda

Think Node.js in the Perspective of Back-end Engineers

Concurrency Model of Net Servers

Two facts

The most primitive net server, iterative server with blocking I/O

The most popular model, multiple processes/threads with blocking I/O

Event-driven, single-threaded, and non-blocking I/O

Multiple threaded with non-blocking I/O

C#5, ASP.NET MVC 4, and asynchronous Web applications

one more model: lightweight/micro process/thread, coroutine(协程), fiber(纤程)...

High Concurrency of Net Servers

A compare from 朋友网

A compare from 朋友网

A compare from 朋友网

A compare from 朋友网

A compare from 朋友网

A compare from 朋友网

A compare from 朋友网

A compare from 朋友网

Speak with test data: 推送宝A2DM

concurrent long connections

High Performance

Inner Structure and Running Process

Inner Structure

node structure node src structure

Event loop?

Asynchronous I/O?

Running process

Think Node.js in the Perspective of Front-end Engineers

Full Stack JavaScript

One language to rule them all

ring

What's a stack?

Impedance mismatch

ASP.NET

J2EE

PHP

You may have get used to it, but does it have to be this way?

Now you have a better choice:

Benefits

Frameworks

Web Developing Revolution

Old way of web developing

Meteor - A better way to build apps

More analogous frameworks

Derby, SocketStream... all based on Node.js

Why So Popular On Earth?

Back to the Beginning

Reinvent the Wheel?

It Put Cool Things Together!

The Disadvantages and Solutions

Multi-cores, Parallelism?

Computation Intensive Task?

JavaScript Is Not Perfect!

javascript good parts

Callback Hell and Asynchronous Programming Patterns

Problems:

Use named function

named function

Wind.js - 赵劼(Jeffrey Zhao)

Promise and Deferred

Coroutines

Has to be so complicated?

How to Handle Exception

How to Debug

Pitfalls

JavaScript Everywhere

Summary

References

Thanks!

/

#