29.11.2012 Views

2nd USENIX Conference on Web Application Development ...

2nd USENIX Conference on Web Application Development ...

2nd USENIX Conference on Web Application Development ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ackend channel. This approach is easier than trying to<br />

include l<strong>on</strong>g polling in existing MVC frameworks but is<br />

not as clean as keeping all applicati<strong>on</strong> logic in <strong>on</strong>e framework.<br />

Event-based <strong>Web</strong> frameworks differ from other frameworks<br />

because they <strong>on</strong>ly run <strong>on</strong>e thread at a time, eliminating<br />

the thread issues traditi<strong>on</strong>al MVC frameworks<br />

have when implementing l<strong>on</strong>g polling. Since there is<br />

<strong>on</strong>ly <strong>on</strong>e thread, it is important that it does not block. If<br />

an expensive operati<strong>on</strong> is performed, such as disk or network<br />

access, a callback is specified by the caller and the<br />

server stops processing the current request and starts processing<br />

a different request. When the operati<strong>on</strong> finishes,<br />

the server runs the callback, passing in values generated<br />

by the operati<strong>on</strong>. This style of programming makes it<br />

easy to resume a request at a later time as is required<br />

with Vault. Node.js [5] is an javascript event-based IO<br />

library used to write server-side javascript applicati<strong>on</strong>s.<br />

Tornado [6] is a similar <strong>Web</strong> server for Pyth<strong>on</strong>, based <strong>on</strong><br />

FriendFeed [4].<br />

10 C<strong>on</strong>clusi<strong>on</strong><br />

L<strong>on</strong>g polling allows for new interactive <strong>Web</strong> applicati<strong>on</strong>s<br />

that resp<strong>on</strong>d quickly to external events. Existing implementati<strong>on</strong>s,<br />

however, have not been general or scalable,<br />

and they require too much glue code for applicati<strong>on</strong> developers.<br />

We have presented a modificati<strong>on</strong> of the MVC<br />

pattern that allows developers to write their applicati<strong>on</strong>s<br />

in a familiar style without needing to know about the details<br />

of how l<strong>on</strong>g polling is implemented. Furthermore,<br />

Vault makes it easy to develop a variety of feeds that can<br />

be reused in many different applicati<strong>on</strong>s. Internally, the<br />

Vault implementati<strong>on</strong> handles l<strong>on</strong>g polling in a scalable<br />

way using a distributed notifier to minimize the amount<br />

of work that is required per request.<br />

We hope that the Vault architecture will be implemented<br />

in a variety of mainstream frameworks in order<br />

to encourage the development of interesting applicati<strong>on</strong>s<br />

based <strong>on</strong> l<strong>on</strong>g polling.<br />

11 Acknowledgments<br />

This research was supported by the Nati<strong>on</strong>al Science<br />

Foundati<strong>on</strong> under Grant No. 0963859. Thanks to Tomer<br />

L<strong>on</strong>d<strong>on</strong>, Bobby Johns<strong>on</strong>, and an<strong>on</strong>ymous program committee<br />

members for reviewing various drafts of this paper.<br />

References<br />

[1] Bayeux protocol. http://svn.cometd.com/trunk/<br />

bayeux/bayeux.html.<br />

[2] Cometd homepage. http://cometd.org/.<br />

12<br />

[3] Django. http://www.djangoproject.com/.<br />

[4] Friendfeed homepage. http://friendfeed.com/.<br />

[5] Node.js homepage. http://nodejs.org/.<br />

[6] Tornado web server homepage. http://nodejs.org/.<br />

[7] <strong>Web</strong> socket api. http://dev.w3.org/html5/<br />

websockets/.<br />

[8] GARRETT, J. J. Ajax: a new approach to web applicati<strong>on</strong>s,<br />

February 2005. http://www.adaptivepath.com/<br />

ideas/essays/archives/000385.php.<br />

[9] LAMPSON, B. W., AND REDELL, D. D. Experience with processes<br />

and m<strong>on</strong>itors in mesa. Commun. ACM 23 (February 1980),<br />

105–117.<br />

[10] OUSTERHOUT, J. Fiz: A Comp<strong>on</strong>ent Framework for <strong>Web</strong><br />

Applicati<strong>on</strong>s. Stanford CSD Technical Report. http://www.<br />

stanford.edu/˜ouster/cgibin/papers/fiz.pdf,<br />

2009.<br />

[11] OUSTERHOUT, J., AND STRATMANN, E. Managing state for<br />

ajax-driven web comp<strong>on</strong>ents. <str<strong>on</strong>g>USENIX</str<strong>on</strong>g> <str<strong>on</strong>g>C<strong>on</strong>ference</str<strong>on</strong>g> <strong>on</strong> <strong>Web</strong> Applicati<strong>on</strong><br />

<strong>Development</strong> (June 2010), 73–85.<br />

[12] REENSKAUG, T. Models-views-c<strong>on</strong>trollers. Xerox PARC<br />

technical note http://heim.ifi.uio.no/˜trygver/<br />

mvc-1/1979-05-MVC.pdf, May 1979.<br />

[13] REENSKAUG, T. Thing-model-view-editor. Xerox PARC<br />

technical note http://heim.ifi.uio.no/˜trygver/<br />

mvc-2/1979-12-MVC.pdf, May 1979.<br />

[14] RUSSEL, A. Comet: Low latency data for the browser,<br />

March 2006. http://alex.dojotoolkit.org/2006/<br />

03/comet-lowlatency-data-for-the-browser/.<br />

[15] STOICA, I., MORRIS, R., LIBEN-NOWELL, D., KARGER,<br />

D. R., KAASHOEK, M. F., DABEK, F., AND BALAKRISHNAN,<br />

H. Chord: a scalable peer-to-peer lookup protocol for internet<br />

applicati<strong>on</strong>s. IEEE/ACM Trans. Netw. 11 (February 2003), 17–<br />

32.<br />

124 <strong>Web</strong>Apps ’11: <str<strong>on</strong>g>2nd</str<strong>on</strong>g> <str<strong>on</strong>g>USENIX</str<strong>on</strong>g> <str<strong>on</strong>g>C<strong>on</strong>ference</str<strong>on</strong>g> <strong>on</strong> <strong>Web</strong> Applicati<strong>on</strong> <strong>Development</strong> <str<strong>on</strong>g>USENIX</str<strong>on</strong>g> Associati<strong>on</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!