Node.js is a popular server-side JavaScript framework built off the impressively fast open source V8 JavaScript engine used in Google Chrome. Programs for Node.js are written in JavaScript using event-driven, asynchronous I/O requests which can help allow for handling of tens of thousands of simultaneous client connections efficiently.

Node.js is built around a server network library, and it contains built-in HTTP communication methods. So it's possible to run a web server using just Node.js without any external software such as Apache. It also allows more control over how the web server works and it enables for an entire application, both client-side, and server-side, to be written in JavaScript.

Already know the deal on Node.js? You might want to just jump right to how to install Node.js.

Asynchronous vs Thread based requests

Common server-side programs written in languages like PHP, Python, or Perl, rely on a traditional thread based model for client connections, where each connection creates an OS thread to execute the request. These typically take around 2MB of system memory at a minimum, so if you're on a server with 1024MB of RAM, chances are when you're approaching around 512 simultaneous client connections to the server, you could be exhausting your server's memory.

Node.js instead uses event-driven programming, so each connection uses a very small amount of memory while connecting. Then Node.js uses callbacks or references to inform the OS that a new connection is being requested. So the majority of the time Node.js does not disturb the OS, and this can lead to increased performance and efficiency.

No or minimal file locking

When two or more processes share the same resource from most other server-side programs, one would have to be locked temporarily in order to allocate resources to the other process. That can cause problems where essentially processes are deadlocked and battling back and forth for the required resource, leading to delays in execution.

Node.js doesn't have this same problem as it handles almost no direct input or output operations, and so it doesn't cause a deadlock on server resources.

What can you do with Node.js

There are a ton of different types of applications that you can build using Node.js, and while it is still a somewhat newer entry into the server-side programming realm, there are already a lot of options out there.

Here are just a few examples of the types of applications that can be built using Node.js:

  • Application server
  • Client of web service (FaceBook or Twitter client)
  • Log and log monitoring
  • Web based software

Node.js advantages

  • Handles concurrent connections efficiently due to being event-driven and non-blocking.
  • Common language on both client-side and server-side
  • Fuctional API

Node.js disadvantages

  • Can't be run on most shared-hosting servers
  • Still new and lacks some wider database support

You should now have a bit clearer picture about what Node.js is, and how it could possibly help you write more efficient server-side applications for handling large amounts of concurrent requests. In other articles, we'll cover installing Node.js as well as some real world examples of the types of applications you can create with it.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Write New!
Do you want to publish a tutorial to our support center?

News / Announcements

SSL Certficate Warnings
Updated 2014-04-14 11:34 am EST
Hits: 2230
Heartbleed 0-day OpenSSL security bug
Updated 2014-04-14 04:43 pm EST
Hits: 5654

Related Questions

Here are a few questions related to this article that our customers have asked:
Wondering if you guys support node.js?
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!