[Zope-Checkins] CVS: ZODB3/ZEO - simul.py:1.12.8.2.18.11

Tim Peters cvs-admin at zope.org
Thu Dec 4 21:43:56 EST 2003


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv2325/ZEO

Modified Files:
      Tag: Zope-2_6-branch
	simul.py 
Log Message:
Thor:  When writing new data for an oid in cache, retain its old
worth byte instead of treating it like a brand new object.  This boosts
the 100MB hit rate from 55.1% to 55.4%.


=== ZODB3/ZEO/simul.py 1.12.8.2.18.10 => 1.12.8.2.18.11 ===
--- ZODB3/ZEO/simul.py:1.12.8.2.18.10	Thu Dec  4 21:16:41 2003
+++ ZODB3/ZEO/simul.py	Thu Dec  4 21:43:55 2003
@@ -1566,16 +1566,19 @@
         self.currentsize += object.size
         object.linkbefore(self.currentobj)
 
-        # Give new object an intial worth roughly equal to the log
-        # (base 2) of its size.  The intuition is that larger objects
-        # are more expensive to fetch over the network, so are worth
-        # more (at least at first).
-        worth = 0
-        targetsize = 1
-        while object.size > targetsize:
-            worth += 1
-            targetsize <<= 1
-        object.worth = worth
+        worth = object.worth
+        if worth is None:
+            # Give new object an intial worth roughly equal to the log
+            # (base 2) of its size.  The intuition is that larger objects
+            # are more expensive to fetch over the network, so are worth
+            # more (at least at first).
+            worth = 0
+            targetsize = 1
+            while object.size > targetsize:
+                worth += 1
+                targetsize <<= 1
+            object.worth = worth
+
         self.worthsets[worth].add(object)
 
     # Decrease the worth of the current object, and advance the
@@ -1632,9 +1635,11 @@
 
     def write(self, oid, size):
         obj = self.oid2object.get(oid)
+        worth = None
         if obj is not None:
+            worth = obj.worth
             self._evict_without_bumping_evict_stats(obj)
-        self.add(ThorNode(oid, size))
+        self.add(ThorNode(oid, size, worth))
 
     def load(self, oid, size):
         if self.access(oid) is not None:




More information about the Zope-Checkins mailing list