Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.js versus Rails

Node.js versus Rails

A quick comparison of Node.js versus Rails.

Serene Careaga

February 19, 2013
Tweet

Other Decks in Technology

Transcript

  1. GUIDING QUESTIONS:  What is Node.js, and why is it

    in such high demand?  How does it compare to Rails?  When should I consider using Node.js?  Where can I learn more about Node.js? NODE.JS VERSUS RAILS Serene Careaga @grrlcoder
  2. Node.js is a server-side Javascript platform that receives and responds

    to HTTP requests. More detail:  Single-threaded processes;  Event-based execution;  Built on top of Google’s V8 Javascript engine;  Asynchronous I/O library. NODE.JS What is it? Serene Careaga @grrlcoder
  3.  Alternative solution to the resource- intensive multithreading server processes.

     Fast response times/low latency.  Javascript language use bridges front-end and back-end developers.  Lightweight server solution.  Can be paired with Express.js to be a RESTful web development framework. NODE.JS The Pros Serene Careaga @grrlcoder
  4.  Library of modules to extend functionality lacks breadth; young

    product.  Best use-case is quite limited: heavy on I/O, APIs, streaming data.  Requires significant configuration time to get running on a server. Not ready “out of the box.”  Testing frameworks are not robust. NODE.JS The Cons (http://blog.targeterapp.com/post/22984987832/ why-we-moved-from-nodejs-to-ror) Serene Careaga @grrlcoder
  5. Node.js has strong appeal to businesses and clients, and it’s

    practical experience that hiring personnel are looking for in developers. Case Study: LinkedIn Mobile Product  Much better performance and lower memory overhead than other tested options, running up to 20x faster in some scenarios.  Frontend and backend mobile teams could be combined into a single unit and leverage their JavaScript skills.  Servers were cut to 3 from 30. Enough headroom remains to handle 10x current levels of resource utilization.  Development could focus more on application development than firefighting. NODE.JS Who cares? Serene Careaga @grrlcoder (http://highscalability.com/blog/2012/10/4/linkedin-moved -from-rails-to-node-27-servers-cut-and-up-to-2.html)
  6. RAILS The Pros  A powerful framework paired with an

    object-oriented language.  An active community that offers a lot of support, documentation and tools. (See: Railscast, Ruby Toolbox, etc.)  Full ecosystem that allows for seamless vertical integration.  Rapid deployment.  So. Many. Freaking. Gems. Serene Careaga @grrlcoder
  7. RAILS The Cons Serene Careaga @grrlcoder  Database orientation can

    be difficult to maintain.  Scalability concerns (note: ORM/query problems often the cause).  Rails is always evolving. This can be difficult for app maintenance and taxing on developers.  High learning curve: must learn Ruby, Rspec (or prefered TDD), SASS, Coffee Script to get your app functional.
  8. Let’s get to the good stuff: What are the best-use

    cases for Node.js, and when does Rails reign supreme? NODE.JS VERSUS RAILS Serene Careaga @grrlcoder
  9. NODE.JS When To Use It  High I/O: games, API,

    VOIP, real-time anything.  Asynchronous hooks: GitHub service hooks, push notifications.  Project requires lightweight server solution.  Example apps: Mockingbird (wireframes on the fly), Scrabb.ly (Scrabble-ish game), Serene Careaga @grrlcoder
  10. RAILS When To Use It  Works great for an

    array of web products: membership-based sites, CMSs, complex interactive sites.  You have an urge to test, frequently.  MVC design logic and database usage are critical to application functionality.  All the things! (Joking.) Serene Careaga @grrlcoder
  11. A CAVEAT Best of both worlds! Serene Careaga @grrlcoder You

    can configure Rails to run as a single-process, event-driven architecture with EventMachine. http://rubyeventmachine.com/ You can also configure Node.js to run Ruby. (Plus, don’t forget Express.js for framework functionality!) https://devcenter.heroku.com/articles/realtime-polyglot-app-nod e-ruby-mongodb-socketio
  12. QUESTIONS? Resources Great overview article by IBM: http://www.ibm.com/developerworks/library/os-nodejs/ The Node

    Beginner Book: http://www.nodebeginner.org/ Mashable’s Introduction to Node.js: http://mashable.com/2011/03/09/node-js/ StackOverflow Conversations: http://stackoverflow.com/questions/9585767/clarifications-about-rails-and -node-js http://stackoverflow.com/questions/3436335/could-node-js-replace-ruby- on-rails-completely-in-the-future http://stackoverflow.com/questions/5540490/eventmachine-vs-node-js Serene Careaga @grrlcoder