Skip to content

Commit 079363e

Browse files
committed
Use 50% of available cpus by default instead
1 parent 91a5709 commit 079363e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/src/main/java/com/instaclustr/esop/impl/AbstractOperationRequest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public abstract class AbstractOperationRequest extends OperationRequest {
6060
public AbstractOperationRequest() {
6161
// for picocli
6262
if (concurrentConnections == null)
63-
concurrentConnections = Runtime.getRuntime().availableProcessors();
63+
concurrentConnections = getDefaultConcurrentConnections();
6464
}
6565

6666
public AbstractOperationRequest(final StorageLocation storageLocation,
@@ -75,7 +75,7 @@ public AbstractOperationRequest(final StorageLocation storageLocation,
7575
this.skipBucketVerification = skipBucketVerification;
7676
this.proxySettings = proxySettings;
7777
this.retry = retry == null ? new RetrySpec() : retry;
78-
this.concurrentConnections = concurrentConnections == null ? Runtime.getRuntime().availableProcessors() : concurrentConnections;
78+
this.concurrentConnections = concurrentConnections == null ? getDefaultConcurrentConnections() : concurrentConnections;
7979
this.kmsKeyId = kmsKeyId;
8080
}
8181

@@ -98,4 +98,11 @@ public void validate(final Set<String> storageProviders) {
9898
throw new IllegalStateException(format("Available storage providers: %s", Arrays.toString(storageProviders.toArray())));
9999
}
100100
}
101+
102+
/**
103+
* Get default number of concurrent connections based on 50% of available processors.
104+
*/
105+
private static int getDefaultConcurrentConnections() {
106+
return Runtime.getRuntime().availableProcessors() / 2;
107+
}
101108
}

0 commit comments

Comments
 (0)