Uploaded image for project: 'Hadoop Distributed Data Store'
  1. Hadoop Distributed Data Store
  2. HDDS-2169

Avoid buffer copies while submitting client requests in Ratis

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Target Version/s:

      Description

      Currently, while sending write requests to Ratis from ozone, a protobuf object containing data encoded  and then resultant protobuf is again converted to a byteString which internally does a copy of the buffer embedded inside the protobuf again so that it can be submitted over to Ratis client. Again, while sending the appendRequest as well while building up the appendRequestProto, it might be again copying the data. The idea here is to provide client so pass the raw data(stateMachine data) separately to ratis client without copying overhead. 

       

      private CompletableFuture<RaftClientReply> sendRequestAsync(
          ContainerCommandRequestProto request) {
        try (Scope scope = GlobalTracer.get()
            .buildSpan("XceiverClientRatis." + request.getCmdType().name())
            .startActive(true)) {
          ContainerCommandRequestProto finalPayload =
              ContainerCommandRequestProto.newBuilder(request)
                  .setTraceID(TracingUtil.exportCurrentSpan())
                  .build();
          boolean isReadOnlyRequest = HddsUtils.isReadOnly(finalPayload);
      
      //  finalPayload already has the byteString data embedded. 
          ByteString byteString = finalPayload.toByteString(); -----> It involves a copy again.
          if (LOG.isDebugEnabled()) {
            LOG.debug("sendCommandAsync {} {}", isReadOnlyRequest,
                sanitizeForDebug(finalPayload));
          }
          return isReadOnlyRequest ?
              getClient().sendReadOnlyAsync(() -> byteString) :
              getClient().sendAsync(() -> byteString);
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                szetszwo Tsz-wo Sze
                Reporter:
                shashikant Shashikant Banerjee
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 40m
                  4h 40m