A Mobile Web Cache Optimization Method Based on HTML5 Application Caching
20180285470 ยท 2018-10-04
Inventors
- Xuanzhe Liu (Beijing, CN)
- Gang Huang (Beijing, CN)
- Yun Ma (Beijing, CN)
- Shuailiang Dong (Beijing, CN)
- Hong Mei (Beijing, CN)
Cpc classification
H04W4/18
ELECTRICITY
H04L67/568
ELECTRICITY
H04L67/02
ELECTRICITY
G06F9/45529
PHYSICS
International classification
Abstract
The present invention discloses a mobile web cache optimization method including the steps of: 1) crawling the resource information in the mobile web application by a server; 2) mapping resources having the same content but different URLs to a same resource; 3) selecting a stable set of resources to configure in the cache resource list; 4) setting a JavaScript runtime library, invoking a call to the runtime in each target page; 5) generating a proxy page for each target page, redirecting URL of a target page to the corresponding proxy page, and when a target page is accessed, querying the resource mapping file according to the requested resource, and retrieving the matching cache resource from the cache resource list to load onto the proxy page. The disclosed method saves the access time and reduces data traffic of the mobile web application and improves user experience of the mobile devices.
Claims
1. A method for optimizing mobile web cache based on HTML5 application cache, comprising the steps of: 1) crawling resources of a mobile web application by a server at predetermined interval to obtain the resource information; 2) mapping the resources having same content but different URLs to a same resource by the server; 3) predicting a time duration in which each of the resources is to be unchanged based on the resource information; selecting a stable set of resources to configure in a cache resource list in Manifest file associated with the HTML5 application cache; and generate a resource mapping file to preserve mapping relationship between the resources and corresponding URLs; 4) setting a JavaScript runtime library; invoking a call command for the JavaScript runtime library in each target page; automatically blocking a URL resolution request of a target page when the target page is assessed by a client browser, wherein the target page is a page of a mobile web application, each target page associated with a number of resources; and 5) generating a proxy page for a target page; redirecting URL of the target page to the corresponding proxy page; accessing a target page through the client browser including a requested resource; querying the resource mapping file according to the requested resource to find a mapped resource; and retrieving a mapped resource from the cache resource list in the Manifest file and loading the mapped resource to the proxy page.
2. The method of claim 1, wherein the resource information includes a size of the resource, MD5 value of the resource, and a buffer time allocation of the resource.
3. The method of claim 2, further comprising: extracting MD5 values of each of the resources at different times from the resource information; and acquiring a time series of changes to the MD5 values in each of the resources, wherein the time duration in which each of the resources is to be unchanged is predicted based on the time series of changes to the MD5 values in each of the resources.
4. The method of 1, wherein the step of mapping the resources having same content but different URLs to a same resource includes: receiving a regular resource list Ht1 at time t1 and a detailed resource list Rt at time t; generating a regularized resource list Ht at time t; initializing the regularized resource list Ht at time t to the regularized resource list Ht1 at time t1; setting state of each resource to nonexistent; for each resource r in R, adding a record for r is added in Ht if there is no resource in Ht corresponds to r; if Ht includes a unique resource corresponding to r, mapping r to Ht and recalculating the regular expression of the resource r; and if Ht includes multiple resources corresponding to r, deleting the original mapping and adding a new record to Ht for r.
5. The method of claim 1, further comprising: selecting a set of resources to configure into the cache resource list in the Manifest file based on the size of the resource, the predicted time that the resource is to remain unchanged, a cache configuration, or a user access distribution of the mobile web application.
6. The method of claim 5, wherein the method of selecting a set of resources comprises: calculating a total benefit in traffic saved by caching a set of resources in the cache resource list of the Manifest file at a given time Ti; and selecting a combination of resources that gives the largest benefit configure into the Manifest file in HTML5 application caching.
7. The method of claim 6, wherein the traffic saved by configuring the set of resources into the application cache is the difference between an expected cache time after the resource is cached and a previous default cache time.
8. The method of claim 1, further comprising: updating the Manifest file by the server when content of one of the resources cached in the Manifest file changes.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0031]
DETAILED DESCRIPTION OF IMPLEMENTATIONS
[0032] This section describes an example of applying the disclosed caching method at the website of the School of Information Science and Technology at Peking University (http: followed by //eecs.pku.edu.cn). The processing flow is shown in the
[0033] First, a command is invoked to embed a JavaScript library in the HTML file of the original home page, which is provided with the task of automatically intercepting and resolving URL requests, and interacting with the cache list.
[0034] Next, a proxy page is generated, and the URL of the original home page is redirected to the proxy page. The original home page becomes a resource that can be requested by the proxy page. Afterwards, when the original URL is visited, such as http: followed by //eecs.pku.edu.cn, the client first requests the proxy page, and then in the proxy page requests for all the original resources. If some of these resources have URLs that can be effectively mapped to regular expressions recorded in the resource list, the previously added JavaScript function automatically replaces these URL and instead requests them from the cache resource.
[0035] Finally, the server side automatically runs the tool. The tool automatically crawls and parses the page, provides and maintains the cache resource list Manifest on the server side, the cache resource list Manifest containing information about the resources, and connects the application cache interface to the proxy page.
[0036] Users still access the web application through the original URL, but enjoying much better experiences.