spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ericl <...@git.apache.org>
Subject [GitHub] spark pull request #14080: [SPARK-16405] Add metrics and source for external...
Date Fri, 08 Jul 2016 22:31:31 GMT
Github user ericl commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14080#discussion_r70150439
  
    --- Diff: common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java
---
    @@ -79,32 +89,59 @@ protected void handleMessage(
           TransportClient client,
           RpcResponseCallback callback) {
         if (msgObj instanceof OpenBlocks) {
    -      OpenBlocks msg = (OpenBlocks) msgObj;
    -      checkAuth(client, msg.appId);
    -
    -      List<ManagedBuffer> blocks = Lists.newArrayList();
    -      for (String blockId : msg.blockIds) {
    -        blocks.add(blockManager.getBlockData(msg.appId, msg.execId, blockId));
    +      // Reset transferred block size metrics as zero
    +      final Timer.Context responseDelayContext = metrics.openBlockRequestLatencyMillis.time();
    +      try {
    +        OpenBlocks msg = (OpenBlocks) msgObj;
    +        checkAuth(client, msg.appId);
    +
    +        List<ManagedBuffer> blocks = Lists.newArrayList();
    +        long totalBlockSize = 0;
    +        for (String blockId : msg.blockIds) {
    +          final ManagedBuffer block = blockManager.getBlockData(msg.appId, msg.execId,
blockId);
    +          totalBlockSize += block.size();
    +          blocks.add(block);
    +        }
    +        long streamId = streamManager.registerStream(client.getClientId(), blocks.iterator());
    +        logger.trace("Registered streamId {} with {} buffers for client {} from host
{}",
    +                     streamId,
    +                     msg.blockIds.length,
    +                     client.getClientId(),
    +                     NettyUtils.getRemoteAddress(client.getChannel()));
    +        callback.onSuccess(new StreamHandle(streamId, msg.blockIds.length).toByteBuffer());
    +        metrics.blockTransferRateMBytes.mark(totalBlockSize / 1024 / 1024);
    +      } finally {
    +        responseDelayContext.stop();
           }
    -      long streamId = streamManager.registerStream(client.getClientId(), blocks.iterator());
    -      logger.trace("Registered streamId {} with {} buffers for client {} from host {}",
    -          streamId,
    -          msg.blockIds.length,
    -          client.getClientId(),
    -          NettyUtils.getRemoteAddress(client.getChannel()));
    -      callback.onSuccess(new StreamHandle(streamId, msg.blockIds.length).toByteBuffer());
     
         } else if (msgObj instanceof RegisterExecutor) {
    -      RegisterExecutor msg = (RegisterExecutor) msgObj;
    -      checkAuth(client, msg.appId);
    -      blockManager.registerExecutor(msg.appId, msg.execId, msg.executorInfo);
    -      callback.onSuccess(ByteBuffer.wrap(new byte[0]));
    +      final Timer.Context responseDelayContext = metrics.registerExecutorRequestLatencyMillis.time();
    +      try {
    +        RegisterExecutor msg = (RegisterExecutor) msgObj;
    +        checkAuth(client, msg.appId);
    +        blockManager.registerExecutor(msg.appId, msg.execId, msg.executorInfo);
    +        callback.onSuccess(ByteBuffer.wrap(new byte[0]));
    +      } finally {
    +        responseDelayContext.stop();
    +      }
     
         } else {
           throw new UnsupportedOperationException("Unexpected message: " + msgObj);
         }
       }
     
    +  public MetricSet getAllMetrics() {
    +    return metrics;
    +  }
    +
    +  public long getRegisteredExecutorsSize() {
    +    return blockManager.getRegisteredExecutorsSize();
    +  }
    +
    +  public long getTotalShuffleRequests() {
    --- End diff --
    
    Can you remove this one?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message