CAROFIGLIO, Giovanna (49 avenue Sully Prudhomme, Châtenay-Malabry, F-92290, FR)
PERINO, Diego (2 villa Haussmann, Issy-les-Moulineaux, F-92130, FR)
CAROFIGLIO, Giovanna (49 avenue Sully Prudhomme, Châtenay-Malabry, F-92290, FR)
| CLAIMS 1. A method of using memory in a cache for a plurality different classes of content including: assigning respective weights to respective classes of content; guaranteeing a respective minimum amount of memory for each class of content to store valid data, the guaranteed minimum amount for each class being proportional to the given weight for that class; and, when the guaranteed minimum amount for a first class is not fully occupied by data in that class, one or more of the other classes temporarily re-using spare memory capacity of the guaranteed minimum amount for the first class; and including removing content for classes that have exceeded their capacity using class weights to determine the class of content to be removed. 2. The method as claimed in claim 1 and including allocating spare memory capacity according to class weights. 3. The method as claimed in claim 2 and including allocating memory fj to a class it N\D from spare memory capacity F according to the relation y D 4. The method as claimed in claim 1, 2 or 3 wherein the content to be removed is determined using the relation Rk (uk) =— and selecting content to be removed from a class having a maximum value of R. 5. The method as claimed in any preceding claim and wherein the spare memory capacity is uniformly distributed across classes requiring additional capacity. 6. The method as claimed in claim 5 and including removing content for classes that have exceeded their capacity using the relation ses Λ(Μ, ) = w, otherwise and selecting content to be removed from a class having a maximum value of R. 7. The method as claimed in any preceding claim and wherein the spare memory capacity distributed across classes requiring additional capacity according to priority criteria. 8. The method as claimed in any preceding claim and the spare memory capacity distributed across classes requiring additional capacity on a first in, first out basis. 9. Apparatus operative to carry out a method of using memory in a cache for a plurality different classes of content in which the method includes: assigning respective weights to respective classes of content; guaranteeing a respective minimum amount of memory for each class of content to store valid data, the guaranteed minimum amount for each class being proportional to the given weight for that class; and, when the guaranteed minimum amount for a first class is not fully occupied by data in that class, one or more of the other classes temporarily re-using spare memory capacity of the guaranteed minimum amount for the first class; and including removing content for classes that have exceeded their capacity using class weights to determine the class of content to be removed. 10. A data storage medium storing a machine-executable program for performing a method for using memory in a cache for a plurality different classes of content including: guaranteeing a respective minimum amount of memory for each class of content to store valid data, the guaranteed minimum amount for each class being proportional to a given weight for that class. |
FIELD OF THE INVENTION
The present invention relates to a method and apparatus for allocating memory in a cache, and more particularly for allocating memory for a plurality of different classes of content
BACKGROUND OF THE INVENTION
A network cache is a component that transparently stores data to serve future content requests. Data stored within the cache is a copy of an original element that is stored elsewhere. If a client or user generates a request for an element stored in the cache, that request is served by reading the cache without contacting the original data source. Thus caching may improve performance, for example, by enabling a faster response time, requiring less bandwidth and the like. If the requested data is not stored in the cache, the request is routed towards the original source or redirected to other caches.
Each cache has a limited storage capacity which is managed by a cache replacement strategy. The strategy is used to select which data should be removed from the cache when new data must be stored. Also, data stored in a cache is valid only for a limited period of time after which it becomes obsolete. For instance, a copy of given webpage is not valid once it has been updated at the original server. Such obsolete data is the first to be removed from a cache to make room for new elements. Cache coherence is concerned with ensuring that up to date copies of the original content are stored in the relevant cache or caches.
Several cache replacement and coherence mechanisms have been proposed to manage caches, for example, to manage web page content, by adding and removing an entire web object.
BRIEF SUMMARY
According to a first aspect of the invention, a method of using memory in a cache for a plurality different classes of content includes assigning respective weights to respective classes of content and guaranteeing a respective minimum amount of memory for each class of content to store valid data. The guaranteed minimum amount for each class is proportional to the given weight for that class. When the guaranteed minimum amount for a first class is not fully occupied by data in that class, one or more of the other classes temporarily re-use spare memory capacity of the guaranteed minimum amount for the first class. Content for classes that have exceeded their capacity is removed using class weights to determine the class of content to be removed.
Weights are assigned to classes and the method guarantees that every class can exploit a minimum amount of memory, proportional to the weights. The eviction policy determines from which class to remove data and how 'extra' memory is shared among classes using different criteria.
The invention may be applied to networks with caching capabilities such as Content Centric Networks, Redundancy Elimination services, and the like.
Performance of applications that generate content may be strongly impacted by the amount of memory space devoted at every node to their classes.
In one embodiment, a diversity of web objects, for example, may be handled appropriately for each class. Web objects include, but are not limited to, web pages, multimedia streams and images, for example.
The method may be used to guarantee a minimum amount of memory to each class of content to store valid, that is, non-obsolete, data while providing a flexible and efficient use of the whole memory space. The method may be applied at object granularity and/or packet granularity levels.
In one embodiment, when the guaranteed minimum amount for one class is not fully occupied by data in that class, spare memory capacity of the guaranteed minimum amount is temporarily re-allocated to one or more of the other classes. Thus, if some classes do not completely exploit their devoted memory space because they do not have enough valid data, in this embodiment, other classes may temporarily use the spare capacity. In one embodiment, spare memory capacity is used according to class weights In another embodiment, spare capacity is uniformly allocated.
According to a second aspect of the invention, there is provided apparatus operative to implement a method in accordance with the first aspect.
According to a third aspect of the invention, there is provided a data storage medium storing a machine-executable program for performing a method in accordance with the first aspect.
BRIEF DESCRIPTION OF THE DRAWINGS
Some embodiments of the present invention will now be described by way of example only, and with reference to the accompanying drawings, in which:
Figure 1 is a schematic flowchart of a method in accordance with the invention;
Figure 2 schematically illustrates an apparatus in accordance with the invention.
DETAILED DESCRIPTION
In one embodiment of the invention, content to be stored in a cache may be denoted as being included in a particular class.
Consider a cache of size C and a set of content classes N. A weight w t is associated with every class i eN. The minimum amount of memory guaranteed to class i is denoted as Cj* and is given by: equation (1)
∑ w
The amount of memory used by class / ' to store valid data is denoted as «, , and D is the set of classes for which c * - u t > 0. This set D contains classes that do not have enough valid data to completely fill their guaranteed minimum amounts of memory, valid data being non-obsolete data. The total amount of guaranteed minimum memory space that is unused by these classes in set D is denoted as F and is given by:
F = Y c„' - u — equation (2)
This additional memory space F is thus available for use by classes N\D that are not included in set D.
Different strategies may be used for sharing the additional memory space F among classes N\D. In one mechanism, the additional memory space F is uniformly
F
distributed among demanding classes, that is, f t = -. . In another mechanism, additional memory space F is assigned according to priority criteria. In another mechanism, a FIFO (first in, first out) approach is used.
In one strategy, the additional space F is shared according to class weights. By sharing according to class weightings, proportional memory assignment among classes may be maintained. Using a weighting approach, a class ie N\D receives a minimum amount of additional space as given by the following expression:
fi ~ F — equation (3)
R(iij) is a function which is used to quantify the excess of each class i . Data is removed from memory allocated to a class k for which R k is greatest compared to that for other classes. The flowchart of Figure 1 illustrates the mechanism applied when new content is received. If more than one class has the same maximum value for R, a choice is made at random as to which of these classes to select for data removal. Data is removed only from those classes that have exceeded their capacity c*. For function R , R(u t ) < R(Uj ) Vi e D Vj e N \ D . The strategy used to share the additional memory space among classes is related to the particular mechanism used to remove data from the cache. For example, where there is a strategy of uniform allocation of additional memory space, M = 0 if l≤ c for all classes
[R( j ) = M, otherwise
In contrast, and as now described in more detail, where the strategy is such that the additional space F is shared according to class weights and there is proportional allocation of additional memory space F, R k (Mk) =—
For this strategy, consider a cache storing three classes of content, N= {Class 1, Class 2, Class 3}, with weights Wi=2 W 2 =l W 3 =2. It is further assumed that the cache size is equal to C= 10 units and that there is proportional allocation of additional memory F.
According to equation (1): ci*=4 units, c 2 *=2 units, c 3 *=4 units.
Consider the following cache initial condition:
In such scenario ui=4, u 2 =2, u 3 =4, Ri=2, R 2 =2, R 3 =2.
The following sets out an illustrative exemplary sequence of events following the starting conditions shown in the table above. a) Arrival of one unit of Class 1.
1. U ! =5, u 2 =2, u 3 =4, R^.5, R 2 =2, R 3 =2.
2. A unit of class 1 is removed according to Class 1 replacement policy.
3. ui=4, U2=2, u 3 =4, Ri=2, R 2 =2, R 3 =2.
b) Class 3 coherence mechanism declares 3 units of Class 3 data as obsolete.
1. Obsolete units of Class 3 are removed from the cache.
2. U ! =4, u 2 =2, u 3 =l , Ri=2, R 2 =2, R 3 =0.5.
c) Arrival of one unit of Class 2.
1. ui=4, u 2 =3, u 3 =l, R,=2, R 2 =3, R 3 =0.5.
d) Arrival of one unit of Class 2. 1. ui=4, u 2 =4, u 3 =l , R ! =2, R 2 =4, R 3 =0.5.
e) Arrival of one unit of Class 2.
1. U]=4, u 2 =5, u 3 =l , Ri=2, R 2
f) Arrival of one unit of Class 1.
1. Ui=5, u 2 =5, u 3 =l, Ri=2.5, R 2 =5, R 3 =0.5.
2. A unit of Class 2 is removed according to Class 2 replacement policy.
3. U ! =5, u 2 =4, u 3 =l, R ! =2.5, R 2 =4, R 3 =0.5.
g) Arrival of one unit of Class 1.
1. ui=6, u 2 =4, u 3 =l, Ri=3, R 2 =4, R 3 =0.5.
2. A unit of Class 2 is removed according to Class 2 replacement policy.
3. U]=6, u 2 =3, u 3 =l, Ri=3, R 2 =3, R 3 =0.5. Class # of unit
1 6
2 3
3 1 h) Arrival of one unit of Class 1.
1. U ! =7, u 2 =3, u 3 =l, Ri=3.5, R 2 =3, R 3 =0.5.
2. A unit of Class 1 is removed according to Class 1 replacement policy.
3. u 1 =6, u 2 =3, u 3 =l, R 1 =3, R 2 =3, R 3 =0.5.
i) Arrival of one unit of Class 3.
1. U ! =6, u 2 =3, u 3 =2, R]=3, R 2 =3, R 3 =l .
2. A unit of Class 1 is removed according to Class 1 replacement policy (tii broken at random).
3. ui=5, u 2 =3, u 3 =2, R ! =2.5, R 2 =3, R 3 =l.
A replacement and coherence mechanism may also be applied per every class. With reference to Figure 2, an apparatus for allocating memory in a cache includes a classifier 1 which receives a packet from 2 and assigns a class i depending on the characteristics of the received packet. The packet is sent to the cache memory 3 to be stored. If there is insufficient memory for the new packet, a packet from class k is removed.
The processor 4, indicated by the broken line, has a cache statistics store 5 which holds information including the cache occupancy, u for all classes and R for all classes. The classes, weights and R function to be applied by the processor 4 are obtained from controller 6 and used at 7 in conjunction with information from classifier 1 to update u and R for class i. The updated values are held in store 5 and also applied to a sorter 8 to enable the classes to be sorted according to their R values. This sort information is then used by selector 9 to select the class k with the highest R value and the result sent to the cache memory 3. Values of u and R for class k are updated at 10.
The present invention may be embodied in other specific forms without departing from its spirit or essential characteristics. The described embodiments are to be considered in all respects only as illustrative and not restrictive. The scope of the invention is, therefore, indicated by the appended claims rather than by the foregoing description. All changes that come within the meaning and range of equivalency of the claims are to be embraced within their scope.
Next Patent: FRAUD PREVENTION TRADING AND PAYMENT SYSTEM FOR BUSINESS AND CONSUMER
