Surprise Me!

Daniel Hunt - Oh, To Be Single Again. Building a single codebase in a client-server world - jsday2011

2011-09-26 0 129 Vimeo

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 experience, 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.

Buy Now on CodeCanyon