Oh, To Be Single Again - Building a Single Codebase in a Client-server World

Daniel Hunt (Shazam)
Web Performance Ballroom EFGH
Average rating: ***..
(3.40, 5 ratings)

The design of a high performance interactive web application can result in duplicate business logic on both client and server, in two different languages (often in PHP and JavaScript). This overlap can be the result of optimizing empty cache launches with progressive enhancement or simply diverse deployment in an ecosystem of networks and user agents with a wide range of bandwidth and client capability. Efforts to build server-side JavaScript platforms are more than a decade old and have resulted in tepid levels of adoption in the community. This past year has resulted in a renewed momentum, driven by projects like NodeJS, and standards efforts like CommonJS, which define common specifications for areas such as modules, I/O and network interfaces in the server domain.

Most web applications at their essence, remotely fetch, aggregate, and transform data to presentation ready markup. Web-based mail is a great example and the new Yahoo! Mail architecture provides an excellent framework to investigate single code base architectures. Yahoo! Mail is deployed to an international audience with a large user base and must solve significant scale issues. The client of Yahoo! Mail is highly modular and developed with the YUI3 framework. This framework introduces a module paradigm that helps define JS code dependencies and most importantly, abstracts module and resource loading from client and server-side differences. The existing server architecture for Yahoo! Mail is developed with PHP modules that allows multi-threaded concurrent jobs in a single server request and will provide a good baseline for comparison with NodeJS’s non-blocking event-driven I/O.

By migrating several core Yahoo! mail client modules to the server, we will explore some of the real-world advantages and disadvantages of a single application code base. The presentation will look at how to practically write modules that can transparently work on both client and server. And most importantly, performance comparisons will be made on single user launch experiences, comparing data requests to template-binding, to see if we can find improvements with a common JavaScript framework. And finally, we will review the overall server load impacts that can be measured with a common codebase running in a NodeJS infrastructure.

Photo of Daniel Hunt

Daniel Hunt


Daniel Hunt works at Yahoo! for the Mail Performance Team in San Diego. In the past year, he has helped architect and implement Yahoo!‘s next generation email platform. He has a focus on developing robust and high performance code and a passion for integrating web technologies. Working with the OpenMail API, he developed Yahoo’s first mail plug-in, allowing users to integrate Flickr photos into mail. Previous to mail, he helped develop the Yahoo! Media Player, a revolutionary and easy to use music player that plays audio on your website. Prior to Yahoo!, Daniel developed applications and tools in the media and 3D graphics space working for companies such as IBM, Silicon Graphics, and Dassault Systems.

Comments on this page are now closed.


Picture of Steve Souders
Steve Souders
05/19/2011 8:06am PDT

Daniel Hunt also spoke at Velocity China. He’s a great speaker and the story of using NodeJS at a major web property is important to hear. If you’re interested in this you should also attend Tim Caswell’s workshop.

  • Keynote Systems
  • Cisco
  • Google
  • Neustar
  • Betfair
  • Cotendo
  • Rackspace Hosting
  • Akamai
  • Apica
  • dynaTrace
  • Equinix
  • Facebook
  • New Relic
  • Opscode
  • Salesforce.com
  • Yahoo! Inc.
  • AppDynamics
  • Aptimize
  • Blaze
  • CDNetworks
  • Cedexis
  • Citrix Systems
  • Compuware Corporation
  • Dyn Inc.
  • F5 Networks
  • Heroku
  • Percona
  • Quest Software
  • Schooner Information Technology
  • SiteSpect
  • Splunk
  • Strangeloop
  • WatchMouse
  • Zeus Technology
  • Neustar

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Yvonne Romaine at yromaine@oreilly.com

Download the Velocity Sponsor/Exhibitor Prospectus

Contact Us

View a complete list of Velocity contacts