DEV Community

Cover image for Node.js VS Rails?
Sim Greenbaum
Sim Greenbaum

Posted on

Node.js VS Rails?

Why is node.js so popular as a back-end server and what is so bad about Rails? You are right a small app for a local shop so they could do some marketing, not a full eCommerce page most probably Rails is fine. You won’t be getting that many hits and your costs will be minimal. However think Twitter or even a small e-commerce website if you will be using a blocking I/O which means the lines are shared and everything runs synchronously, the way Active Record(an ORM) works. When we query the database while we wait for a response the server won’t process a new request on the other hand non-blocking I/O when we will query the database we wait for a response or as we call them today promises. While we are waiting we can move on to the next request till we get a response. Think of a checkout counter at the grocery we wait for the cashier to finish with the person in front of us who needs a price check on an item even if we only have two items (seems like a waste of time).

With this architecture, we have the ability to build a bigger and better system. In addition, Node.js is lightweight and more efficient. Scalability and server costs are the companies’ number one priority. If the site will be slow it makes less money, if the hosting server CPU costs are high their profit margin will be smaller. Being a developer is not just about being able to write or even debug code. You need to understand things on a deeper level as this will help you decide what technologies are a good fit for each project.

All the best,

Simcha Greenbaum

Top comments (4)

Collapse
 
guledali profile image
guledali

Why is node.js so popular as a back-end server and what is so bad about Rails?

So I consider myself to be junior++ ruby developer. Just my background, I like using rails for building api for my spa.

As developer I enjoy oop but also writing tests, this is the thing. When I was first started getting into to doing smaller backend projects with node.js None of the tutorials I went through covered any testing at all.That was a dealbreak at time but also ruby is very enjoyable to write and very elegant programming language I would say but that said.

I think is because more innovation is going on node.js compared to ruby that + they are less developers that are familiar with ruby. Personally I have started lately getting excited about node.js again because of lambda functions and the serverless movement.

Collapse
 
gbs4ever profile image
Sim Greenbaum

I love ruby and it is so much more fun to write in ruby lol . When i had to create a small Twillo app I built it in ruby 😊😊

Collapse
 
krio profile image
Kevin Rio

If we're talking about server runtime speed then why use JS/Node at all? Might as well use C#, Java or Go as they are going to run circles around JS/Node in a real world app where JS isn't just executing C++. Saving a few ms off of each response isn't the best place to optimize in the big picture.

Collapse
 
gbs4ever profile image
Sim Greenbaum

So true!! My post was geared to not just understand a programing language but what is going on under the hood. As I just told a client I help you choose what is best for your company -- short and long term goals. Dev.to platform is built-in rails and is great for there needs! πŸ˜‰πŸ˜‰