InfoQ Homepage Presentations Node.js: Asynchronous I/O for Fun and Profit
Node.js: Asynchronous I/O for Fun and Profit
Summary
Stefan Tilkov presents what asynchronous I/O means and how it can be performed on servers and web clients using Node.js and other JavaScript tools and libraries.
Bio
Stefan Tilkov is co-founder and a principal consultant at InnoQ, a consulting firm with offices in Germany and Switzerland. Stefan focuses on enterprise architecture consulting for Fortune 1000 companies, which currently translates to assessing SOA maturity and deriving appropriate steps for a road map towards a service-oriented enterprise.
About the conference
QCon is a conference that is organized by the community, for the community.The result is a high quality conference experience where a tremendous amount of attention and investment has gone into having the best content on the most important topics presented by the leaders in our community.QCon is designed with the technical depth and enterprise focus of interest to technical team leads, architects, and project managers.
Community comments
Handling Asynchronous Computations
by Faisal Waris,
Re: Handling Asynchronous Computations
by Axel Rauschmayer,
Re: Handling Asynchronous Computations
by Tristan Slominski,
Handling Asynchronous Computations
by Faisal Waris,
Your message is awaiting moderation. Thank you for participating in the discussion.
While this is an interesting presentation, I chuckled a bit because managing asynchronous computations with javascript seems harder than it needs to be.
Consider for example the F# async monad. To sequence three async calls with data dependencies between them is as simple as writing the following:
async {
let! data1 = asyncCall1()
let! data2 = asyncCall2(data1)
let! data3 = asyncCall2(data2)
return data3
} |> Async.Start
Notice that no nesting of callbacks is required.
And this is all statically type checked. Type inference means very little explicit type information is needed.
Try-catch, sleep, timers, events, async io, etc., all work in async monads without thread blocking.
Similarly fork-join of 3 independent calls is as simple as:
[
asyncCall1();
asyncCall2();
asyncCall3()
] |> Async.Parallel |> Async.Start
You can compose async monads together for handling many complex scenarios.
In moving off of java, the smart people at Node.js maybe should have cast the net a bit wider than just javascript.
Anyone interested understanding the essence of monads can check out this post: fwaris.wordpress.com/2011/07/30/understanding-m...
Re: Handling Asynchronous Computations
by Axel Rauschmayer,
Your message is awaiting moderation. Thank you for participating in the discussion.
Improvements are coming: github.com/dherman/taskjs
Re: Handling Asynchronous Computations
by Tristan Slominski,
Your message is awaiting moderation. Thank you for participating in the discussion.
github.com/caolan/async