[Zodb-checkins] CVS: ZODB3/ZEO - simul.py:1.12.8.2.18.16
Tim Peters
cvs-admin at zope.org
Sat Dec 6 01:03:49 EST 2003
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv27714/ZEO
Modified Files:
Tag: Zope-2_6-branch
simul.py
Log Message:
Thor: Woo hoo! On zope.org-main, the 50MB hit rate zooms from 44.4% to
62.1%, and at 100MB from 69.6% to 75.3%. This comes from giving smaller
new objects higher initial worth than larger new objects. Before, it
gave all new objects worth 0, but in steady state I think that means
a new object has a very hard time surviving (the most recent object
added is in the lowest-worth bucket then, so is a candidate for immediate
eviction).
=== ZODB3/ZEO/simul.py 1.12.8.2.18.15 => 1.12.8.2.18.16 ===
--- ZODB3/ZEO/simul.py:1.12.8.2.18.15 Fri Dec 5 12:23:22 2003
+++ ZODB3/ZEO/simul.py Sat Dec 6 01:03:48 2003
@@ -33,6 +33,7 @@
import time
import getopt
import struct
+import math
from sets import Set
@@ -624,7 +625,7 @@
self.insert(oid, size)
else:
self.insert(oid, size)
-
+
def insert(self, oid, size):
# New objects enter the cache via a1in. If they
# are frequently used over a long enough time, they
@@ -1587,7 +1588,11 @@
object.linkbefore(self.currentobj)
if object.worth is None:
- object.worth = 0
+ # Give smaller objects higher initial worth. This favors kicking
+ # out unreferenced large objects before kicking out unreferenced
+ # small objects. On real life traces, this is a significant
+ # win for the hit rate.
+ object.worth = 32 - int(round(math.log(object.size, 2)))
self.worthsets[object.worth].add(object)
# Decrease the worth of the current object, and advance the
More information about the Zodb-checkins
mailing list