Configurable HTTP compression. (#3759)

* Configurable HTTP compression.

* Call real-time nodes real-time processes in docs.
This commit is contained in:
Gian Merlino 2016-12-07 17:40:39 -08:00 committed by Jonathan Wei
parent d9807835f9
commit 943982b7b0
4 changed files with 16 additions and 4 deletions

View File

@ -36,8 +36,9 @@ Druid uses Jetty to serve HTTP requests.
|--------|-----------|-------| |--------|-----------|-------|
|`druid.server.http.numThreads`|Number of threads for HTTP requests.|10| |`druid.server.http.numThreads`|Number of threads for HTTP requests.|10|
|`druid.server.http.maxIdleTime`|The Jetty max idle time for a connection.|PT5m| |`druid.server.http.maxIdleTime`|The Jetty max idle time for a connection.|PT5m|
|`druid.broker.http.numConnections`|Size of connection pool for the Broker to connect to historical and real-time nodes. If there are more queries than this number that all need to speak to the same node, then they will queue up.|20| |`druid.broker.http.numConnections`|Size of connection pool for the Broker to connect to historical and real-time processes. If there are more queries than this number that all need to speak to the same node, then they will queue up.|20|
|`druid.broker.http.readTimeout`|The timeout for data reads.|PT15M| |`druid.broker.http.compressionCodec`|Compression codec the Broker uses to communicate with historical and real-time processes. May be "gzip" or "identity".|gzip|
|`druid.broker.http.readTimeout`|The timeout for data reads from historical and real-time processes.|PT15M|
#### Retry Policy #### Retry Policy

View File

@ -128,7 +128,7 @@
<dependency> <dependency>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>http-client</artifactId> <artifactId>http-client</artifactId>
<version>1.0.5</version> <version>1.0.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>

View File

@ -30,6 +30,8 @@ import javax.validation.constraints.Min;
public class DruidHttpClientConfig public class DruidHttpClientConfig
{ {
private final String DEFAULT_COMPRESSION_CODEC = "gzip";
@JsonProperty @JsonProperty
@Min(0) @Min(0)
private int numConnections = 20; private int numConnections = 20;
@ -41,6 +43,9 @@ public class DruidHttpClientConfig
@Min(1) @Min(1)
private int numMaxThreads = Math.max(10, (Runtime.getRuntime().availableProcessors() * 17) / 16 + 2) + 30; private int numMaxThreads = Math.max(10, (Runtime.getRuntime().availableProcessors() * 17) / 16 + 2) + 30;
@JsonProperty
private String compressionCodec = DEFAULT_COMPRESSION_CODEC;
public int getNumConnections() public int getNumConnections()
{ {
return numConnections; return numConnections;
@ -55,4 +60,9 @@ public class DruidHttpClientConfig
{ {
return numMaxThreads; return numMaxThreads;
} }
public String getCompressionCodec()
{
return compressionCodec;
}
} }

View File

@ -108,7 +108,8 @@ public class HttpClientModule implements Module
.builder() .builder()
.withNumConnections(config.getNumConnections()) .withNumConnections(config.getNumConnections())
.withReadTimeout(config.getReadTimeout()) .withReadTimeout(config.getReadTimeout())
.withWorkerCount(config.getNumMaxThreads()); .withWorkerCount(config.getNumMaxThreads())
.withCompressionCodec(HttpClientConfig.CompressionCodec.valueOf(config.getCompressionCodec().toUpperCase()));
if (getSslContextBinding() != null) { if (getSslContextBinding() != null) {
builder.withSslContext(getSslContextBinding().getProvider().get()); builder.withSslContext(getSslContextBinding().getProvider().get());