[Checkins] SVN: ZODB/branches/jim-thready/src/ZEO/ Tweaked to get slightly better performance when commiting lots of

Jim Fulton jim at zope.com
Tue Jan 26 18:33:33 EST 2010


Log message for revision 108539:
  Tweaked to get slightly better performance when commiting lots of
  transactions.
  

Changed:
  U   ZODB/branches/jim-thready/src/ZEO/tests/testZEO.py
  U   ZODB/branches/jim-thready/src/ZEO/tests/testZEO2.py
  U   ZODB/branches/jim-thready/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/branches/jim-thready/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/branches/jim-thready/src/ZEO/tests/testZEO.py	2010-01-26 19:49:27 UTC (rev 108538)
+++ ZODB/branches/jim-thready/src/ZEO/tests/testZEO.py	2010-01-26 23:33:33 UTC (rev 108539)
@@ -797,7 +797,7 @@
 
     def tpc_finish(self, transaction, func = lambda: None):
         self.server.tpc_finish(id(transaction)).set_sender(
-            0, (lambda msgid, ret: None), None)
+            0, (lambda msgid, ret, im=None: None), None)
 
 
 def multiple_storages_invalidation_queue_is_not_insane():

Modified: ZODB/branches/jim-thready/src/ZEO/tests/testZEO2.py
===================================================================
--- ZODB/branches/jim-thready/src/ZEO/tests/testZEO2.py	2010-01-26 19:49:27 UTC (rev 108538)
+++ ZODB/branches/jim-thready/src/ZEO/tests/testZEO2.py	2010-01-26 23:33:33 UTC (rev 108539)
@@ -78,7 +78,7 @@
     >>> zs2.storeBlobEnd(oid, serial, data, '1')
     >>> delay = zs2.vote('1')
 
-    >>> def send_reply(id, reply):
+    >>> def send_reply(id, reply, immediate=True):
     ...     print 'reply', id, reply
     >>> delay.set_sender(1, send_reply, None)
 

Modified: ZODB/branches/jim-thready/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/jim-thready/src/ZEO/zrpc/connection.py	2010-01-26 19:49:27 UTC (rev 108538)
+++ ZODB/branches/jim-thready/src/ZEO/zrpc/connection.py	2010-01-26 23:33:33 UTC (rev 108539)
@@ -205,7 +205,7 @@
 
     def set_sender(self, msgid, send_reply, return_error):
         reply, callback = self.args
-        send_reply(msgid, reply)
+        send_reply(msgid, reply, False)
         callback()
 
 class MTDelay(Delay):
@@ -634,7 +634,7 @@
                  level=logging.ERROR, exc_info=True)
         self.close()
 
-    def send_reply(self, msgid, ret):
+    def send_reply(self, msgid, ret, poll=True):
         # encode() can pass on a wide variety of exceptions from cPickle.
         # While a bare `except` is generally poor practice, in this case
         # it's acceptable -- we really do want to catch every exception
@@ -649,7 +649,10 @@
             err = ZRPCError("Couldn't pickle return %.100s" % r)
             msg = self.marshal.encode(msgid, 0, REPLY, (ZRPCError, err))
         self.message_output(msg)
-        self.poll()
+        if poll:
+            self.poll()
+        else:
+            self.trigger.pull_trigger()
 
     def return_error(self, msgid, flags, err_type, err_value):
         if flags & ASYNC:
@@ -748,7 +751,7 @@
         if self.closed:
             raise DisconnectedError()
         self.send_call(method, args, ASYNC)
-        self.poll()
+        self.trigger.pull_trigger()
 
     def callAsyncNoPoll(self, method, *args):
         # Like CallAsync but doesn't poll.  This exists so that we can
@@ -818,7 +821,7 @@
 
     def __init__(self, sock, addr, obj, mgr):
         self.mgr = mgr
-        map={}
+        map = {}
         Connection.__init__(self, sock, addr, obj, 'S', map=map)
         self.marshal = ServerMarshaller()
         self.trigger = trigger(map)



More information about the checkins mailing list