示例#1
0
  /**
   * Calculate and store the initial/static alpha of the coflow (in bytes)
   *
   * @param numRacks number of racks in the trace
   * @param deadlineMult deadline duration multiplier
   */
  private void calcAlphaDeadline(int numRacks, double deadlineMult) {
    // Calculate Alpha
    double[] sendBytes = new double[numRacks];
    Arrays.fill(sendBytes, 0.0);
    double[] recvBytes = new double[numRacks];
    Arrays.fill(recvBytes, 0.0);

    double perMapperBytes = totalShuffleBytes / numMappers;

    for (Task t : tasks) {
      if (t.taskType == TaskType.MAPPER) {
        MapTask mt = (MapTask) t;
        sendBytes[mt.taskID] += perMapperBytes;
      }

      if (t.taskType == TaskType.REDUCER) {
        ReduceTask rt = (ReduceTask) t;
        recvBytes[rt.taskID] += rt.shuffleBytes;
      }
    }

    alpha = Math.max(Utils.max(sendBytes), Utils.max(recvBytes));

    // Calculate deadline in millis
    deadlineDuration = alpha / Constants.RACK_BYTES_PER_SEC * deadlineMult * 1000;

    try {
      writeDebugDataToFile();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
示例#2
0
 /**
  * Determine the remaining size of the coflow.
  *
  * @return the number of bytes remaining of this coflow.
  */
 public double calcShuffleBytesLeft() {
   return Utils.sum(shuffleBytesPerRack);
 }