Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to forcefully close SSL connections #1016

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/command_line_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ Default value: ``timeout:60``
Rally recognizes the following client options in addition:

* ``max_connections``: By default, Rally will choose the maximum allowed number of connections automatically (equal to the number of simulated clients but at least 256 connections). With this property it is possible to override that logic but a minimum of 256 is enforced internally.
* ``enable_cleanup_closed`` (default: ``false``): In some cases, SSL connections might not be properly closed and the number of open connections increases as a result. When this client option is set to ``true``, the Elasticsearch client will check and forcefully close these connections.

**Examples**

Expand Down
4 changes: 3 additions & 1 deletion esrally/async_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(self, host='localhost', port=9200, http_auth=None,

trace_configs = [trace_config] if trace_config else None
max_connections = max(256, kwargs.get("max_connections", 0))
enable_cleanup_closed = kwargs.get("enable_cleanup_closed", False)
self.session = aiohttp.ClientSession(
auth=http_auth,
timeout=self.timeout,
Expand All @@ -91,7 +92,8 @@ def __init__(self, host='localhost', port=9200, http_auth=None,
verify_ssl=verify_certs,
use_dns_cache=use_dns_cache,
ssl_context=ssl_context,
limit=max_connections
limit=max_connections,
enable_cleanup_closed=enable_cleanup_closed
),
headers=headers,
trace_configs=trace_configs,
Expand Down
5 changes: 4 additions & 1 deletion esrally/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import urllib3

from esrally import exceptions, doc_link
from esrally.utils import console
from esrally.utils import console, convert


class EsClientFactory:
Expand Down Expand Up @@ -118,6 +118,9 @@ def __init__(self, hosts, client_options):
else:
self.logger.info("HTTP compression: off")

if self._is_set(self.client_options, "enable_cleanup_closed"):
self.client_options["enable_cleanup_closed"] = convert.to_bool(self.client_options.pop("enable_cleanup_closed"))

def _is_set(self, client_opts, k):
try:
return client_opts[k]
Expand Down