From c13773a71f68912f210f804fa6110c2a18aa1d3b Mon Sep 17 00:00:00 2001
From: Ryan
- Event-based I/O for
+ Evented I/O for
V8 javascript.
Node
- This is in contrast to today's more common model where OS threads - are employed for concurrency. Thread-based networking + This is in contrast to today's more common concurrency model where + OS threads are employed. Thread-based networking is relatively inefficient @@ -109,13 +109,14 @@ Server running at http://127.0.0.1:8000/
- Node is similar in design to systems like Ruby's Event Machine or Python's Twisted. Node takes the event
- model a bit further. For example, in other systems there is always
+ model a bit further—it presents the event loop as a language
+ construct instead of as a library. In other systems there is always
a blocking call to start the event-loop. Typically one defines
behavior through callbacks at the beginning of a script and at the
- end starts a server through a call like
+ end starts a server through a blocking call like
EventMachine::run()
. In Node there is no such
start-the-event-loop call. Node simply enters the event loop after
executing the input script. Node exits the event loop when there are
@@ -124,12 +125,13 @@ Server running at http://127.0.0.1:8000/
- Node's HTTP library has grown out of my difficulties developing and - working with web servers. For example, streaming data through most - web frameworks is impossible. Node attempts to correct these - problems in its HTTP API. Coupled with Node's purely evented - infrastructure, it makes a good foundation for web libraries or - frameworks. + HTTP is a first class protocol in Node. Node's HTTP library has + grown out of the author's experiences developing and working with + web servers. For example, streaming data through most web frameworks + is impossible. Node attempts to correct these problems in its HTTP + parser + and API. Coupled with Node's purely evented infrastructure, it makes + a good foundation for web libraries or frameworks.
@@ -137,15 +139,14 @@ Server running at http://127.0.0.1:8000/ But what about multiple-processor concurrency? Threads are necessary to scale programs to multi-core computers. - The name Node gives some hint at how it is envisioned - being used. Processes are necessary to scale to multi-core - computers, not memory-sharing threads. The fundamentals of scalable - systems are fast networking and non-blocking design—the rest - is message passing. In the future, I'd like Node to be able to - spawn new processes (probably using the - - Web Workers API - ), but this is something that fits well into the current design. + Processes are necessary to scale to multi-core computers, not + memory-sharing threads. The fundamentals of scalable systems are + fast networking and non-blocking design—the rest is message + passing. In future versions, Node will be able to fork new + processes (using the Web + Workers API ), but this is something that fits well into the + current design.