Skip to content

Commit

Permalink
Speedup retrieving inputstream
Browse files Browse the repository at this point in the history
Workd both on sending and retrieving (server, client) an InputStream

Fetch more than 1 at startup (3 to still have a limit of memory
consumption)

Speedup:
- POST: from 900 MB/s to 1200 MB/s (almost close to Netty native Post
  at 1400 MB/s)
- GET: from 900 MB/s to 2000 MB/s (still half og Netty netive GET at
  4400 MB/s)
  • Loading branch information
fredericBregier committed Dec 12, 2023
1 parent a33c73c commit 2a89aaa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ public void handle(Throwable event) {
}

});
request.fetch(1);
// More than 1 speedup retrieve while limited in memory
request.fetch(3);
} else {
eof = true;
}
Expand Down Expand Up @@ -266,10 +267,8 @@ protected ByteBuf readBlocking() throws IOException {
input1 = null;
if (inputOverflow != null) {
input1 = inputOverflow.poll();
if (input1 == null) {
request.fetch(1);
}
} else if (!eof) {
}
if (!eof) {
request.fetch(1);
}
return ret == null ? null : ret.getByteBuf();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ public void handle(Throwable event) {
}

});
response.fetch(1);
// More than 1 speedup retrieve while limited in memory
response.fetch(3);
} catch (IllegalStateException e) {
//already ended
eof = true;
Expand Down Expand Up @@ -221,10 +222,8 @@ protected ByteBuf readBlocking() throws IOException {
input1 = null;
if (inputOverflow != null) {
input1 = inputOverflow.poll();
if (input1 == null) {
request.fetch(1);
}
} else if (!eof) {
}
if (!eof) {
request.fetch(1);
}
return ret == null ? null : ret.getByteBuf();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ public void handle(Throwable event) {
}

});
request.fetch(1);
// More than 1 speedup retrieve while limited in memory
request.fetch(3);
} else {
eof = true;
}
Expand Down Expand Up @@ -267,10 +268,8 @@ protected ByteBuf readBlocking() throws IOException {
input1 = null;
if (inputOverflow != null) {
input1 = inputOverflow.poll();
if (input1 == null) {
request.fetch(1);
}
} else if (!eof) {
}
if (!eof) {
request.fetch(1);
}
return ret == null ? null : ret.getByteBuf();
Expand Down

0 comments on commit 2a89aaa

Please sign in to comment.