Node.js, the server-side JavaScript-based software platform used to build scalable network applications, has been all the rage among many developers for the past couple of years. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Because of these advantages, there are many websites are migrating to Node.js.One of them is LinkedIn.
LinkedIn was initially built on Ruby which contained 60K lines of code, later in 2011, LinkedIn started to rebuild their core mobile service with Node.js aiming to improve the performance. This also reduces the lines of code to 2K. Why does LinkedIn choose Node.js? Kiran Prasad, who led the movement to Node.js in LinkedIn gives some reasons.
The biggest reason for that reduction is that our current code base is essentially framework-free, which means there's just not a whole lot of cruft in there.
The second big reason has to do with the more functional approach we're taking now, as opposed to an object-oriented one, which proved to be an important shift for us. In Ruby, the natural tendency is to create an object that essentially wraps every communication and type. Even though Ruby is actually a functional language, it has a much stronger notion of class and object than does JavaScript. So in our earlier code base we had lots of layers of abstraction and objects that had been created under the guise of greater componentization, refactorability, and reusability. In retrospect, however, we really didn't need most of that.
Another significant reason for the code reduction is the momentum behind the MVC (model- view-controller) model, at least for mobile vs. Web-based systems. Before, we had mostly server-side rendering. Now with the move of templates and views over to the client side—along with rendering, of course—a lot of that code has just gone away. Along with that has come a new trust and belief that the back ends, where the models live, are where the validation and all the other more advanced things are going to happen. That means not having to double-check things, which eliminates another huge chunk of code.
With its emergency in China, LinkedIn will definitely gains more users from the place where most netizens stay, this in turn will puts more challenges to LinkedIn's current technical architecture. With the migration to Node.js, it will retain the performance and at the time keeps the easiness of scale-up.