You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by ru...@apache.org on 2021/05/13 02:18:03 UTC

[ratis] branch master updated: RATIS-1376. Improve the used memory (#478)

This is an automated email from the ASF dual-hosted git repository.

runzhiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 921ae6e  RATIS-1376. Improve the used memory (#478)
921ae6e is described below

commit 921ae6e2088cd49eb3c3cf3d25df7ba436a75674
Author: runzhiwang <51...@users.noreply.github.com>
AuthorDate: Thu May 13 10:17:57 2021 +0800

    RATIS-1376. Improve the used memory (#478)
---
 .../src/main/java/org/apache/ratis/client/RaftClientConfigKeys.java    | 2 +-
 .../src/main/java/org/apache/ratis/client/impl/OrderedStreamAsync.java | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ratis-client/src/main/java/org/apache/ratis/client/RaftClientConfigKeys.java b/ratis-client/src/main/java/org/apache/ratis/client/RaftClientConfigKeys.java
index e6d85a0..5fb5dff 100644
--- a/ratis-client/src/main/java/org/apache/ratis/client/RaftClientConfigKeys.java
+++ b/ratis-client/src/main/java/org/apache/ratis/client/RaftClientConfigKeys.java
@@ -95,7 +95,7 @@ public interface RaftClientConfigKeys {
     String PREFIX = RaftClientConfigKeys.PREFIX + ".data-stream";
 
     String OUTSTANDING_REQUESTS_MAX_KEY = PREFIX + ".outstanding-requests.max";
-    int OUTSTANDING_REQUESTS_MAX_DEFAULT = 100;
+    int OUTSTANDING_REQUESTS_MAX_DEFAULT = 10;
     static int outstandingRequestsMax(RaftProperties properties) {
       return getInt(properties::getInt, OUTSTANDING_REQUESTS_MAX_KEY,
           OUTSTANDING_REQUESTS_MAX_DEFAULT, getDefaultLog(), requireMin(2));
diff --git a/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedStreamAsync.java b/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedStreamAsync.java
index 10c4db4..94814ca 100644
--- a/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedStreamAsync.java
+++ b/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedStreamAsync.java
@@ -127,9 +127,10 @@ public class OrderedStreamAsync {
     }
     final CompletableFuture<DataStreamReply> requestFuture = dataStreamClientRpc.streamAsync(
         request.getDataStreamRequest());
+    long seqNum = request.getSeqNum();
     requestFuture.thenApply(reply -> {
       slidingWindow.receiveReply(
-          request.getSeqNum(), reply, this::sendRequestToNetwork);
+          seqNum, reply, this::sendRequestToNetwork);
       return reply;
     }).thenAccept(reply -> {
       if (f.isDone()) {