# HTTP optimizations for ApplicationCache updates

## Dominique Hazaël-Massieux Paper 2 Offline Web Applications Workshop

### Author: Dominique Hazaël-Massieux (W3C)

HTML5’s ApplicationCache provides a useful tool to ensure off-line usage of a consistent set of resources forming a Web application. But the network usage it implies could be improved when dealing with large ApplicationCache, both for first-time download and for subsequent updates.

Indeed, an ApplicationCache listing many resources will require each of these resources to be fetched separately, which induces a fairly big overhead in HTTP requests.

Batching these requests into a single request could help alleviate this overhead; the Internet Draft "HTTP Multipart Batched Request Format" might provide a useful approach to do all these requests at once, while preserving the ability to rely on HTTP headers for individual resources.

Such an approach would also reduce the overhead of verifying the state of all the resources listed in an ApplicationCache when its manifest file is updated, allowing to send and receive a single request to update all the relevant resources.

Another optimization for updating resources listed in an ApplicationCache would be to use a patch approach instead of a getting a new version of each file. Schematically, this would be done by adding a new value to Cache-Control (e.g. "patchable"), which clients could make use of by sending an additional header (e.g. "Patch-From-Match: <ETag>" or "Patch-Since: <Last-Modified>"), in which case the server would reply with a patch for the said resource, in a format defined in e.g. a Patch-Content-Type header. Such a patch format could take into account patches for gzipped resources as well.

That approach would be only applicable to a subset of resources (typically, text based formats) and might only be useful in a subset of cases (e.g. the patch needs to be smaller than the new resource), but could provide substantial gains in these cases.

Beyond specific technical suggestions, the ApplicationCache manifest file provides a useful starting point for optimizing HTTP requests for Web applications that probably deserve more attention.Developments in the Web platform make Web applications credible alternative to "native" applications in a growing number of cases.

This paper was developed with funding from the MobiWebApp project, funded by the European Union through the Seventh Framework Programme (FP7/2010-2012) under grant agreement n°257800 - Mobile Web Applications (MobiWebApp)