The Case for Node.js at eBay Advertising
Proposal
Promote Node.js (Node) to the sanctioned technology stack for external facing applications here at eBay Advertising.
For our purposes, Node would act as an alternative to Tomcat for some use cases and become the front end server layer for those web applications.
There exists some philosophical resistance to the use of Node, since Node is Javascript.
The goal of this document is to help erode the natural FUD about Node and encourage taking a closer look at what it is and why we should get on board.
As a company, we’ve made the leap with the rest of the industry to incorporating realtime, scalable data stores like redis and aerospike.
We should similarly advance the rest of the tech stack.
Introduction
Our web applications tend to use API Services to get data and merge that into templates to render on the web using a combination of HTML, CSS, and Javascript.
Node runs javascript and is particularly good at efficiently handling the use case of service-backed, data-driven, dynamic web applications.
While Node is not currently available to developers in the sanctioned technology stack for public facing applications here at eBay Advertising, Operations is receptive to the adoption of new technology provided that it meets sufficient qualifying criteria. The criteria are practical in nature, including a range of value metrics, fitness for purpose, and operational supportability.
Node usage in the industry and within larger eBay provide some case studies that give credence to the characterizations and value claims to be presented.
This document will contain a small amount of background and prose hailing the virtues of node, followed by a meat and potatoes effort to make a case for it here at eBay Advertising. This will follow an expository Q/A format.
What is Node?
Node is a platform built on top of Google’s V8 javascript engine (the js engine in Chrome).
(wikipedia)Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.
Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works.
Node is asynchronous and non-blocking by design, allowing it to achieve excellent throughput with massive concurrency using an efficient single threaded event loop.
In contrast, Tomcat supports the same general purpose but uses the conventional thread-per-connection model. For situations where I/O wait is to be expected for each connection (i.e. web based applications), thread-per-connection is less resource efficient and less performant under load than an evented server (for non CPU-intensive applications).
Why Node?
Node has excellent performance characteristics for real-time network applications where I/O is a significant portion of overall latency. This is often true for service-backed web apps that need to wait for data from some backend.
For web-service driven stacks (a common pattern here at eBay Advertising), web application servers will hold two (or more) http connections per client request (to the client browser and to backend services). This makes for two potential I/O wait points that benefit from Node’s async treatment, obviating thread (per connection) pools that waste resources during that I/O wait.
For bandwidth limited and less reliable network connections (e.g. mobile clients), longer latencies are expected, improving resource usage graphs in Node’s favor.
Javascript as a language and as a server-side solution is becoming a powerful option to unify the end-to-end web development stack.
See Atwood’s Law
It states that any application that can be written in JavaScript will eventually be written in JavaScript.
What is the difference between Node and Tomcat
Technically, it’s in an improper comparison, since Node is more analagous to the JVM than to Tomcat. For the sake of this discussion, we’ll compare how webservers in Node differ from Tomcat.
The Node programming paradigm is essentially asynchronous, non-blocking, event-driven Javascript, which is fundamentally different from the usual fare in Tomcat, which is typically synchronous, blocking, and sequential.
Node is single threaded (one thread watching/handling events from all connections) whereas Tomcat is multi-threaded and can utilize multiple cores.
That might sound bad for Node, but the use cases for Node are specifically in the realm of I/O bound applications, not CPU-heavy operations. The scaling model for Node is to use multiple processes instead of multiple threads.
End-to-end Javascript makes it possible for front end devs to write sophisticated server apps in record time. Javascript developers embrace functional programming, a paradigm that makes async callback handling simple and elegant. In other words, it’s easy to write scalable (efficient) network applications in Node.
Node and the litany of Node modules in the npm (Node Package Manager) registry do things in a way that nicely fits the world of http.
Again, Tomcat with java gets the job done, but the direction of things for scalable web applications is begging us for native, non-blocking Javascript and JSON support through a convenient, high performance runtime.
This is the promise and reality of Node.
In which layer does Node belong
For our service driven web apps, it fits into the role of front end web server, replacing tomcat in the cases where we use tomcat as a thin proxy to API services, and particularly shines in scenarios involving long wait db calls and sketchy network mobile usage scenarios with global reach.
As it is, our webtier engineers currently expect tomcat, and tomcat has served us well. Tomcat and Java in general is a proven solution for business applications. It is a good fit.
In time, we may find that Node is an even better fit for our style of web apps, especially those that are more client heavy javascript apps backed by API services that need to accommodate increasingly global, mobile clients.
Specific eBay Advertising apps for which Node would be a good fit
(1) Event Tracker — This is the ONLY existing (internal and un-utilized) production Node app here at eBay Advertising.
See the wiki page.
EventTracker is a general purpose ClientSide Event Tracker, i.e. PageView, Mouse Click, Button Press, etc.
(2) Merchant Account Center (MAC: http://www.youtube.com/watch?v=ATvD7EvIzCE) — Originally, we considered Node for the web-tier, but at the time it was forbidden due to unsanctioned status. Node would be a good fit in this case precisely because it fits into the service-driven, high-latency case. The webtier has to wait for API calls to resolve data queries that sometimes take 30 minutes or more. Plus, the redesigned MAC was designed to be heavy Javascript on the client side with a thin webtier proxy. This is best case scenario for Node.
(3) Sunshine Ads FTL replacement — Currently, ads are rendered on the server in the publisher API. We have a project to extract FTL templates from API and move that to a javascript-powered client-side solution that will again utilize the API in a service-driven fashion. Node would be a perfect fit for an orchestrating webtier. Furthermore, we expect ads to be viewed on mobile devices as much as desktop browsers. Efficient handling of high latency, testy mobile network connections is a strength of Node.
(4) SKU-Level Bidding API server — SLB API provides realtime bid data to clients from a redis db. That’s network calls all the way on both ends.
(5) PAC and CTD console — These are both API service driven and should get a boost from Node over tomcat.
Case Studies & References
Below are case studies and references from within and without eBay.
Get Joe Hanink’s stories in your inbox
Join Medium for free to get updates from this writer.
Please take a careful look, as they already have real stories to tell, stories from experience that do far better explaining the value of Node than the abstract hand-waving above.
1. PayPal’s migration to Node from Java
https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/
All of our consumer facing web applications going forward will be built on node.js.
2. eBay’s ql.io Node platform
http://www.ebaytechblog.com/2011/11/30/announcing-ql-io/
3. eBay’s first large-scale Node application
http://www.ebaytechblog.com/2013/05/17/how-we-built-ebays-first-node-js-application/
4. LinkedIn Node at scale
http://venturebeat.com/2011/08/16/linkedin-node/
5. PayPal’s open source framework for Node — Kraken.js
6. Walmart hiring for Node.js devs
During the Holiday Season of 2012, 40% of Walmart Global eCommerce traffic came from mobile devices, and that trend is only going to increase. We are transitioning from our Core Java solution to and end-to-end JavaScript solution utilizing Node.js. When we say node.js, we mean 100% node. No marketing tricks. We are making a strategic investment in node both internally and in open source with over 20 modules on npm including @hapijs, our node framework. We’re a Platinum sponsor of NodeConf with about a dozen team members attending this year.
7. Quora — Who’s using Node in Production
http://www.quora.com/Node-js/What-companies-are-using-Node-js-in-production
PayPal:
We are moving every product & every site within PayPal to Node. We started the journey by using it as prototyping framework, then at start of this year we hardened it to work with all PayPal systems. We have several of our beta products out live on NodeJS and half dozen other products in flight. By end of 2014 we hope to have all major experiences redesigned, and rewritten on nodejs.
NodeJS is a forcing function to completely obliterate the old stack and the old experiences.
We are seeing big scale gains, performance boosts and big developer productivity.
8. Yahoo’s open source Node project — Mojito
http://venturebeat.com/2012/04/02/yahoo-node-open-source-mojito/
JavaScript is the single most widely available programming language today, and that’s something worth taking advantage of.
9. eBay’s formal “CubeJS” Node project
https://github.scm.corp.ebay.com/cubejs-ebay
10. LinkedIn Node performance tips
http://engineering.linkedin.com/nodejs/blazing-fast-nodejs-10-performance-tips-linkedin-mobile
11. Six things you should know about Node.js
12. Node in the Industry — Quotes
Node’s evented I/O model freed us from worrying about locking and concurrency issues that are common with multithreaded async I/O.
Subbu Allamarju
Principal Member, Technical Staff (eBay)On the server side, our entire mobile software stack is completely built in Node. One reason was scale. The second is Node showed us huge performance gains.
Kiran Prasad
Director of Engineering, Mobile (LinkedIn)Node.js is the execution core of Manhattan. Allowing developers to build one code base using one language — that is the nirvana for developers.
Renaud Waldura
Sr. Product Manager, Cocktail (Yahoo)Node.js powers our web applications and has allowed our teams to move much faster in bringing their designs to life. We’ve happily embraced the power of JavaScript.
Jeff Harrell
Director of Engineering (PayPal)Node gives Azure users the first end-to-end JavaScript experience for the development of a whole new class of real-time applications.
Claudio Caldato
Principal Program Manager, Microsoft Open Technologies, Inc. (Microsoft)A news organization must be responsive, both to its readers and to a fast-paced flow of information. Node provides a level of flexibility we haven’t found anywhere else — and enables us to deliver performant apps that can be easily adjusted.
Trevor Landau
Software Engineer, Mobile Web (The New York Times)The simple truth is Node has reinvented the way we create websites. Developers build critical functionality in days, not weeks.
Michael Yormark
WSJD Product Operations (DOW JONES)Node allows our team to speak one language throughout the stack: JavaScript. We can use Chrome Inspector to inspect both our frontend and backend code. Magical.
Xavier Damman
Cofounder/CEO (Storify)
13. Javascript is eating the world
http://slashdot.org/topic/bi/javascript-is-eating-the-world/
14. Monolithic Node.js (epic)
http://www.richardrodger.com/monolithic-nodejs#.UsyJ53mbE5U
15. Node.js Explained (video)
http://www.youtube.com/watch?v=L0pjVcIsU6A
16. Felix’s Node.js Convincing the boss guide
http://nodeguide.com/convincing_the_boss.html
17. ADP and Dow Jones
http://www.enterprisetech.com/2014/04/25/adp-dow-jones-help-mainstream-node-js/






