From 65759973adc9c658d38e9b1501de41d876f7e29c Mon Sep 17 00:00:00 2001 From: Jonathan Shook Date: Thu, 23 Dec 2021 12:07:58 -0600 Subject: [PATCH] add client config options to ddb --- .../adapter/dynamodb/DynamoDBSpace.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/adapter-dynamodb/src/main/java/io/nosqlbench/adapter/dynamodb/DynamoDBSpace.java b/adapter-dynamodb/src/main/java/io/nosqlbench/adapter/dynamodb/DynamoDBSpace.java index 9ec3bf0ac..d682e45b2 100644 --- a/adapter-dynamodb/src/main/java/io/nosqlbench/adapter/dynamodb/DynamoDBSpace.java +++ b/adapter-dynamodb/src/main/java/io/nosqlbench/adapter/dynamodb/DynamoDBSpace.java @@ -1,5 +1,6 @@ package io.nosqlbench.adapter.dynamodb; +import com.amazonaws.ClientConfiguration; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; @@ -42,6 +43,30 @@ public class DynamoDBSpace { throw new OpConfigError("Either region or endpoint and signing_region options are required."); } + + ClientConfiguration ccfg = new ClientConfiguration(); + cfg.getOptional("client_socket_timeout").map(Integer::parseInt).ifPresent(ccfg::withSocketTimeout); + cfg.getOptional("client_execution_timeout").map(Integer::parseInt).ifPresent(ccfg::withClientExecutionTimeout); + cfg.getOptional("client_max_connections").map(Integer::parseInt).ifPresent(ccfg::withMaxConnections); + cfg.getOptional("client_max_error_retry").map(Integer::parseInt).ifPresent(ccfg::withMaxErrorRetry); + cfg.getOptional("client_user_agent_prefix").ifPresent(ccfg::withUserAgentPrefix); +// ccfg.withHeader(); + cfg.getOptional("client_consecutive_retries_before_throttling").map(Integer::parseInt) + .ifPresent(ccfg::withMaxConsecutiveRetriesBeforeThrottling); + cfg.getOptional("client_gzip").map(Boolean::parseBoolean).ifPresent(ccfg::withGzip); + cfg.getOptional("client_tcp_keepalive").map(Boolean::parseBoolean).ifPresent(ccfg::withTcpKeepAlive); + cfg.getOptional("client_disable_socket_proxy").map(Boolean::parseBoolean).ifPresent(ccfg::withDisableSocketProxy); +// ccfg.withProtocol() +// ccfg.withRetryMode(); +// ccfg.withRetryPolicy(); + + ccfg.withSocketBufferSizeHints( + cfg.getOptional("client_so_send_size_hint").map(Integer::parseInt).orElse(0), + cfg.getOptional("client_so_recv_size_hint").map(Integer::parseInt).orElse(0) + ); + + builder.setClientConfiguration(ccfg); + return builder.build(); }