From b23c261ff6e505f0b840c527f14a8635f64fbf5f Mon Sep 17 00:00:00 2001 From: ivan <ivan@ivanLaptop> Date: Wed, 7 Oct 2015 21:55:09 +0200 Subject: [PATCH] [s3] added maxConnections to Client configuration --- s3/README.md | 13 +++++++++++++ s3/src/main/conf/s3.properties | 12 ++++++++++-- s3/src/main/java/com/yahoo/ycsb/db/S3Client.java | 12 +++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/s3/README.md b/s3/README.md index b004cdad..04874d28 100644 --- a/s3/README.md +++ b/s3/README.md @@ -29,6 +29,9 @@ Running the command: the workload A will be executed with 50/50 updates/reads. #### S3 Storage Configuration Parameters + +The parameters to configure the S3 client can be set using the file "s3-binding/conf/s3.properties". This is highly advisable for the parameters s3.accessKeyId and s3.secretKey. All the other parameters can be set also on the command line. Here the list of all the parameters that is possible to configure: + - `table` - This should be a S3 Storage bucket name and it replace the standard table name assigned by YCSB. @@ -48,3 +51,13 @@ the workload A will be executed with 50/50 updates/reads. - `s3.maxErrorRetry` - This is the maxErrorRetry parameter for the S3Client. + +- `s3.protocol` + - This is the protocol parameter for the S3Client. The default value is HTTPS. + +- `s3.sse` + - This parameter set to true activates the Server Side Encryption. + +- `s3.ssec` + - This parameter if not null activates the SSE-C client side encryption. The value passed with this parameter is the client key used to encrpyt the files. + diff --git a/s3/src/main/conf/s3.properties b/s3/src/main/conf/s3.properties index 554281e7..f36c7745 100644 --- a/s3/src/main/conf/s3.properties +++ b/s3/src/main/conf/s3.properties @@ -19,5 +19,13 @@ s3.sse=false # activating the SSE-C client side encryption if used #s3.ssec=U2CccCI40he2mZtg2aCEzofP7nQsfy4nP14VSYu6bFA= -# set the protocol to use for the Client, default is HTTP -s3.protocol=HTTPS +# set the protocol to use for the Client, default is HTTPS +#s3.protocol=HTTPS + +# set the maxConnections to use for the Client, it should be not less than the +# threads since only one client is created and shared between threads +#s3.maxConnections= + +# set the maxErrorRetry parameter to use for the Client +#s3.maxErrorRetry= + diff --git a/s3/src/main/java/com/yahoo/ycsb/db/S3Client.java b/s3/src/main/java/com/yahoo/ycsb/db/S3Client.java index ecc9b676..1bb5e30f 100644 --- a/s3/src/main/java/com/yahoo/ycsb/db/S3Client.java +++ b/s3/src/main/java/com/yahoo/ycsb/db/S3Client.java @@ -149,6 +149,7 @@ public class S3Client extends DB { String endPoint = null; String region = null; String maxErrorRetry = null; + String maxConnections = null; String protocol = null; BasicAWSCredentials s3Credentials; ClientConfiguration clientConfig; @@ -185,6 +186,10 @@ public class S3Client extends DB { if (maxErrorRetry == null){ maxErrorRetry = propsCL.getProperty("s3.maxErrorRetry", "15"); } + maxConnections = props.getProperty("s3.maxConnections"); + if (maxConnections == null){ + maxConnections = propsCL.getProperty("s3.maxConnections"); + } protocol = props.getProperty("s3.protocol"); if (protocol == null){ protocol = propsCL.getProperty("s3.protocol", "HTTP"); @@ -208,9 +213,14 @@ public class S3Client extends DB { s3Credentials = new BasicAWSCredentials(accessKeyId, secretKey); clientConfig = new ClientConfiguration(); clientConfig.setMaxErrorRetry(Integer.parseInt(maxErrorRetry)); - if(protocol.equals("HTTPS")) { + if(protocol.equals("HTTP")) { + clientConfig.setProtocol(Protocol.HTTP); + } else { clientConfig.setProtocol(Protocol.HTTPS); } + if(maxConnections != null) { + clientConfig.setMaxConnections(Integer.parseInt(maxConnections)); + } s3Client = new AmazonS3Client(s3Credentials, clientConfig); s3Client.setRegion(Region.getRegion(Regions.fromName(region))); s3Client.setEndpoint(endPoint); -- GitLab