CN106294597B - The method and apparatus being grouped for the static resource to webpage - Google Patents

The method and apparatus being grouped for the static resource to webpage Download PDF

Info

Publication number
CN106294597B
CN106294597B CN201610615662.9A CN201610615662A CN106294597B CN 106294597 B CN106294597 B CN 106294597B CN 201610615662 A CN201610615662 A CN 201610615662A CN 106294597 B CN106294597 B CN 106294597B
Authority
CN
China
Prior art keywords
resource
static resource
grouping
webpage
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610615662.9A
Other languages
Chinese (zh)
Other versions
CN106294597A (en
Inventor
殷勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201610615662.9A priority Critical patent/CN106294597B/en
Publication of CN106294597A publication Critical patent/CN106294597A/en
Application granted granted Critical
Publication of CN106294597B publication Critical patent/CN106294597B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The object of the present invention is to provide a kind of method and apparatus that the static resource for webpage is grouped.According to the method for the present invention the following steps are included: for each webpage in website, the renewal frequency information for each static resource that the webpage includes is obtained;According to the renewal frequency information of each static resource and scheduled rule of classification, the optimal group mode for each static resource that the webpage includes is determined, to obtain corresponding resource grouping information.Compared with prior art, the invention has the following advantages that by being grouped merging to the static resource of webpage based on the renewal frequency of static resource, reduce since a small number of static resources update frequently and the case where cause one group of static resource equal cache invalidation, to save the data traffic of client device and network side equipment consumed by load static resource.

Description

The method and apparatus being grouped for the static resource to webpage
Technical field
The present invention relates to field of computer technology more particularly to a kind of sides that the static resource for webpage is grouped Method and device.
Background technique
Client device loads scripting language (javascript, js) or cascading style sheets when loading webpage Static resources such as (Cascading Style Sheets, CSS) will have a direct impact on webpage loading velocity.The wherein load meeting of CSS Block full page continues downloading and rendering, and SCRIPT can then drag the pot life of the certain functions of the slow page.
Currently existing scheme is grouped by the static resource to webpage and merges part of file, makes to limit webpage HTTP connection number, to accelerate webpage loading velocity.For example, a.css, b.css, c.css can be merged into d.css system One initiates request, and which offers a saving 2/3rds HTTP connections.Browser is after d.css is completed in downloading, second of request Substantially can directly it be read from local caching.As long as these three original file contents are constant, caching can have always Effect.
Existing includes: (1) manual conjunction for specifying public required static resource to the mode that static resource merges And strategy;(2) program collects all static resources of needs automatically, is configured to multiway tree according to adduction relationship, and according to postorder Preferential sequence carries out sequence output, merges in the way of every 30 one group.
However the mode based on the prior art, static resource that is newly-increased or removing a front will lead to grouping all It resets, causes nearly all HTTP cache invalidation.And in a grouping, a frequent file of update may cause other The waste of the caching of non-frequent updating file.
For example, the renewal frequency of d.css is more same as the sum of the renewal frequency of tri- files of a.css, b.css and c.css, and And the failure that can all cause All Files to cache is updated every time.A file is downloaded from network than from being stored in the slow of disk It deposits and reads slowly more, while also additionally consuming the bandwidth of client device and server.
Summary of the invention
The object of the present invention is to provide a kind of method and apparatus that the static resource for webpage is grouped.
According to an aspect of the invention, there is provided a kind of method that the static resource for webpage is grouped, In, it the described method comprises the following steps:
For each webpage in website, the renewal frequency information for each static resource that the webpage includes is obtained;
According to the renewal frequency information of each static resource and scheduled rule of classification, determine that the webpage includes each The optimal group mode of a static resource, to obtain corresponding resource grouping information.
According to an aspect of the present invention, a kind of resource that the static resource for webpage is grouped point is additionally provided Group device, wherein the resource apparatus for grouping includes:
For obtaining the renewal frequency information for each static resource that the webpage includes for each webpage in website Device;
For according to each static resource renewal frequency information and scheduled rule of classification, determine that the webpage includes The optimal group mode of each static resource, to obtain the device of corresponding resource grouping information.
Compared with prior art, the invention has the following advantages that by the renewal frequency based on static resource come to webpage Static resource be grouped merging, reduce due to a small number of static resources update frequently and cause one group of static resource to cache The case where failure, to save the data traffic of client device and network side equipment consumed by load static resource.And And preferred embodiment in accordance with the present invention, it may be determined that so that flow consumed by each static resource of client downloads is the smallest Optimal group mode, so that only a step reduces the flow consumption of client device and network side equipment.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, of the invention other Feature, objects and advantages will become more apparent upon:
Fig. 1 illustrates the method flow diagram that a kind of static resource for webpage according to the present invention is grouped;
Fig. 2 illustrates the resource apparatus for grouping that a kind of static resource for webpage according to the present invention is grouped Structural schematic diagram.
The same or similar appended drawing reference represents the same or similar component in attached drawing.
Specific embodiment
Present invention is further described in detail with reference to the accompanying drawing.
Fig. 1 illustrates the method flow diagram that a kind of static resource for webpage according to the present invention is grouped. It according to the method for the present invention include step S1 and step S2.
Wherein, it is realized according to the method for the present invention by the inclusion of the resource apparatus for grouping in the network equipment.
Wherein, the network equipment includes but is not limited to the service of single network server, multiple network servers composition Device group or the cloud being made of a large amount of hosts or network server for being based on cloud computing (Cloud Computing), wherein cloud computing It is one kind of distributed computing, a super virtual computer consisting of a loosely coupled set of computers.
Preferably, the resource apparatus for grouping is contained in the equipment of the static resource for storing and handling webpage, example Such as, it is contained in content distributing network (Content Distribution Network, CDN) equipment.
Wherein, the static resource includes annexable resource in webpage.For example, scripting language (js), Cascading Style Table (CSS) etc..
Preferably, the equipment for being handled to the static resource of webpage can pass through the network net with website respectively Network equipment and client device are communicated.
Wherein, the network includes but is not limited to internet, wide area network, Metropolitan Area Network (MAN), local area network, VPN network etc..
It should be noted that the network equipment and network are only for example, other are existing or are likely to occur from now on User equipment, the network equipment and network are such as applicable to the present invention, should also be included within the scope of protection of the present invention, and to draw It is incorporated herein with mode.
Referring to Fig.1, in step sl, for each webpage in website, resource apparatus for grouping obtains the webpage and includes The renewal frequency information of each static resource.
Wherein, the renewal frequency information is used to indicate the frequency that static resource is modified.
Preferably, the step S1 includes step S101 (not shown) and step S102 (not shown).
In step s101, resource apparatus for grouping collects the renewal frequency number of each static resource within a predetermined period of time According to.
Specifically, resource apparatus for grouping can record renewal time and the update for updating each static resource by self-built platform Version etc., to obtain the renewal frequency data.
Preferably, if storing static resource using softwares such as svn or git, resource apparatus for grouping can based on svn or The more new record such as renewal time that the tag function in the softwares such as git is recorded and more new version, to obtain each static resource Renewal frequency data.
Then, in step s 102, resource apparatus for grouping is based on collected renewal frequency data, calculates each static money The average renewal frequency in source, as renewal frequency information.
Preferably, resource apparatus for grouping first pre-processes the renewal frequency data being collected into, therein dry to remove Disturb data.Then, resource apparatus for grouping is based on pretreated renewal frequency data, calculates the average update of each static resource Frequency, as renewal frequency information.
Wherein, the interference data include various insignificant data, for example, the update frequency for the static resource being deleted Renewal frequency data caused by rate data or the behavior repeatedly updated in the short time etc..
First example according to the present invention, resource apparatus for grouping are contained in the static resource server as CDN, and And static resource server stores the static resource of each webpage of website site_1 using svn software.For website 10 CSS resource css_1 to css_10 that the webpage page_1 of site_1 includes, resource apparatus for grouping pass through in step s 201 The label function of svn software collect in the past in three months each respective more new record of CSS resource as renewal frequency data, and Then it is based on collected renewal frequency data in step S202, calculates the respective average renewal frequency of each CSS resource, As its renewal frequency information.
It should be noted that the above-mentioned examples are merely illustrative of the technical solutions of the present invention, rather than to limit of the invention System, it should be appreciated by those skilled in the art that the reality of any renewal frequency information for obtaining each static resource that the webpage includes Existing mode, should be included in the scope of the present invention.
It is illustrated with continued reference to Fig. 1, in step s 2, resource apparatus for grouping is according to the renewal frequency of each static resource Information and scheduled rule of classification determine the optimal group mode for each static resource that the webpage includes, corresponding to obtain Resource grouping information.
Wherein, the rule of classification includes that various can be used for dividing each static resource based on renewal frequency information The rule of group.
For example, the rule of classification in resource apparatus for grouping can indicate that the static resource for being zero by renewal frequency is divided into one group, And renewal frequency is greater than zero static resource less than threshold value f1 and is divided into one group, the static state by renewal frequency greater than threshold value f1 is divided into One group.
According to a preferred embodiment of the present invention, wherein the step S2 includes step S201 (not shown), step S202 (not shown), step S203 (not shown) and step S204 (not shown).
In step s 201, resource apparatus for grouping is according to the renewal frequency information of each static resource, according to renewal frequency Each static resource is ranked up.
Wherein, the renewal frequency information is used to indicate the modification frequency of static resource.
In step S202, resource apparatus for grouping is based on the renewal frequency information, determines all of each static resource Possible candidate's packet mode.
In step S203, resource apparatus for grouping is based on renewal frequency information and scheduled algorithm, calculates each candidate point The corresponding flow information of group mode.
Wherein, the flow information is used to indicate single client and downloads flow consumed by each static resource.
In step S204, resource apparatus for grouping is based on the flow information, selects so that each static state of client downloads The smallest candidate packet mode of flow consumed by resource is as optimal packet mode, to obtain corresponding resource grouping letter Breath.
Wherein, the resource grouping information is used to indicate quiet belonging to each static resource in the optimal packet mode State resource group.
Preferably, the resource grouping information is obtained based on following algorithm according to the method for this preferred embodiment:
Assuming that there is M static resource file, also, the M static resource is divided into S1,S2...SNTotal N group file.For S thereinnGroup, if it includes KnA file then can be used following formula to indicate M:
Wherein, M indicates static resource number, KtIndicate StFile number.
Then, an average user in period T is calculated based on following formula to consume in SnThe flow of group file:
Wherein, Dn indicates average flow rate, FmIndicate the renewal frequency of each static resource, VmIndicate each static resource Renewal frequency, T indicate the time.
Grouping strategy when customer flow minimum should meet under the conditions of 1≤Q≤N,Minimum value is obtained, then may be used Packet mode when customer flow minimum is indicated based on following formula:
Wherein, P indicates minimum flow value, is based on formula (3), can obtain S when acquiring P valuenEach member.Then may be used The corresponding packet mode of n number in the case where 1≤N≤M is obtained using method of exhaustion pentagonal number theorem, and based on following formula:
P (n)=∑I=1((-1)i-1×(p(n-i×(3×i-1)÷2)+p(n-i×(3×i+1)÷2)))(4)
Wherein, p (n) indicates total number of combinations.
Preferably, in actual application, it is contemplated that the limitation of HTTP connection number, General N take a smaller number, if N number is divided into the number of combinations of fixed k group, then the number of combinations is indicated based on following formula:
Wherein, p (n) indicates total number of combinations, pk(n)=pk-1(n-1)+pk(n-k)。
Preferably, if Q=N, and N < 5, and by VtDegenerating is constantBy variable Q, VtAfter dimension removes, it is based onCalculate P value, due to T andIt is constant, which is equal to following Formula:
Wherein, PεIndicate approximate minimum flow value.
Then, it is located at and acquires PεWhen value, the update frequency F of every static resource filenIt may be expressed as:
If any S of interactionn、SmAny a pair of of value F in two groupsmyWith Fnx, PεIt necessarily will increase, then (Fnx×Km+Fmy× Kn)-((Fnx×Kn+Fmy×Km) > 0, i.e. (Fnx–Fmy)×(Km- Kn) > 0, it is clear that (Km- Kn) sign symbol be it is certain, This means that SnAny member is fixed in group is more than or less than SmAny member in group, then obtain following formula:
Fnx>Fmy,Kn<KmOr Fnx<Fmy,Kn>Km (7)
Wherein, 1≤x≤Kn, 1≤y≤Km
N and m is replaced, then two kinds of symbols are actually of equal value.Thus conclusion is it is found that wherein maximum when each group is pressed (or minimum) member is ranked up, then the member in each group according to same rule compositor after, then global all FnBeing worth is also Sequence.Therefore solve the problems, such as that this packet-optimized is converted into F firstnValue is ranked up according to sequence from small to large, how The problem of M-1 compartment is inserted into N-1 separator.It is known to work as according to FnThe N group length that is separated into is when arranging from small to large Nonincremental, then resource apparatus for grouping calculates all possible grouping scheme by algorithm of dividing and ruling, and greatly reduces candidate grouping Quantity.
By SnAny one member F in groupnxIt is transferred to SmIn group, it is clear that PεAlso it will increase, m interacts same establishment with n.In It is to obtain:
That is:
Wherein, resource apparatus for grouping can based on above-mentioned formula (8) judge it is a kind of grouping whether there may be minimum flow values Pε, so that it is determined that optimal block form.
Continue to be illustrated foregoing First example, in step s 201, resource apparatus for grouping is according to each CSS resource Renewal frequency information is ranked up each static resource according to renewal frequency.Then, resource apparatus for grouping is in step S202 Based on the renewal frequency information, all possible candidate packet mode of each static resource is determined, and be based on above-mentioned formula (8) qualified candidate packet mode is filtered out.Then, resource apparatus for grouping is based on above-mentioned formula (6) and calculates each screening The corresponding flow information of candidate packet mode out, and select so that flow consumed by each static resource of client downloads most Small candidate packet mode obtains the corresponding resource grouping information of the optimal group mode as optimal group mode, as follows Shown in table 1:
Table 1
Static resource group The static resource for including
combol_1 Css_1, css_4
combol_2 Css_2, css_3, css_5, css_6, css_7
combol_3 Css_8, css_9, css_10
It should be noted that the above-mentioned examples are merely illustrative of the technical solutions of the present invention, rather than to limit of the invention System, it should be appreciated by those skilled in the art that any renewal frequency information according to each static resource and scheduled rule of classification, The optimal group mode for each static resource that the webpage includes is determined, to obtain the realization side of corresponding resource grouping information Formula should be included in the scope of the present invention.
It preferably, according to the method for the present invention include step S3 (not shown).
In step s3, when receiving the resource request of the static resource for downloading webpage, resource apparatus for grouping is based on Resource grouping information corresponding with the webpage merges the static resource for belonging to same grouping in the webpage.
It should be noted that the browser is corresponding to website when the browser in client device needs to access webpage Server send web access requests, which receives inquiry resource corresponding with the webpage after the web access requests Grouping information, and it is sent to browser.Then, the equipment where browser to resource apparatus for grouping is sent for downloading webpage The resource request of static resource.Then, resource apparatus for grouping is based on resource grouping information corresponding with the webpage in step s3, The static resource for belonging to same grouping in the webpage is merged.
Preferably, the method includes the steps S4 (not shown).
In step s 4, resource apparatus for grouping is based on the resource grouping information, map information is generated, thus in the mapping The corresponding static resource group of each static resource in the webpage is recorded and stored in information.
Preferably, the method includes the steps S5 (not shown).
In step s 5, resource apparatus for grouping inquires required each static resource based on the map information It is inquired, determines the store path of the static resource group where each static resource.
For example, for each static resource for belonging to static resource group group1, determine its store path " http: // Cdn.com/s/group1.css ",
According to the method for the present invention, by being grouped based on the renewal frequency of static resource to the static resource of webpage Merge, reduces since a small number of static resources update frequently and the case where cause one group of static resource equal cache invalidation, to save The data traffic of client device and network side equipment consumed by load static resource is saved.Also, it is according to the present invention excellent The method for selecting embodiment, it may be determined that so that the smallest optimal group side of flow consumed by each static resource of client downloads Formula, so that only a step reduces the flow consumption of client device and network side equipment.
Fig. 2 illustrates the resource apparatus for grouping that a kind of static resource for webpage according to the present invention is grouped Structural schematic diagram.
Resource apparatus for grouping according to the present invention includes: for for each webpage in website, obtaining the webpage to include Each static resource renewal frequency information device (hereinafter referred to as " acquisition device 1 ");For according to each static resource Renewal frequency information and scheduled rule of classification, determine the optimal group mode for each static resource that the webpage includes, To obtain the device (hereinafter referred to as " determining device 2 ") of corresponding resource grouping information.
Referring to Fig. 2, for each webpage in website, acquisition device 1 obtains each static resource that the webpage includes Renewal frequency information.
Wherein, the renewal frequency information is used to indicate the frequency that static resource is modified.
Preferably, acquisition device 1 includes for collecting the renewal frequency data of each static resource within a predetermined period of time Device (not shown, hereinafter referred to as " transacter "), and for be based on collected renewal frequency data, calculate it is each The average renewal frequency of static resource, the device (not shown, hereinafter referred to as " frequency calculation means device ") as renewal frequency information.
Transacter collects the renewal frequency data of each static resource within a predetermined period of time.
Specifically, transacter can record renewal time and the update for updating each static resource by self-built platform Version etc., to obtain the renewal frequency data.
Preferably, if storing static resource using softwares such as svn or git, transacter can based on svn or The more new record such as renewal time that the tag function in the softwares such as git is recorded and more new version, to obtain each static resource Renewal frequency data.
Then, frequency calculation means device is based on collected renewal frequency data, calculates the average update of each static resource Frequency, as renewal frequency information.
Preferably, the resource apparatus for grouping includes for pre-processing to the renewal frequency data being collected into, to go Except the device (not shown, hereinafter referred to as " pretreatment unit ") of interference data therein.
Pretreatment unit first pre-processes the renewal frequency data being collected into, to remove interference data therein.It connects , frequency calculation means device is based on pretreated renewal frequency data, the average renewal frequency of each static resource is calculated, as Renewal frequency information.
Wherein, the interference data include various insignificant data, for example, the update frequency for the static resource being deleted Renewal frequency data caused by rate data or the behavior repeatedly updated in the short time etc..
First example according to the present invention, resource apparatus for grouping are contained in the static resource server as CDN, and And static resource server stores the static resource of each webpage of website site_1 using svn software.For website 10 CSS resource css_1 to css_10 that the webpage page_1 of site_1 includes, transacter pass through the mark of svn software Signing function collection, each respective more new record of CSS resource is as renewal frequency data in three months in the past, and then frequency calculates Device is based on collected renewal frequency data, calculates the respective average renewal frequency of each CSS resource, updates frequency as it Rate information.
It should be noted that the above-mentioned examples are merely illustrative of the technical solutions of the present invention, rather than to limit of the invention System, it should be appreciated by those skilled in the art that the reality of any renewal frequency information for obtaining each static resource that the webpage includes Existing mode, should be included in the scope of the present invention.
It is illustrated with continued reference to Fig. 2, determining device 2 is according to the renewal frequency information of each static resource and scheduled point Group rule, determines the optimal group mode for each static resource that the webpage includes, to obtain corresponding resource grouping information.
Wherein, the rule of classification includes that various can be used for dividing each static resource based on renewal frequency information The rule of group.
For example, the rule of classification in resource apparatus for grouping can indicate that the static resource for being zero by renewal frequency is divided into one group, And renewal frequency is greater than zero static resource less than threshold value f1 and is divided into one group, the static state by renewal frequency greater than threshold value f1 is divided into One group.
According to a preferred embodiment of the present invention, wherein the determining device 2 includes for according to each static resource Renewal frequency information, the device that each static resource is ranked up according to renewal frequency (it is not shown, hereinafter referred to as " sequence Device "), for being based on the renewal frequency information, determine the dress of all possible candidate packet mode of each static resource Set (not shown, hereinafter referred to as " candidate determining device "), for calculating each based on the scheduled algorithm of renewal frequency information The device (not shown, hereinafter referred to as " flow computing device ") of the corresponding flow information of candidate packet mode, and for being based on institute Flow information is stated, is selected so that the smallest candidate packet mode of flow consumed by each static resource of client downloads is as most The device (not shown, hereinafter referred to as " selection device ") of excellent packet mode.
Collator carries out each static resource according to renewal frequency according to the renewal frequency information of each static resource Sequence.
Wherein, the renewal frequency information is used to indicate the modification frequency of static resource.
Then, candidate determining device is based on the renewal frequency information, determines all possible time of each static resource Select packet mode.
Then, flow computing device is based on the renewal frequency information and scheduled algorithm, calculates each candidate grouping side The corresponding flow information of formula.
Wherein, the flow information is used to indicate single client and downloads flow consumed by each static resource.
Then, selection device is based on the flow information, selects so that consumed by each static resource of client downloads The smallest candidate packet mode of flow is as optimal packet mode, to obtain corresponding resource grouping information.
Wherein, the resource grouping information is used to indicate quiet belonging to each static resource in the optimal packet mode State resource group.
Preferably, the resource grouping letter is obtained based on following algorithm according to the resource apparatus for grouping of this preferred embodiment Breath:
Assuming that there is M static resource file, also, the M static resource is divided into S1,S2...SNTotal N group file.For S thereinnGroup, if it includes KnA file then can be used following formula to indicate M:
Wherein, M indicates static resource number, KtIndicate StFile number.
Then, an average user in period T is calculated based on following formula to consume in SnThe flow of group file:
Wherein, Dn indicates average flow rate, FmIndicate the renewal frequency of each static resource, VmIndicate each static resource Renewal frequency, T indicate the time.
Grouping strategy when customer flow minimum should meet under the conditions of 1≤Q≤N,Minimum value is obtained, then may be used Packet mode when customer flow minimum is indicated based on following formula:
Wherein, P indicates minimum flow value, is based on formula (3), can obtain S when acquiring P valuenEach member.Then may be used The corresponding packet mode of n number in the case where 1≤N≤M is obtained using method of exhaustion pentagonal number theorem, and based on following formula:
P (n)=∑I=1((-1)i-1×(p(n-i×(3×i-1)÷2)+p(n-i×(3×i+1)÷2)))(4)
Wherein, p (n) indicates total number of combinations.
Preferably, in actual application, it is contemplated that the limitation of HTTP connection number, General N take a smaller number, if N number is divided into the number of combinations of fixed k group, then the number of combinations is indicated based on following formula:
Wherein, p (n) indicates total number of combinations, pk(n)=pk-1(n-1)+pk(n-k)。
Preferably, if Q=N, and N < 5, and by VtDegenerating is constantBy variable Q, VtAfter dimension removes, it is based onCalculate P value, due to T andIt is constant, which is equal to following Formula:
Wherein, PεIndicate approximate minimum flow value.
Then, it is located at and acquires PεWhen value, the update frequency F of every static resource filenIt may be expressed as:
If any S of interactionn、SmAny a pair of of value F in two groupsmyWith Fnx, PεIt necessarily will increase, then (Fnx×Km+Fmy× Kn)-((Fnx×Kn+Fmy×Km) > 0, i.e. (Fnx–Fmy)×(Km- Kn) > 0, it is clear that (Km- Kn) sign symbol be it is certain, This means that SnAny member is fixed in group is more than or less than SmAny member in group, then obtain following formula:
Fnx>Fmy,Kn<KmOr Fnx<Fmy,Kn>Km (7)
Wherein, 1≤x≤Kn, 1≤y≤Km
N and m is replaced, then two kinds of symbols are actually of equal value.Thus conclusion is it is found that wherein maximum when each group is pressed (or minimum) member is ranked up, then the member in each group according to same rule compositor after, then global all FnBeing worth is also Sequence.Therefore solve the problems, such as that this packet-optimized is converted into F firstnValue is ranked up according to sequence from small to large, how The problem of M-1 compartment is inserted into N-1 separator.It is known to work as according to FnThe N group length that is separated into is when arranging from small to large Nonincremental, then resource apparatus for grouping calculates all possible grouping scheme by algorithm of dividing and ruling, and greatly reduces candidate grouping Quantity.
By SnAny one member F in groupnxIt is transferred to SmIn group, it is clear that PεAlso it will increase, m interacts same establishment with n.In It is to obtain:
That is:
Wherein, resource apparatus for grouping can based on above-mentioned formula (8) judge it is a kind of grouping whether there may be minimum flow values Pε, so that it is determined that optimal block form.
Continue to be illustrated foregoing First example, collator according to the renewal frequency information of each CSS resource, according to Renewal frequency is ranked up each static resource.Then, candidate determining device is based on the renewal frequency information, determines each The all possible candidate packet mode of static resource, and qualified candidate grouping side is filtered out based on above-mentioned formula (8) Formula.Then, flow computing device is based on above-mentioned formula (6) and calculates the corresponding flow letter of the candidate packet mode each filtered out Breath, and selected as selection device so that the smallest candidate packet mode of flow consumed by each static resource of client downloads is made For optimal group mode, and the corresponding resource grouping information of the optimal group mode is obtained, as shown in table 1 below:
Table 1
Static resource group The static resource for including
combol_1 Css_1, css_4
combol_2 Css_2, css_3, css_5, css_6, css_7
combol_3 Css_8, css_9, css_10
It should be noted that the above-mentioned examples are merely illustrative of the technical solutions of the present invention, rather than to limit of the invention System, it should be appreciated by those skilled in the art that any renewal frequency information according to each static resource and scheduled rule of classification, The optimal group mode for each static resource that the webpage includes is determined, to obtain the realization side of corresponding resource grouping information Formula should be included in the scope of the present invention.
Preferably, resource apparatus for grouping according to the present invention includes for receiving the static resource for downloading webpage When resource request, be based on resource grouping information corresponding with the webpage, will belong in the webpage static resource of same grouping into The combined device (not shown, hereinafter referred to as " resource merging device ") of row.
When receiving the resource request of the static resource for downloading webpage, resource merges device based on corresponding with the webpage Resource grouping information, the static resource that same grouping is belonged in the webpage is merged.
It should be noted that the browser is corresponding to website when the browser in client device needs to access webpage Server send web access requests, which receives inquiry resource corresponding with the webpage after the web access requests Grouping information, and it is sent to browser.Then, the equipment where browser to resource apparatus for grouping is sent for downloading webpage The resource request of static resource.Then, resource merging device is based on resource grouping information corresponding with the webpage, will be in the webpage The static resource for belonging to same grouping merges.
Preferably, the method includes map information being generated, thus in the mapping for being based on the resource grouping information Recorded and stored in information the corresponding static resource group of each static resource in the webpage device (it is not shown, it is hereinafter referred to as " raw At device ").
Generating means are based on the resource grouping information, map information are generated, to record and deposit in the map information Store up the corresponding static resource group of each static resource in the webpage.
Preferably, the resource apparatus for grouping includes for being based on the mapping for required each static resource Information is inquired, determine the store path of the static resource group where each static resource device (it is not shown, below Referred to as " path determining device ").
Path determining device inquires, really required each static resource based on the map information The store path of static resource group where fixed each static resource.
For example, path determining device determines that it stores road for each static resource for belonging to static resource group group1 Diameter " http://cdn.com/s/group1.css ",
According to the solution of the present invention, by being grouped based on the renewal frequency of static resource to the static resource of webpage Merge, reduces since a small number of static resources update frequently and the case where cause one group of static resource equal cache invalidation, to save The data traffic of client device and network side equipment consumed by load static resource is saved.Also, it is according to the present invention excellent Select embodiment, it may be determined that so that the smallest optimal group mode of flow consumed by each static resource of client downloads, thus Only a step reduces the flow consumption of client device and network side equipment.
Software program of the invention can be executed to implement the above steps or functions by processor.Similarly, originally The software program (including relevant data structure) of invention can be stored in computer readable recording medium, for example, RAM is deposited Reservoir, magnetic or optical driver or floppy disc and similar devices.In addition, hardware can be used in fact in some steps of the invention or function It is existing, for example, as the circuit cooperated with processor thereby executing each function or step.
In addition, a part of the invention can be applied to computer program product, such as computer program instructions, when its quilt When computer executes, by the operation of the computer, it can call or provide according to the method for the present invention and/or technical solution. And the program instruction of method of the invention is called, it is possibly stored in fixed or moveable recording medium, and/or pass through Broadcast or the data flow in other signal-bearing mediums and transmitted, and/or be stored according to described program instruction operation In the working storage of computer equipment.Here, according to one embodiment of present invention including a device, which includes using Memory in storage computer program instructions and processor for executing program instructions, wherein when the computer program refers to When enabling by processor execution, method and/or skill of the device operation based on aforementioned multiple embodiments according to the present invention are triggered Art scheme.
It is obvious to a person skilled in the art that invention is not limited to the details of the above exemplary embodiments, Er Qie In the case where without departing substantially from spirit or essential attributes of the invention, the present invention can be realized in other specific forms.Therefore, no matter From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the present invention is by appended power Benefit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent elements of the claims Variation is included in the present invention.Any reference signs in the claims should not be construed as limiting the involved claims.This Outside, it is clear that one word of " comprising " does not exclude other units or steps, and odd number is not excluded for plural number.That states in system claims is multiple Unit or device can also be implemented through software or hardware by a unit or device.The first, the second equal words are used to table Show title, and does not indicate any particular order.

Claims (14)

1. a kind of method that the static resource for webpage is grouped, wherein the described method comprises the following steps:
For each webpage in website, the renewal frequency information for each static resource that the webpage includes is obtained;
According to the renewal frequency information of each static resource and scheduled rule of classification, each static state that the webpage includes is determined The optimal group mode of resource, to obtain corresponding resource grouping information, wherein so that each static resource institute of client downloads The smallest packet mode of the flow of consumption is optimal group mode.
2. according to the method described in claim 1, wherein, each webpage in website, obtaining the webpage includes The step of renewal frequency information of each static resource the following steps are included:
Collect the renewal frequency data of each static resource within a predetermined period of time;
Based on collected renewal frequency data, the average renewal frequency of each static resource is calculated, as renewal frequency information.
3. according to the method described in claim 2, wherein, the method also includes following steps:
The renewal frequency data being collected into are pre-processed, to remove interference data therein.
4. according to the method described in claim 1, wherein, the renewal frequency information according to each static resource and scheduled Rule of classification determines the optimal group mode for each static resource that the webpage includes, to obtain corresponding resource grouping letter The step of breath the following steps are included:
According to the renewal frequency information of each static resource, each static resource is ranked up according to renewal frequency;
Based on the renewal frequency information, all possible candidate packet mode of each static resource is determined;
Based on the renewal frequency information and scheduled algorithm, the corresponding flow information of each candidate packet mode is calculated, wherein The flow information includes flow consumed by each static resource of client downloads;
Based on the flow information, selection is so that the smallest candidate grouping of flow consumed by each static resource of client downloads Mode is as optimal packet mode, to obtain corresponding resource grouping information.
5. method according to claim 1 to 4, wherein the described method comprises the following steps:
When receiving the resource request of the static resource for downloading webpage, it is based on resource grouping information corresponding with the webpage, The static resource for belonging to same grouping in the webpage is merged.
6. method according to claim 1 to 4, wherein the described method comprises the following steps:
Based on the resource grouping information, map information is generated, to record and store in the map information each in the webpage The corresponding static resource group of a static resource.
7. according to the method described in claim 6, wherein, the described method comprises the following steps:
It for required each static resource, is inquired based on the map information, where determining each static resource The store path of static resource group.
8. a kind of resource apparatus for grouping that the static resource for webpage is grouped, wherein the resource apparatus for grouping packet It includes:
For obtaining the dress of the renewal frequency information for each static resource that the webpage includes for each webpage in website It sets;
For according to each static resource renewal frequency information and scheduled rule of classification, determine that the webpage includes each The optimal group mode of static resource, to obtain the device of corresponding resource grouping information, wherein so that client downloads are each The smallest packet mode of flow consumed by static resource is optimal group mode.
9. resource apparatus for grouping according to claim 8, wherein described for obtaining for each webpage in website The device of the renewal frequency information for each static resource that the webpage includes includes:
For collecting the device of the renewal frequency data of each static resource within a predetermined period of time;
For being based on collected renewal frequency data, the average renewal frequency of each static resource is calculated, as renewal frequency The device of information.
10. resource apparatus for grouping according to claim 9, wherein the resource apparatus for grouping further include:
For being pre-processed to the renewal frequency data being collected into, to remove the device of interference data therein.
11. resource apparatus for grouping according to claim 8, wherein the update frequency for according to each static resource Rate information and scheduled rule of classification determine the optimal group mode for each static resource that the webpage includes, to obtain phase The device for the resource grouping information answered includes:
For the renewal frequency information according to each static resource, the dress that each static resource is ranked up according to renewal frequency It sets;
For being based on the renewal frequency information, the device of all possible candidate packet mode of each static resource is determined;
For being based on the renewal frequency information and scheduled algorithm, the corresponding flow information of each candidate packet mode is calculated Device, wherein the flow information includes flow consumed by each static resource of client downloads;
For being based on the flow information, select so that the smallest candidate of flow consumed by each static resource of client downloads Packet mode is as optimal packet mode, to obtain the device of corresponding resource grouping information.
12. the resource apparatus for grouping according to any one of claim 8 to 11, wherein the resource apparatus for grouping includes:
When for receiving the resource request of the static resource for downloading webpage, based on resource corresponding with webpage grouping letter Breath, the device that the static resource that same grouping is belonged in the webpage is merged.
13. the resource apparatus for grouping according to any one of claim 8 to 11, wherein the resource apparatus for grouping includes:
For being based on the resource grouping information, the device of map information is generated, to record and store in the map information The corresponding static resource group of each static resource in the webpage.
14. resource apparatus for grouping according to claim 13, wherein the resource apparatus for grouping includes:
For being inquired based on the map information for required each static resource, each static resource institute is determined Static resource group store path device.
CN201610615662.9A 2016-07-28 2016-07-28 The method and apparatus being grouped for the static resource to webpage Active CN106294597B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610615662.9A CN106294597B (en) 2016-07-28 2016-07-28 The method and apparatus being grouped for the static resource to webpage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610615662.9A CN106294597B (en) 2016-07-28 2016-07-28 The method and apparatus being grouped for the static resource to webpage

Publications (2)

Publication Number Publication Date
CN106294597A CN106294597A (en) 2017-01-04
CN106294597B true CN106294597B (en) 2019-09-20

Family

ID=57663253

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610615662.9A Active CN106294597B (en) 2016-07-28 2016-07-28 The method and apparatus being grouped for the static resource to webpage

Country Status (1)

Country Link
CN (1) CN106294597B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106941530B (en) * 2017-03-27 2019-04-05 武汉斗鱼网络科技有限公司 A kind of static resource request processing method and device
CN107169000B (en) * 2017-03-31 2018-08-10 武汉斗鱼网络科技有限公司 Static resource dissemination method and device
CN111177611A (en) * 2018-11-13 2020-05-19 商派软件有限公司 Method for multiplexing cache
CN110334298A (en) * 2019-05-21 2019-10-15 深圳壹账通智能科技有限公司 Processing method, device, medium and the electronic equipment of page resource data
CN112016016A (en) * 2019-05-28 2020-12-01 中移(苏州)软件技术有限公司 Resource grouping method, server, system and readable storage medium
CN111596966A (en) * 2020-04-27 2020-08-28 五八有限公司 Sub-application loading method and device
CN112632440B (en) * 2020-12-18 2023-01-24 西安博达软件股份有限公司 Static resource generation method for teacher personal homepage based on watermark characteristic rule string

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104063401A (en) * 2013-03-22 2014-09-24 阿里巴巴集团控股有限公司 Webpage style address merging method and device
CN104899228A (en) * 2014-03-07 2015-09-09 ***通信集团河北有限公司 Method and device for publishing webpage resources
CN105512324A (en) * 2015-12-21 2016-04-20 用友网络科技股份有限公司 Front end module loader for partial renewal of package file
CN105589956A (en) * 2015-12-21 2016-05-18 东软集团股份有限公司 User portraying method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7831556B2 (en) * 2005-03-17 2010-11-09 International Business Machines Corporation Differential rendering and refreshing a portal page with a page delta
CA2742059C (en) * 2010-06-22 2019-10-29 Blaze Software Inc. Method and system for automated analysis and transformation of web pages

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104063401A (en) * 2013-03-22 2014-09-24 阿里巴巴集团控股有限公司 Webpage style address merging method and device
CN104899228A (en) * 2014-03-07 2015-09-09 ***通信集团河北有限公司 Method and device for publishing webpage resources
CN105512324A (en) * 2015-12-21 2016-04-20 用友网络科技股份有限公司 Front end module loader for partial renewal of package file
CN105589956A (en) * 2015-12-21 2016-05-18 东软集团股份有限公司 User portraying method and device

Also Published As

Publication number Publication date
CN106294597A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN106294597B (en) The method and apparatus being grouped for the static resource to webpage
US11609839B2 (en) Distributed code tracing system
US10776216B2 (en) Tiered cloud storage for different availability and performance requirements
US10572285B2 (en) Method and apparatus for elastically scaling virtual machine cluster
US10630789B2 (en) Facilitating consistent A/B testing assignment
US9363312B2 (en) Transparent header modification for reducing serving load based on current and projected usage
US8984226B2 (en) Load balancing based upon data usage
US20200382380A1 (en) Efficiency indexes
JP6262939B2 (en) Cache system using network switch and cache service providing method
US20100076933A1 (en) Techniques for resource location and migration across data centers
US9195773B2 (en) Structure-based adaptive document caching
US8332381B1 (en) Tab search utility
JP2016515228A (en) Data stream splitting for low latency data access
WO2017092582A1 (en) Data processing method and apparatus
CN105183873A (en) Malicious clicking behavior detection method and device
US20200065195A1 (en) Space management for snapshots of execution images
Canali et al. Scalable and automatic virtual machines placement based on behavioral similarities
JP2019164705A (en) Information processing device
US20200265011A1 (en) Automated content-based and context-based file organizational structuring
CN105069074A (en) Strategy configuration file processing method, device and system
CN108337100B (en) Cloud platform monitoring method and device
JP2011070257A (en) File retrieval system
US20120117329A1 (en) Combination based lru caching
CN115809119A (en) Monitoring method, system and device for container arrangement engine
CN112861031B (en) URL refreshing method, device and equipment in CDN and CDN node

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant