BUG 2518 : Throttle operations in a transaction 55/14155/4
authorMoiz Raja <moraja@cisco.com>
Wed, 14 Jan 2015 23:21:35 +0000 (15:21 -0800)
committerMoiz Raja <moraja@cisco.com>
Mon, 26 Jan 2015 10:49:35 +0000 (11:49 +0100)
commit7b963a588f2438b0d8cfe95e384ba36e417d925e
tree324cbf3179589a8fc873a8603a8f9b04fba540b6
parentfcf65d723ef53f8da2dd6347f41ce19016fc36e5
BUG 2518 : Throttle operations in a transaction

In some use cases a single transaction may do a lot of operations
in a short period of time. This happens for example when testing
the bgp-plugin. To ensure that clients do not overwhelm the datastore
this patch throttles operations on the transaction proxy side and
prevents the client from sending more operations than can be handled
by the ShardTransaction actor in a reasonable amount of time.

The throttling serves as a back-pressure mechanism. Akka recommends
that for back pressure we use a bounded mailbox with an adequate
push timeout. We are doing this. However the akka's behavior on the
timeout expiring is to send the throttled message to dead letters.
So to properly do what akka expects us to do we would need to watch
dead letters and use that as an indication that we need back pressure
which I think is inadequate for our purpose and thus the Semaphore
based throttling.

Change-Id: Ib1a0f128ffde009a82b8cd67001203e0b959fdf5
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java