From 84128141adc5daec8f7050c237dfbb7b0a22f2eb Mon Sep 17 00:00:00 2001 From: Marios Meimaris Date: Thu, 16 Apr 2020 14:54:12 +0200 Subject: [PATCH 1/5] Changed KeepAliveSocketFactory to singleton --- .../azure/storage/core/KeepAliveSocketFactory.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/KeepAliveSocketFactory.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/KeepAliveSocketFactory.java index 3e241f28e..4a83071fc 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/KeepAliveSocketFactory.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/KeepAliveSocketFactory.java @@ -15,6 +15,7 @@ package com.microsoft.azure.storage.core; +import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSocketFactory; import java.io.IOException; import java.net.InetAddress; @@ -39,10 +40,16 @@ public class KeepAliveSocketFactory extends SSLSocketFactory { private SSLSocketFactory delegate; + private static final KeepAliveSocketFactory singletonKeepAliveSocketFactory = new KeepAliveSocketFactory(HttpsURLConnection.getDefaultSSLSocketFactory()); + KeepAliveSocketFactory(SSLSocketFactory delegate) { this.delegate = delegate; } + public static KeepAliveSocketFactory getInstance() { + return singletonKeepAliveSocketFactory; + } + @Override public String[] getDefaultCipherSuites() { return delegate.getDefaultCipherSuites(); From c621c6241235c8def6764807b94a380fd4f4492f Mon Sep 17 00:00:00 2001 From: Marios Meimaris Date: Thu, 16 Apr 2020 14:54:39 +0200 Subject: [PATCH 2/5] Get singleton instance of KeepAliveSocketFactory in BaseRequest --- .../src/com/microsoft/azure/storage/core/BaseRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java index f43d69f8a..f8d09e1da 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java @@ -230,7 +230,7 @@ protected PasswordAuthentication getPasswordAuthentication() { */ if (retConnection instanceof HttpsURLConnection && !options.disableHttpsSocketKeepAlive()) { HttpsURLConnection httpsConnection = ((HttpsURLConnection) retConnection); - httpsConnection.setSSLSocketFactory(new KeepAliveSocketFactory(httpsConnection.getSSLSocketFactory())); + httpsConnection.setSSLSocketFactory(KeepAliveSocketFactory.getInstance()); } /* From 0ece261bd1b56a67390a83be51615e0317af01fd Mon Sep 17 00:00:00 2001 From: Marios Meimaris Date: Thu, 16 Apr 2020 14:55:19 +0200 Subject: [PATCH 3/5] Enabled httpsSocketKeepAlive by default --- .../microsoft/azure/storage/RequestOptions.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java index 101c94986..c234f6914 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java @@ -108,7 +108,7 @@ protected static void applyBaseDefaultsInternal(final RequestOptions modifiedOpt } if (modifiedOptions.disableHttpsSocketKeepAlive() == null) { - modifiedOptions.setDisableHttpsSocketKeepAlive(true); + modifiedOptions.setDisableHttpsSocketKeepAlive(false); } } @@ -322,16 +322,16 @@ public void setRequireEncryption(Boolean requireEncryption) { * Sets a value to indicate whether https socket keep-alive should be disabled. Use true to disable * keep-alive; otherwise, false *

- * The default is set in the client and is by default true, indicating that https socket keep-alive will be - * disabled. You can change the value on this request by setting this property. You can also change the value on + * The default is set in the client and is by default false, indicating that https socket keep-alive will be + * enabled. You can change the value on this request by setting this property. You can also change the value on * on the {@link ServiceClient#getDefaultRequestOptions()} object so that all subsequent requests made via the * service client will use the appropriate value. *

* Setting keep-alive on https sockets is to work around a bug in the JVM where connection timeouts are not honored - * on retried requests. In those cases, you may choose to use socket keep-alive as a fallback. Unfortunately, the - * timeout value must be taken from a JVM property rather than configured locally. Therefore, in rare cases the JVM - * has configured aggressively short keep-alive times, it may not be beneficial to enable the use of keep-alives - * lest they interfere with long running data transfer operations. + * on retried requests. In those cases, we use socket keep-alive as a fallback. Unfortunately, the timeout value + * must be taken from a JVM property rather than configured locally. Therefore, in rare cases the JVM has configured + * aggressively short keep-alive times, it may be beneficial to disable the use of keep-alives lest they interfere + * with long running data transfer operations. * * @param disableHttpsSocketKeepAlive * A value to indicate whether https socket keep-alive should be disabled. From 283fe4813970ec973d44bb73353f7f5b2cb1592f Mon Sep 17 00:00:00 2001 From: Marios Meimaris Date: Mon, 20 Apr 2020 17:59:53 +0200 Subject: [PATCH 4/5] Revert "Enabled httpsSocketKeepAlive by default" This reverts commit 0ece261bd1b56a67390a83be51615e0317af01fd. --- .../microsoft/azure/storage/RequestOptions.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java index c234f6914..101c94986 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/RequestOptions.java @@ -108,7 +108,7 @@ protected static void applyBaseDefaultsInternal(final RequestOptions modifiedOpt } if (modifiedOptions.disableHttpsSocketKeepAlive() == null) { - modifiedOptions.setDisableHttpsSocketKeepAlive(false); + modifiedOptions.setDisableHttpsSocketKeepAlive(true); } } @@ -322,16 +322,16 @@ public void setRequireEncryption(Boolean requireEncryption) { * Sets a value to indicate whether https socket keep-alive should be disabled. Use true to disable * keep-alive; otherwise, false *

- * The default is set in the client and is by default false, indicating that https socket keep-alive will be - * enabled. You can change the value on this request by setting this property. You can also change the value on + * The default is set in the client and is by default true, indicating that https socket keep-alive will be + * disabled. You can change the value on this request by setting this property. You can also change the value on * on the {@link ServiceClient#getDefaultRequestOptions()} object so that all subsequent requests made via the * service client will use the appropriate value. *

* Setting keep-alive on https sockets is to work around a bug in the JVM where connection timeouts are not honored - * on retried requests. In those cases, we use socket keep-alive as a fallback. Unfortunately, the timeout value - * must be taken from a JVM property rather than configured locally. Therefore, in rare cases the JVM has configured - * aggressively short keep-alive times, it may be beneficial to disable the use of keep-alives lest they interfere - * with long running data transfer operations. + * on retried requests. In those cases, you may choose to use socket keep-alive as a fallback. Unfortunately, the + * timeout value must be taken from a JVM property rather than configured locally. Therefore, in rare cases the JVM + * has configured aggressively short keep-alive times, it may not be beneficial to enable the use of keep-alives + * lest they interfere with long running data transfer operations. * * @param disableHttpsSocketKeepAlive * A value to indicate whether https socket keep-alive should be disabled. From a8bcc6b6a0c322647af42dec9979924c9327d4d5 Mon Sep 17 00:00:00 2001 From: rickle-msft Date: Mon, 4 May 2020 13:42:15 -0700 Subject: [PATCH 5/5] 8.6.4 release prep --- ChangeLog.txt | 3 +++ README.md | 2 +- microsoft-azure-storage-samples/pom.xml | 2 +- .../src/com/microsoft/azure/storage/logging/pom.xml | 2 +- .../src/com/microsoft/azure/storage/Constants.java | 2 +- pom.xml | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index eee3b4fc5..b90c02fa1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +2020.05.04 Version 8.6.4 + * Converted the httpsKeepAliveSocketFactory into a singleton for performance improvements. + 2020.03.30 Version 8.6.3 * Added the commitWriteOnInputStreamException option to BlobRequestOptions, which will allow the user to configure whether any data staged through openWrite when using the upload(InputStream, long) method will be committed upon failures in the InputStream. * Disabled httpsKeepAlive by default as it can introduce some perf issues. diff --git a/README.md b/README.md index e68be2436..686bff248 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w com.microsoft.azure azure-storage - 8.6.3 + 8.6.4 ``` diff --git a/microsoft-azure-storage-samples/pom.xml b/microsoft-azure-storage-samples/pom.xml index 027319870..86b9e1499 100644 --- a/microsoft-azure-storage-samples/pom.xml +++ b/microsoft-azure-storage-samples/pom.xml @@ -26,7 +26,7 @@ com.microsoft.azure azure-storage - 8.6.3 + 8.6.4 com.microsoft.azure diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/logging/pom.xml b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/logging/pom.xml index 51ae2c68a..5cf7c8e47 100644 --- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/logging/pom.xml +++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/logging/pom.xml @@ -26,7 +26,7 @@ com.microsoft.azure azure-storage - 8.6.3 + 8.6.4 com.microsoft.azure diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java index f9dfd503f..c7858a743 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java @@ -765,7 +765,7 @@ public static class HeaderConstants { /** * Specifies the value to use for UserAgent header. */ - public static final String USER_AGENT_VERSION = "8.6.3"; + public static final String USER_AGENT_VERSION = "8.6.4"; /** * The default type for content-type and accept diff --git a/pom.xml b/pom.xml index f771ae3eb..e26ddd448 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 com.microsoft.azure azure-storage - 8.6.3 + 8.6.4 jar Microsoft Azure Storage Client SDK