Skip to content

Commit

Permalink
Client max chunk size is now configurable and defaults to 64KB
Browse files Browse the repository at this point in the history
dlarge committed Nov 21, 2024
1 parent 8fd6cbc commit 88c0ed1
Showing 6 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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

@@ -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",
]
Original file line number Diff line number Diff line change
@@ -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
@@ -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,
@@ -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())
@@ -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());
}

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
@@ -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
@@ -13,3 +13,6 @@ storage:
only: false
uri:
args: {}
max:
chunk:
size: 65536

0 comments on commit 88c0ed1

Please sign in to comment.