Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FSDataNodeReadProfilingData


        LOG.info(i + ".blockreader_verifyCheckSumTime: " + (double)cliData.getVerifyChunkCheckSumTime() / readTime);
       
        List<FSDataNodeReadProfilingData> dnDataList = cliData.getDataNodeReadProfilingDataList();
       
        for (int j = 0; j < dnDataList.size(); j++) {
          FSDataNodeReadProfilingData dnData = dnDataList.get(j);
          LOG.info(i + "-" + j + ".dn_readChunkDataTime: " + (double)dnData.getReadChunkDataTime() / readTime);
          LOG.info(i + "-" + j + ".dn_readChunkCheckSumTime: " + (double)dnData.getReadChunkCheckSumTime() / readTime);
          LOG.info(i + "-" + j + ".dn_copyChunkDataTime: " + (double)dnData.getCopyChunkDataTime() / readTime);
          LOG.info(i + "-" + j + ".dn_copyChunkCheckSumTime: " + (double)dnData.getCopyChunkChecksumTime() / readTime);
          LOG.info(i + "-" + j + ".dn_verifyCheckSumTime: " + (double)dnData.getVerifyCheckSumTime() / readTime);
          LOG.info(i + "-" + j + ".dn_updateChunkCheckSumTime: " + (double)dnData.getUpdateChunkCheckSumTime() / readTime);
          LOG.info(i + "-" + j + ".dn_transferChunkToClientTime: " + (double)dnData.getTransferChunkToClientTime() / readTime);
          LOG.info(i + "-" + j + ".dn_sendChunkToClientTime: " + (double)dnData.getSendChunkToClientTime() / readTime);
          LOG.info(i + "-" + j + ".dn_sendBlockTime: " + (double)dnData.getSendBlockTime() / readTime);
         
        }
        i++;
      }
    } finally {
View Full Code Here


    long startOffset = header.getStartOffset();
    long length = header.getLen();
    String clientName = header.getClientName();
    reuseConnection = header.getReuseConnection();
    boolean shouldProfile = header.getShouldProfile();
    FSDataNodeReadProfilingData dnData = shouldProfile ?
        new FSDataNodeReadProfilingData() : null;

    if (shouldProfile) {
      dnData.readVersionAndOpCodeTime = (startNanoTime - receiverStartTime) ;
      dnData.readBlockHeaderTime = (System.nanoTime() - startNanoTime);
      dnData.startProfiling();
    }
   
    // send the block
    OutputStream baseStream = NetUtils.getOutputStream(s,
        datanode.socketWriteTimeout);
    DataOutputStream out = new DataOutputStream(
                 new BufferedOutputStream(baseStream, SMALL_BUFFER_SIZE));
   
    BlockSender blockSender = null;
    String clientTraceFmt = null;
    if (ClientTraceLog.isInfoEnabled()) {   
      if (remoteAddress == null) {
        getAddresses();
      }
      clientTraceFmt = clientName.length() > 0 ? String.format(
          DN_CLIENTTRACE_FORMAT, localAddress, remoteAddress, "%d",
          "HDFS_READ", clientName, "%d",
          datanode.getDNRegistrationForNS(namespaceId).getStorageID(), block,
          "%d")
          :
          datanode.getDNRegistrationForNS(namespaceId)
          + " Served block " + block + " to " + s.getInetAddress();
    }
    updateCurrentThreadName("sending block " + block);
    InjectionHandler.processEvent(InjectionEvent.DATANODE_READ_BLOCK);
       
    try {
      try {
        blockSender = new BlockSender(namespaceId, block, startOffset, length,
            datanode.ignoreChecksumWhenRead, true, true, false,
            versionAndOpcode.getDataTransferVersion() >=
              DataTransferProtocol.PACKET_INCLUDE_VERSION_VERSION,
            false, datanode, clientTraceFmt);
        if (shouldProfile) {
          blockSender.enableReadProfiling(dnData);
        }
     } catch(IOException e) {
        sendResponse(s, (short) DataTransferProtocol.OP_STATUS_ERROR,
            datanode.socketWriteTimeout);
        throw e;
      }
      if (ClientTraceLog.isInfoEnabled()) {
        ClientTraceLog.info("Sending blocks. namespaceId: "
            + namespaceId + " block: " + block + " to " + remoteAddress);
      }

      out.writeShort(DataTransferProtocol.OP_STATUS_SUCCESS); // send op status
      if (shouldProfile) {
        dnData.startSendBlock();
      }
     
      long read = blockSender.sendBlock(out, baseStream, null); // send data
      if (shouldProfile) {
        dnData.endSendBlock();
      }
     
      // report finalization information and block length.
      ReplicaToRead replicaRead = blockSender.getReplicaToRead();
      if (replicaRead == null) {
        replicaRead = datanode.data.getReplicaToRead(namespaceId, block);
      }
      if (replicaRead == null) {
        throw new IOException("Can't find block " + block + " in volumeMap");
      }
     
      int fadvise = header.getReadOptions().getFadvise();
      if (fadvise != 0) {
        blockSender.fadviseStream(fadvise, startOffset, length);
      }

      boolean isBlockFinalized = replicaRead.isFinalized();
      long blockLength = replicaRead.getBytesVisible();
      out.writeBoolean(isBlockFinalized);
      out.writeLong(blockLength);
      if (shouldProfile) {
        dnData.write(out);
      }
      out.flush();

      if (blockSender.didSendEntireByteRange()) {
        // See if client verification succeeded.
View Full Code Here

    }     
  }
 
  private void readDataNodeProfilingData() throws IOException {
    if (cliData != null) {
      FSDataNodeReadProfilingData dnData = new FSDataNodeReadProfilingData();
      dnData.readFields(in);
      cliData.addDataNodeReadProfilingData(dnData);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.FSDataNodeReadProfilingData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.