diff options
author | Rafael H. Schloming <rhs@apache.org> | 2010-06-16 16:47:18 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2010-06-16 16:47:18 +0000 |
commit | e06516ab7638b0ee1351bf1374818b4e6184e362 (patch) | |
tree | 2b57570c3b14254e75140e4fe3bfee5a45506427 /python/qpid/messaging/endpoints.py | |
parent | b7dfc1a379178e746cee2519cd95a67bce0ae2d7 (diff) | |
download | qpid-python-e06516ab7638b0ee1351bf1374818b4e6184e362.tar.gz |
performance tweaks for receive: added configurable threshold for issuing credit; don't disable byte credit more than necessary; avoided n-squared loop for generating acks
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@955296 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/messaging/endpoints.py')
-rw-r--r-- | python/qpid/messaging/endpoints.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/python/qpid/messaging/endpoints.py b/python/qpid/messaging/endpoints.py index f5f957c821..707aee3ed6 100644 --- a/python/qpid/messaging/endpoints.py +++ b/python/qpid/messaging/endpoints.py @@ -29,6 +29,7 @@ Areas that still need work: """ from logging import getLogger +from math import ceil from qpid.codec010 import StringCodec from qpid.concurrency import synchronized, Waiter, Condition from qpid.datatypes import Serial, uuid4 @@ -843,6 +844,7 @@ class Receiver(object): self._lock = self.session._lock self._capacity = 0 self._set_capacity(options.get("capacity", 0), False) + self.threshold = 0.5 @synchronized def _set_capacity(self, c, wakeup=True): @@ -931,8 +933,9 @@ class Receiver(object): if msg is None: raise Empty() elif self._capacity not in (0, UNLIMITED.value): - self.granted += 1 - self._wakeup() + if self.received - self.returned <= int(ceil(self.threshold * self._capacity)): + self.granted = self.received + self._capacity + self._wakeup() return msg def _grant(self): |