Skip to content

Client max chunk size is now configurable and defaults to 64KB #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
|:-----------------------------------------------|:-------------|:-----------------|:-------------------------------------------------|
| storage-net-http-headers | Map | { "Connection" : "keep-alive", "Date": "#{date:formatNowRfc1123()}%{date:formatNowRfc1123()}", "User-Agent" : "mongoose-storage-driver-http/4.2.6" } | Custom HTTP headers section. A user may place here a key-value pair which will be used as HTTP header. The headers will be appended to every HTTP request issued.
| storage-net-http-uri-args | Map | {} | Custom URI query arguments according [RFC 2396](http://www.ietf.org/rfc/rfc2396.txt).The headers will be appended to every HTTP request issued.
| storage-net-http-read-metadata-only | Map | false | specifies whether Mongoose issues GET request or HEAD. HEAD is used when enabled.
| storage-net-http-read-metadata-only | Map | false | Specifies whether Mongoose issues GET request or HEAD. HEAD is used when enabled.
| storage-net-http-max-chunk-size | Integer | 65536 | The limit, in bytes, at which Netty will send a chunk down the pipeline.

## 2. Custom HTTP Headers

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {

description = "Mongoose is a high-load storage performance testing tool"
group = "com.github.emc-mongoose"
version = "4.2.20"
version = "4.2.21"
sourceCompatibility = 11
targetCompatibility = 11

Expand All @@ -41,7 +41,7 @@ ext {
mongooseBase : "4.3.3",
mongooseStorageDriverCoop: "4.2.21",
mongooseStorageDriverNetty: "4.2.18",
netty : "4.1.25.Final",
netty : "4.1.115.Final",
scala : "2.12.6",
slf4j : "1.7.25",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public interface HttpStorageDriver<I extends Item, O extends Operation<I>>

int REQ_LINE_LEN = 1024;
int HEADERS_LEN = 2048;
int CHUNK_SIZE = 8192;

String KEY_CONTENT = "content";
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public abstract class HttpStorageDriverBase<I extends Item, O extends Operation<
private final Input<String> uriQueryInput;
protected final ChannelFutureListener httpReqSentCallback = this::sendHttpRequestComplete;
protected final boolean readMetadataOnly;
protected final int maxChunkSize;

protected HttpStorageDriverBase(
final String testStepId,
Expand Down Expand Up @@ -115,6 +116,7 @@ protected HttpStorageDriverBase(
if (readMetadataOnly) {
Loggers.MSG.info("Reading metadata only (HEAD requests)");
}
this.maxChunkSize = httpConfig.intVal("max-chunk-size");
final var uriArgs = httpConfig.<String> mapVal("uri-args");
final var uriQueryExpr = uriArgs.entrySet().stream()
.map(entry -> entry.getKey() + '=' + entry.getValue())
Expand Down Expand Up @@ -178,7 +180,7 @@ protected void appendHandlers(final Channel channel) {
super.appendHandlers(channel);
channel
.pipeline()
.addLast(new HttpClientCodec(REQ_LINE_LEN, HEADERS_LEN, CHUNK_SIZE, true))
.addLast(new HttpClientCodec(REQ_LINE_LEN, HEADERS_LEN, maxChunkSize, true))
.addLast(new ChunkedWriteHandler());
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config-schema-storage-net-http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ storage:
only: boolean
uri:
args: map
max:
chunk:
size: int
3 changes: 3 additions & 0 deletions src/main/resources/config/defaults-storage-net-http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ storage:
only: false
uri:
args: {}
max:
chunk:
size: 65536
Loading