7 Research and Implementation of Parallel Cache Model Through Grid Memory

With the rapid development of the information techniques and the Internet popular applications, the demand for the high performance processing devices is becoming more and more vehement, such as the server construction of HDTV or IPTV for large scale VOD, and the parallel file system of grid computing. These applications need the ability to process the concurrent peak access. The parallel file system (J.Carretero, F. Perez, P. de Miguel& L.Alonso, 1996; P.F. Corbett & D. G, 1996; Craig S. Freedman, Josef Burger, & David J, 1996; Seogyun Kim, Jiseung Nam & Soon-ja Yeom, 2002) has become the very important research areas, and the parallel cache (Horst Eidenberger, 2005; J. Fernandez,J. Carretero, F. GarciaCarballeira, A. Calderon & J. M. Perez-Menor, 2005; T. Kimbrel et. AI,1996; Pal Halvorsen, Carsten Griwodz, Vera Goebel, Ketil Lund, Thomas Plagemann & Jonathan Walpole,2006) is playing the key roles in these applications. At the same time, the numbers of the Intranet composed of computer clusters are quickly increasing, and a great deal of cheap personal computers are distributed everywhere, but the utilization of their resources is very low(E. P. Markatos & G. Dramitions,1996; Anurag Acharya & Sanjeev Setia,1998). Through mining and adopting these idle resources, we can get a lot of large-scale high performance computation, storage and communication resources which are not special. How to use these idle memories to construct the parallel cache for supporting the large scale applications, such as VOD for hot segments, is very interesting. It not only improves their performance, but also increases the utilization of these idle resources. However, the heterogeneous, dynamic and unstable characteristic of these resources brings a huge obstacle for us. The grid (I. Foster & C. Kesselman, 1999) techniques and multi-agents (E. Osawa, 1993; Wooldridge, M, 2002) become the main approaches to effectively use these resources, and the multi-agents have already become the feasible solutions for grid applications. There are many successful examples (O.F. Rana & D.W. Walker, 2000; J.O. kephart & Chess, D.M, 2003) of applications which are in conjunction with the automatic multi-agents system. But, the research of construction cache model for hot segment through grid idle memory is still not much. At the same time, the high performance cluster techniques (Rajkumar Buyya, 1999) are already mature and can be the foundation for supporting the parallel cache based on grid memory.

This book chapter introduced a Parallel Cache Model Based on Grid Memory (PCMGM) in the dynamic network environment (DNE).Through building an open grid environment, using the idle memory resources of DNE, adopting the multi-agents, the fuzzy theory and the self-learning methods, we designed the PCMGM model that can support the concurrent peak access for the hot segments in large scale internet applications, such as the large scale VOD system.The experimental results show that PCMGM can improve response time of the large scale application system for hot segments.It can be fit for the grid computing and the large scale VOD system in internet.

Architecture of PCMGM
PCMGM includes two parts: one is DNE that is the physical computing devices for the parallel cache, and DNE is composed of computer clusters connected through LAN and Intranet, and all the cache computers are not special, the other is the agent system, and we call it GMG (Global Management Group).GMG is composed of a management agent system (MAS), the application agent (AA), and a lots of cache agents (CA).The architecture is presented in figure1, and the definitions of NA, CA, CN, GA, SA are described as the definition 1 ~7 and the section 3.

DNE
Definition.1.Cache node (CN) is a computer and it is defined as CN (id, AS, RSV, st), where id is the identifier of CN; AS is the set of agents running on CN; RSV(r cpu , r mem , r disk , r net ) denotes its resource support vector, r cpu is the power of its CPU, r mem is the power of its memory storage, r disk is the power of its hard-disk , and r net is the power of its network adapter; st  {"Local", "Idle", "Caching"} is its states, "Local" denotes that this computer is working for local tasks, "Idle" denotes that this computer is not working , and "Caching" denotes that this computer is working for Grid in the form of cache.So, the dynamic network environment (DNE) can be defined as DNE (Master, CCS, SVS, N, R), where Master is the main computer of DNE; CSS is the set of all computer clusters in DNE; SVS is the set of file servers to storage the files; N is its network set; R is the connection rules.All the free memories of the idle cache nodes in DNE are called the grid memory.

GMG
Definition. 4. Basic memory unit (BMU) is the uniform size of basic memory block as the allotting unit in PCMGM, and its unit is MB.
Definition. 5. Grid memory capacity (Gmc) is the total numbers of BMU provided by all cache nodes in DNE.The Gmc value is dynamic changed.

Management Agents System (MAS)
The main functions of MAS are the computation resource management, the DNE monitoring and the task scheduler.MAS include four parts: The first part is the global control agent (GA) for managing PCMGM.The second part is the agent for managing one file server, and it is called as the server agent (SA).The third part is the agents for managing the cache nodes, and they are called as the node agents (NA), and each cache node has a NA.The last part is the application agent (AA) that is the connection manager between the users and PCMGM.The MAS structure is presented in figure 1.The main functions of NA are as follows: (1) Control the cache node to join or disjoin the DNE in dynamic; (2) Calculate the idle resources, and report them to GA; (3) Monitor the states and events in CN, and make the response adjustments; (4) Control the cache agents (CA) to complete the file access task.

Cache file and cache agent
The large file is always divided into a series of segments (SEG) in the file server and the access frequency of each segment is different, so the high access frequency segment is called as the hot segment.If the hot segment is duplicated into the grid memory, the access efficiency will be improved greatly.For describing this mechanism, we introduce some conceptions.
Definition.6.Duplication Segment (DSEG) is the SEG (definition 5) duplication stored in Grid memory, and it can be defined as DSEG (SEG-id, CA, CN, ST), where SEG-id is the identifier of its SEG; CA is the cache agent for managing and accessing the DSEG; CN is the cache node on which the DSEG is stored.ST∈ {"Memory", "Disk"} is its states, and "Memory" denotes that the DSEG is in the memory of cache node, and "Disk" denotes that the DSEG is in the local disk of cache node.In the follow, we will give the detail definition about SEG.
Definition.7.Segment (SEG) is the file basic unit and it can be defined as SEG (SEG-id, File, DSEGS, LOC), where SEG-id is the identifier of SEG; File is the file that includes this SEG; DSEGS = {DSEG1, DSEG2 … DSEGd} is the set of all its active DSEGs; LOC is its server address.|SEG | is the numbers of DSEGS elements and it is called the duplication width of the SEG.
So, the file in PCMGM can be presented as a SEG sequence {SEG1, SEG2 … SEGf}, and the length of all SEGs is a constant Segl, and it is called the segment length, and its measure unit is BMU.Each file has its private segment length by its characteristic.The SEG duplication stored in Grid memory is called as duplication segment (DSEG).We call this structure file as the cache file.
Definition.8.Cache agent (CA) is defined as CA (id, DSEG, RDV, PRG, BDI, KS, CE), where id is the identifier of CA; DSEG is the duplication segment which is managed by CA; RDV (d cpu , d disk , d net ) is the resource demand vector of CA and it is the need rate for CPU, DISK and NET ; PRG is the executable program set of CA; BDI is the description of its BDI; KS is its knowledge set; CE is its configuration environment.
CA is the basic element to manage DSEG, and a CA can serve for a group of users; the relations between CA, SEG, DSEG, and cache file is presented in figure 2. Defination.9.Cache node ability (CNA) is defined as CNA (CN-id, Ma, Ca), where CN-id is the identifier of CN; Ma is the memory storage ability for storing DSEG in its memory and

Construction of logical cluster
When GA received the information from all cache nodes in DNE, the logical computer cluster will be constructed for Parallel Cache Model.Here PCS={ CN i (id i , CT i , AS i , RSV i , st i )| 1≤i≤n } is the set of all cache nodes in DNE.Actually, as different cache node may provide different resources, we must classify the cache nodes to different power logical computer clusters according to their power.Therefore, the principle of classification is based on their power of CPU, Memory, Disk, and Net adapter.In order to solve this problem, we should firstly discrete the power data, and fuzzy relation theory is employed to represent the data.

Resource matrix
Suppose that MR= (r ij ) (1≤i≤n, 1≤j≤4) is the resource matrix in DNE.F i denotes as CPU frequency of CN i , here it is measured in MHZ; M i denotes as memory capacity of CN i , and it is measured in MB; R i indicates Disk speed of CN i , and it is measured in RPM; N i indicates communication power of CN i , and it is measured in MBS; The resource matrix elements are determined by the real ability of cache nodes, and the calculation method is as follows:

Partition for logical computer cluster
It is very important to divide different logical computer clusters, then the LCC division algorithm as follows: Algorithm 3.1 Partition method for LCC.
1. MR= (r ij ) (1≤i≤n, 1≤j≤4) is the resource matrix in DNE, where n is the numbers of all cache nodes; T is a parallel cache mode task.2. Construct the fuzzy matrix FM= (f ij ) (1≤i≤n, 1≤j≤n), where f ii =1 ,when i≠j, and 0<  <1, and x 1 + 3. build the fuzzy equivalence matrix; Repeat do FT=FM ⊙ FM; //⊙ is the operation theorem to take the maximum and minimum If FT=FM then goto (4); FM=FT; End do; 4. Calculate the c-cut matrix FM c ; 5. Divide the cache nodes of PCS into several equivalence class LCC 1 ∪LCC 2 ∪…LCC e by FM c ; 6. Choose a LCC for T according to its resource demand vector by algorithm3.2.

Choose LCC for parallel cache mode task
Suppose that LCCS = LCC 1 ∪LCC 2 ∪…∪LCC e is the set of all logical computer clusters which are built through algorithm3.1, and T is a parallel cache mode task.Algorithm 3.2.Choose LCC method for parallel cache mode task.
1. Get the resource demand vector RDV (w1,w2,w3,w4)  1. Basic rule (br) is defined as br (id, rul, MRS), where id is its identifier; rul is the description of br; MRS is the meta-rules set for revising br; The basic rule set (BRS) is the set of all basic rules that GMG includes; 2. Dynamic rule (dr) is defined as dr (ct, nt, br, rul, w, sta, life), where ct CTS, nt  NTS, br BRS; rul is the formalization description of dr; w is the its weight value; and sta is its state, and sta {"Naive", "Trainable", "Stable"}; "Naive" denotes that the dr is a new rule; "Trainable" denotes that the dr is revising rule; "Stable" denotes that the dr is a mature rule; life is the its life value; 3.If dr is a dynamic rule and dr.w>MaxWeight, which MaxWeight is a constant in GMG, we call dr as the static rule (sr), its state is "Static"; 4. If dr is a dynamic rule and dr.w<MinWeight, which MinWeight is a constant in GMG, we call dr as castoff rule (cr).Its state is "Castoff".
The state graph of rules is presented in figure 3.

Fig. 3. The state graph of rules
The dynamic knowledge is the set of all the dynamic rules in GMG.The static knowledge is the set of all static rules.The basic knowledge can be earned by passive learning.To adapt the variety of cache resources, the dynamic rules must be generated at the start of the cache and revised during the caching process.Therefore, reinforcement learning can be adopted in the revising mechanism.Resources utilization for cache is very important reinforcement factors.
Suppose that Y 1 is the castoff threshold, and Y 2 is the mature threshold; Q (urt) denotes as the reinforcement function, and Q(urt) >0.urt indicates resources utilization rate; MaxWeight is the maximum of the rule weight, and MinWeight is the minimum of the rule weight, and let MinWeight<Y 1 <Y 2 < MaxWeight; MaxLife be the maximum of life value.The revising process is as follows: 1. Suppose that a cache agent CA adopted a dynamic rule dr of CA.

Cache allocation methods
For designing the allocation methods, we introduce some parameters firstly.

Parameters
Suppose that there are p cache nodes CN Hot segment threshold is a constant H in PCMGM, and if the duplication width of a segment is more than H, we call it as the hot segment.The file which includes the hot segment is called as the hot file.

Construction for cache demand matrix
According to the parameters described in Section 5.1, we can construct the cache demand matrix, which is the total cache needing of all cache files, and as followings: 1.For CFi ( 1≤i≤m ) do {Calculate the duplication width vector www.intechopen.comDWVi (|SEGi1|,|SEGi2| … |SEGiw|) for CFi by Segli , where iw is the numbers of the segment of CFi, and |SEGij| is the duplication width of j th segment of CFi}; 2. Look for the cache file which has the maximal segment number in all cache files, and the maximal segment number is k; 3. Through the vector set DWV1, DWV2 … DWVm and k, we construct the cache demand matrix: CDM= (qij) (1≤i≤m, 1≤j≤k), Where qij is the duplication width of the jth segment of CFi, and qij ≥0; If the jth segment of CFi is not existed, then qij=0.
In CDM, the sum value Tcd= 1im , 1jk ij q    is the total cache demand of all cache files, and we hope the formula (1) is true.In fact, it is not possible.

Tcd≤Tc
(1) When Tcd≥Tc, we can processes the CDM by the techniques of cut-matrix and compress in order to make the formula (1) is true.

Cut-matrix and compress technique
The cut-matrix is a special m×k matrix CM=(cq ij ) (1≤i≤m, 1≤j≤k), where cq ij =Cut-v and Cut-v is a integer.The process is presented as follows: The NCDM is the new cache demand matrix and all its DSEGs can be cached in grid memory.The demand of CDM-NCDM will be save the disk.The cut-matrix is presented in the figure 4.
According to the CA conception, the corresponding relation between a CA and a DSEG is one to one.But if a set of duplications of the same segment of be stored in the same cache node, the duplication will be stored one time in the cache node.The corresponding cache agent is established many times in the cache node, so this mechanism can improve the use rate of memory resources, but the computing ability of the cache node may be overload.The average ratio of the CA numbers and the DSEG numbers is called as the cache agent density (CAD).The compress principle is presented in the figure 4.
The DSEGs in CDM-NCDM will be written into the local disk of cache node.

Dynamic adjusting mechanism for cache node
Because of the unstable of the cache node, the cache node can be joined or disjoined in dynamic.So the grid memory is changed in PCMGM.The dynamic adjusting mechanism for cache node must be discussed.We call the cache node which can't work for grid as the failure cache node and the new joined computer as the new cache node.Definition.11.Migration storage matrix is defined as MSM= (mq ij ) (1≤i≤m, 1≤j≤k), where mq ij is DSEG numbers of the j th segment of CF i , which DSEGs are stored in the failure (or overload ) cache node , and the DSEGs of MSM will be migrated.

Failure process
The failure process description is as follows: 1. Calculate the DSEGs which the current failure cache nodes include, and Construct the failure migration storage matrix MSM; 2. Look for the low-density cache node by CDV, and get the free cache resources for MSM; Calculate the acceptable cache matrix AMSM by these resources, and AMSM will be migrated the new cache node; MSM -AMSM will be added into the failure storage matrix FSM and FSM will be stored into the local disk which they are.3. Revise the computing density vector CDV;

Joining process of new cache node
The new cache joining process description is as follows: 1. Calculate the ability of new cache nodes; 2. If the failure storage matrix is existed, we construct the migration storage matrix MSM by FSM; 3. Look for the high-density cache node by CDV, and add their DSEGs information into MSM; 4. MSM will be migrated into the new cache nodes; 5. Revise the computing density vector CDV; 6(b), and the results show that the key influence factor about PCMGM performance is the capacity of Grid memory.So, mining large scale idle computer to construct the grid memory can improve the concurrent access response time for the hot segments during the peak access.

Conclusions
For supporting the concurrent access for the hot segments of large files during the peak access phase in Internet, a parallel cache model based on the grid memory (PCMGM) was proposed in this paper.The concurrent accessing of hot segments depends on the disk performance greatly during the peak access.Through the grid technique, we can mine a lot of idle computers to construct the grid memory in order to store the duplications of hot segments.Because of the heterogeneous resources and the unstable catachrestic, the effective cache model is very difficult in the dynamic network environment.Through the techniques of CA, DSEG, the dynamic learning and the logical computer cluster partition based on fuzzy theory, PCMGM can support the parallel cache.These approaches can raise the peak access performance for hot segment of large files.It can fit for the grid computing and the large scale VOD in internet.

Fig. 2 .
Fig. 2. The relations between CA, DSEG, SEG and the cache file

Fig. 4 .
Fig. 4. The relations between CDM, Cut-matrix, and NCDM Strategy 1. d-density allocation strategy means that the allocation ratio between the numbers of CA and the numbers of their DSEG for one segment in the same cache node is d.Namely, one DSEG has d CAs in the same cache node.d is the average in PCMGM.

Fig. 5 .
Fig.5.This is the compress storage in a cach node for the same duplication and it is the 3density allocation strategy.In order to use the storage of grid memory effectively, we hope CDM=NCDM.Through the d-density allocation strategy, we can make the formula (2) is true, where Tcd(NCDM) means that the total cache demand of NCDM.Tcd(NCDM)<Tc  d(2) 1ip Fig. 6.The test results Computer cluster (CC) is defined as CC (Master, CS), where Master is the main computer of CC; CS= {CN1, CN2 … CNp} is the set of all cache nodes in computer cluster.Logical computer cluster (LCC) is defined as LCC (id, LCS, B, CC), where id denotes the identifier of LCC; LCS is the set of cache nodes of LCC; CC is the computer cluster which comprises LCC.Network bandwidth of LCC denotes as B. www.intechopen.comDefinition.2.
1 , CN 2 … CN p , and their memory storage ability are Ma 1 , Ma 2 … Ma p , their computing ability are Ca 1 , Ca 2 … Ca p ; so, the total memory storage ability is Gmc= Definition.8.Computing density vector is defined as CDV= (cd 1 , cd 2 … cd p ), where cd i is the value of density allocation strategy of CN i .If cd i <d, we call CN i as the low-density cache node; If cd i >d, we call CN i as the high-density cache node; Definition.9.Failure storage matrix is defined as FSM= (fq ij ) (1≤i≤m, 1≤j≤k), where fq ij is DSEG numbers of the j th segment of CF i , which DSEGs are stored in the failure cache node.