Node.js: JavaScript leaves the browser

Node.js brings JavaScript to the server side through Chrome's V8 engine, with a single-threaded event loop and non-blocking I/O to handle thousands of concurrent connections.

Open SourceWeb Open SourceNode.jsJavaScriptBackendV8Event Loop

JavaScript beyond the browser

For nearly fifteen years JavaScript was confined inside the browser, used for animations, form validation and small client-side interactions. In May 2009 Ryan Dahl presents a project that radically changes the perspective: Node.js, a runtime that executes JavaScript on the server side by leveraging the V8 engine developed by Google for Chrome.

The idea is not entirely new — server-side JavaScript was attempted in the past with Netscape LiveWire and Rhino — but Dahl starts from a precise architectural assumption: traditional servers handle concurrency by allocating one thread per connection, a model that scales poorly when simultaneous connections grow into the thousands.

Event loop and non-blocking I/O

At the heart of Node.js lies a single-threaded event loop that handles all requests within a single cycle of events. Every I/O operation — file reads, database queries, network calls — is delegated to the operating system and completed asynchronously. When the operation finishes, a callback is placed on the event queue and the event loop executes it on the next cycle.

This model, known as non-blocking I/O, means the process never waits idly for a slow operation. Where a traditional thread would remain blocked waiting for a database response, Node.js continues serving other requests and returns to the first only when the data is ready.

The result is a server capable of handling a very large number of concurrent connections with modest memory consumption, because there is no thread per connection but a single loop coordinating them all.

A model built for real time

The architecture of Node.js makes it particularly suited to scenarios where many connections remain open simultaneously with frequent exchange of small messages: real-time applications such as chat, dashboards with live updates, data streaming and long polling. In these contexts the bottleneck is not computational power but efficient I/O management, exactly the problem the event-driven model solves.

Node.js is released under the MIT licence and is written in C++ with bindings to V8. The project is born with a clear, focused objective: to provide a lightweight, efficient server infrastructure for high-concurrency applications, demonstrating that JavaScript can be a systems language, not just a scripting one.

Link: nodejs.org

Need support? Under attack? Service Status
Need support? Under attack? Service Status