Skip to content

Conversation

nickolai-dr
Copy link
Contributor

@nickolai-dr nickolai-dr commented Aug 27, 2025

Should address:

WARNING urllib3.connectionpool: Connection pool is full, discarding connection: datarobot-otel-collector. Connection pool size: 10

in high perf scenarios.

@devexp-slackbot devexp-slackbot bot changed the title [YOLO] Make pool_maxsize configurable. [MMM-20372] Make pool_maxsize configurable. Aug 27, 2025
@@ -225,8 +227,18 @@ def setup_otel(runtime_parameters, options):
# (most frequent case)
multiprocessing = options.max_workers > 1

pool_maxsize = 30 # reqeusts default is 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

total_concurrent_requests = 500
num_workers = self._params.get("processes")

pool_maxsize = ceil(total_concurrent_requests / num_workers)
for 8 cores it is ~60

pool_maxsize = int(runtime_parameters.get("DR_OTEL_SESSION_POOL_MAXSIZE"))

session = requests.Session()
adapter = requests.adapters.HTTPAdapter(pool_maxsize=pool_maxsize)
Copy link
Contributor

@s-gavrenkov s-gavrenkov Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Custom adapter with default timeout
class TimeoutHTTPAdapter(requests.adapters.HTTPAdapter):
    def __init__(self, *args, timeout=5, **kwargs):
        self.timeout = timeout
        super().__init__(*args, **kwargs)

    def send(self, request, **kwargs):
        kwargs["timeout"] = kwargs.get("timeout", self.timeout)
        return super().send(request, **kwargs)

adapter = TimeoutHTTPAdapter(pool_maxsize=pool_maxsize, timeout=5)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably need timeout

Copy link
Contributor

@s-gavrenkov s-gavrenkov Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or

class TimeoutSession(requests.Session):
    def __init__(self, timeout=(5, 15)):
        super().__init__()
        self._timeout = timeout

    def request(self, *args, **kwargs):
        kwargs.setdefault("timeout", self._timeout)
        return super().request(*args, **kwargs)

# Example usage:
pool_maxsize = 10  # or any desired value
session = TimeoutSession(timeout=(5, 15))
adapter = HTTPAdapter(pool_maxsize=pool_maxsize)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default timeout is 10 sec.

Copy link
Contributor

@s-gavrenkov s-gavrenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check timeouts.

s-gavrenkov
s-gavrenkov approved these changes Aug 28, 2025
Copy link
Contributor

@s-gavrenkov s-gavrenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants