Enhancement #2531

Enhancement #2195: Implement Spread connection pooling

Spread connection pooling for listeners [Python]

Added by J. Moringen about 8 years ago. Updated about 6 years ago.

Status:ResolvedStart date:04/15/2016
Priority:NormalDue date:
Assignee:J. Moringen% Done:

100%

Category:Python
Target version:rsb-0.18

Associated revisions

Revision dc5e89ec
Added by J. Moringen about 6 years ago

Added ScopeDispatcher in rsb/eventprocessing.py

refs #2531

  • rsb/eventprocessing.py (header): updated copyright
    (ScopeDispatcher): new class; maintains a map of scopes to sinks
  • test/eventprocessing_test.py (ScopeDispatcherTest): new test case;
    for ScopeDispatcher class

Revision fd01ee44
Added by J. Moringen about 6 years ago

Removed RefCountingSpreadConnection in rsb/transport/rsbspread/__init__.py

refs #2531

  • rsb/transport/rsbspread/__init__.py (RefCountingSpreadConnection):
    removed; will be replaced by full Spread connection sharing
    (TransportFactory.__getSharedConnection): likewise
    (TransportFactory.createOutConnector): create SpreadConnection
    without sharing

Revision 26449fb1
Added by J. Moringen about 6 years ago

Spread connection sharing in rsb/transport/rsbspread/__init__.py

fixes #2531

A new class Bus manages one Spread connection and its group
memberships. One or more connectors are attached to the Bus and
notifications are routed between the Spread connection and the
attached connectors:

  • Notifications originating from OutConnectors are sent via the Spread
    connection and dispatched to In{Push,Pull}Connectors with matching
    scopes
  • Notifications received via the Spread connection are dispatched to
    In{Push,Pull}Connectors with matching scopes

The lifecycle of Bus objects is driven by reference counting. The
TransportFactory class creates Bus objects as needed which start out
with a reference count of 1. Each connector that is removed from its
Bus object decreases the reference count by 1. When the reference
count reaches 0, the Bus object deactivates its Spread connection and
self-destructs.

  • rsb/transport/rsbspread/__init__.py (import Queue): new import;
    needed for InPullConnector
    (Notification): new class; superclass for notification
    representations
    (IncomingNotification): new class; represents incoming notifications
    (OutgoingNotification): new class; represents outgoing notifications
    (DeserializingHandler.handleMessage): return an IncomingNotification
    object instead of a tuple
    (Bus): new class; manages a Spread connection and Spread group
    memberships; dispatches events to local connectors as well as the
    Spread connection
    (Connector.__init__): changed parameter connection -> bus; changed
    attribute connection -> _bus
    (Connector.getBus): renamed get{Connection -> Bus}
    (Connector.bus): renamed connection -> busch
    (Connector.activate): do not activate connection
    (Connector.deactivate): do not deactivate connection; call Bus.unref
    method instead
    (Connector.getTransportURL): call Bus.getTransportURL
    (InConnector.
    _init
    ): removed memberships attribute; now handled
    by Bus class
    (InConnector.activate): removed Memberships.join call; replaced by
    Bus.addSink call
    (InConnector.deactivate): similar
    (InConnector.notificationToEvent): operate on Notification objects
    instead of tuples
    (InPushConnector.__init
    ): removed receive{Thread,Task}
    attributes; now handled by Bus
    (InPushConnector.activate): removed method; now handled by Bus
    (InpushConnector.deactivate): likewise
    (InPushConnector.handleNotification): renamed
    handleIncomingNotification -> handleNotification
    (InPullConnector.
    _init
    ): removed deserializingHandler
    attribute; now handled by Bus; added _queue attribute
    (InPullConnector.raiseEvent): pop events from __queue instead of
    receiving from a Spread connection
    (InPullConnector.handleNotification): new method; push events onto
    __queue
    (OutConnector.handle): do not send messages via Spread connection;
    instead, construct OutgoingNotification object and submit to bus for
    sending
    (TransportFactory.
    _init
    ): added attributes __logger, __buses and
    __lock
    (TransportFactory.obtainBus): new method; find an reference an
    existing Bus instance or create and register a new one
    (TransportFactory.createInPushConnector): use obtainBus
    (TransportFactory.createInPullConnector): likewise
    (TransportFactory.createOutConnector): likewise
  • test/rsbspread_test.py (getConnector): construct and activate a Bus
    object and pass it to the connector

Revision 90601d9f
Added by J. Moringen about 6 years ago

Mention full Spread connection sharing in Python in news.rst

refs #2531

  • news.rst (RSB 0.18): mention full Spread connection sharing in
    Python implementation

History

#1 Updated by J. Moringen almost 8 years ago

  • Target version changed from rsb-0.14 to rsb-0.15

#2 Updated by J. Moringen over 7 years ago

  • Target version changed from rsb-0.15 to rsb-0.16

#3 Updated by J. Moringen about 7 years ago

  • Target version changed from rsb-0.16 to rsb-0.17

#4 Updated by J. Moringen over 6 years ago

  • Target version changed from rsb-0.17 to rsb-0.18

#5 Updated by J. Moringen about 6 years ago

  • Status changed from New to In Progress
  • Assignee set to J. Moringen
  • % Done changed from 0 to 50

#6 Updated by J. Moringen about 6 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100

Also available in: Atom PDF