Book Image

Learning Single-page Web Application Development

Book Image

Learning Single-page Web Application Development

Overview of this book

Table of Contents (15 chapters)
Learning Single-page Web Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Node server, NPM, and middleware


Node is a web server built with JavaScript and the basic Node.js proposal is of high performance and scalable web applications, but what does it really mean?

In other server-side programming languages, such as Java, PHP, and .NET, each connection starts a new thread on the server potentially, and in general is accompanied by 2 MB of memory. On a server that has 8 GB of RAM, this defines the maximum number of concurrent connections as about 4,000 users. Now, imagine that your application is growing and every day gets more and more hits; you probably will need more servers or even to invest in more hardware. This is the bottleneck of the whole architecture of web applications, the maximum number of concurrent I/O connections a server can handle and keep stable. Node.js solves this by changing how a connection is made to the server. Instead of starting a new thread for each connection, it creates a process that does not require a memory block to accompany it...