Class ConnectionPool

A maximum sized pool of Comm objects.

Declaration

class ConnectionPool
source link

Documentation

This provides a connect method that mirrors the normal distributed.connect
method, but provides connection sharing and tracks connection limits.

This object provides an ``rpc`` like interface::

    >>> rpc = ConnectionPool(limit=512)
    >>> scheduler = rpc('127.0.0.1:8786')
    >>> workers = [rpc(address) for address ...]

    >>> info = yield scheduler.identity()

It creates enough comms to satisfy concurrent connections to any
particular address::

    >>> a, b = yield [scheduler.who_has(), scheduler.has_what()]

It reuses existing comms so that we don't have to continuously reconnect.

It also maintains a comm limit to avoid "too many open file handle"
issues.  Whenever this maximum is reached we clear out all idling comms.
If that doesn't do the trick then we wait until one of the occupied comms
closes.

Attributes

Methods

Subclasses

Reexports