Hello Tim Speetjens, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/36161 to review the following change. Change subject: core: Make the number of concurrent vds and irs connections configurable ...................................................................... core: Make the number of concurrent vds and irs connections configurable Allow tuning of apache HttpClients MaxConnectionsPerHost and MaxTotalConnections values, to increase command throughput. - Add VdsMaxConnectionsPerHost and IrsMaxConnectionsPerHost config values. Each value is used for specific type of the connection, with default 2, which is the value in use without tuning - Add MaxTotalConnections config value which determines maxiumum number of allowed connections, with default 20, which is the value in use without tuning Change-Id: Id6a7e2bc0f6865e41dd85ab1fd188625cab22ddf Bug-Url: https://bugzilla.redhat.com/1168538 Signed-off-by: Tim Speetjens <tim.speetj...@redhat.com> Signed-off-by: pkliczewski <piotr.kliczew...@gmail.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/TransportFactory.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 4 files changed, 49 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/36161/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java index de7f232..45b15e9 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java @@ -65,6 +65,31 @@ vdsConnectionTimeout, /** + * Maximum concurrent http(s) connections to hosts. A small number of connections should suffice for most + * environments. When a lot of storage actions are performed, this value can be increased for more VDS command + * throughput. + */ + @TypeConverterAttribute(Integer.class) + @DefaultValueAttribute("2") + VdsMaxConnectionsPerHost, + + /** + * Maximum concurrent http(s) connections to hosts. A small number of connections should suffice for most + * environments. When a lot of storage actions are performed, this value can be increased for more SPM command + * throughput. + */ + @TypeConverterAttribute(Integer.class) + @DefaultValueAttribute("2") + IrsMaxConnectionsPerHost, + + /** + * Maximum number of connections allowed. + */ + @TypeConverterAttribute(Integer.class) + @DefaultValueAttribute("20") + MaxTotalConnections, + + /** * The number of time to retry connection during protocol fallback. */ @TypeConverterAttribute(Integer.class) diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/TransportFactory.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/TransportFactory.java index 912aa42..49450f7 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/TransportFactory.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/TransportFactory.java @@ -25,8 +25,10 @@ } else if (VdsProtocol.XML == vdsProtocol){ Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, - clientRetries, IrsServerConnector.class, - Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); + clientRetries, + Config.<Integer> getValue(ConfigValues.IrsMaxConnectionsPerHost), + Config.<Integer> getValue(ConfigValues.MaxTotalConnections), + IrsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); irsServer = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return irsServer; @@ -37,7 +39,10 @@ IVdsServer vdsServer = null; Pair<VdsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, - clientRetries, VdsServerConnector.class, + clientRetries, + Config.<Integer> getValue(ConfigValues.VdsMaxConnectionsPerHost), + Config.<Integer> getValue(ConfigValues.MaxTotalConnections), + VdsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); if (VdsProtocol.STOMP == vdsProtocol) { diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java index d7b9029..c22364e 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java @@ -92,13 +92,19 @@ * @return an instance of the given type. */ public static <T> Pair<T, HttpClient> getConnection(String hostName, int port, int clientTimeOut, - int connectionTimeOut, int clientRetries, Class<T> type, boolean isSecure) { + int connectionTimeOut, int clientRetries, int maxConnectionsPerHost, int maxTotalConnections, Class<T> type, boolean isSecure) { Pair<String, URL> urlInfo = getConnectionUrl(hostName, port, null, isSecure); if (urlInfo == null) { return null; } - return getHttpConnection(urlInfo.getSecond(), clientTimeOut, connectionTimeOut, clientRetries, type); + return getHttpConnection(urlInfo.getSecond(), + clientTimeOut, + connectionTimeOut, + clientRetries, + maxConnectionsPerHost, + maxTotalConnections, + type); } public static Pair<String, URL> getConnectionUrl(String hostName, int port, String path, boolean isSecure) { @@ -129,7 +135,7 @@ @SuppressWarnings("unchecked") private static <T> Pair<T, HttpClient> getHttpConnection(URL serverUrl, int clientTimeOut, - int connectionTimeOut, int clientRetries, Class<T> type) { + int connectionTimeOut, int clientRetries, int maxConnectionsPerHost, int maxTotalConnections, Class<T> type) { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(serverUrl); config.setConnectionTimeout(connectionTimeOut); @@ -138,7 +144,7 @@ xmlRpcClient.setConfig(config); XmlRpcCommonsTransportFactory transportFactory = new CustomXmlRpcCommonsTransportFactory(xmlRpcClient); - HttpClient httpclient = createHttpClient(clientRetries, connectionTimeOut); + HttpClient httpclient = createHttpClient(clientRetries, connectionTimeOut, maxConnectionsPerHost, maxTotalConnections); transportFactory.setHttpClient(httpclient); xmlRpcClient.setTransportFactory(transportFactory); @@ -152,9 +158,11 @@ return returnValue; } - private static HttpClient createHttpClient(int clientRetries, int connectionTimeout) { + private static HttpClient createHttpClient(int clientRetries, int connectionTimeout, int maxConnectionsPerHost, int maxTotalConnections) { HttpConnectionManagerParams params = new HttpConnectionManagerParams(); params.setConnectionTimeout(connectionTimeout); + params.setDefaultMaxConnectionsPerHost(maxConnectionsPerHost); + params.setMaxTotalConnections(maxTotalConnections); MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager(); httpConnectionManager.setParams(params); // Create the client: diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index f0e48e1..93ab38a 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -668,6 +668,9 @@ select fn_db_add_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.3'); select fn_db_add_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;drac7:;eps:slot=port;hpblade:port=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.4'); select fn_db_add_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;drac7:;eps:slot=port;hpblade:port=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.5'); +select fn_db_add_config_value('VdsMaxConnectionsPerHost','2','general'); +select fn_db_add_config_value('IrsMaxConnectionsPerHost','2','general'); +select fn_db_add_config_value('MaxTotalConnections','20','general'); select fn_db_add_config_value('CustomVdsFenceOptionMapping','','general'); select fn_db_add_config_value('VdsFenceOptions','','general'); select fn_db_add_config_value('VdsFenceOptionTypes','secure=bool,port=int,slot=int','general'); -- To view, visit http://gerrit.ovirt.org/36161 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id6a7e2bc0f6865e41dd85ab1fd188625cab22ddf Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Piotr Kliczewski <piotr.kliczew...@gmail.com> Gerrit-Reviewer: Tim Speetjens <tim.speetj...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches