Research Article

Automatic Scaling Mechanism of Intermodal EDI System under Green Cloud Computing

Algorithm 3

XDRF algorithm.
Algorithm name: XDRFforPOD
/The number of nodes is n, and the resource dimension is m/
Input: R = < = < to >, …,  = < to >, …,  = < to >>: total resource collection; collection<POP>: POD optimization scheme collection;
Output: none
Define variable z = collection<POP>.size: the number of PODs to be calculated; Define variable : the set of allocated resources, represents the number of resources of type j that has been allocated by POD(i) on node k; Define variable : unallocated resource set, represents the number of resources of type j on node k that can be allocated; Define variable : The weight set of POD to be optimized;
 for (i from 1 to z) {
  Calculate the weight of the POD in the collection<POP> according to formula (10) and fill the collection W;
}
 for (k from 1 to n) {
  Calculate the cluster nodes according to formula (10) and arrange them in ascending order;
 }
 do {
  for (i from 1 to z) {
  For R and Ru sets, calculate the dominant share Si of POD(i) according to formulas (11) and (12), and update the collection<POP> collection, sorted by Si in ascending order;
 }
 //Get the POD with the smallest dominant share (i)
 picking POP(i), the first element of collection<POP>;
 POD(i) = POP(i).POD;
 //Get POD(i) resource requirements such as CPU and memory
 calculate resource demand of POD(i) as Di;
 Calculate the resource Predicates set Npre(i) of POD(i) according to formula (14);
 if () {
  According to formulas (13) or (14), a copy resource r is allocated to POD(i), where r = = Di;
  //Load and run the copy instance
  let replication as result of loading and running POD(i).replicationConfig with r;
  //Register the copy, monitor the data queue and participate in data processing services
  register this replication as consumer to kafka with POP(i).topic;
  //Update resource usage
  ; ;
  //Refresh the dominant share of POD(i) according to formulas (12) and (13)
  refresh dominant share for POD(i);
  if (POP(i).dPR-- == 0) {
   //The POD has been expanded and deleted from collection<POP>, and no longer enters //the subsequent allocation process
   POD(i) scaling-up done;
  }}
 //The cluster node resources are exhausted, record the POD information that has not been
 //allocated and exit DRF
 else {
  get unsatisfied POPs as collection<UPOP> from collection<POP>;
  report collection<UPOP> to CAdvisor;
  terminate XDRF;
 }
 / When collection<POP> is empty, all POD allocation is completed
 If (allocation done for all pod in collection<POP>) {
  report to XTuning allocation done with R and collection<POP>;
  terminate XDRF;
 }} while (true)