jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1025964 - in /jackrabbit/branches/2.1: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/
Date Thu, 21 Oct 2010 12:04:44 GMT
Author: jukka
Date: Thu Oct 21 12:04:43 2010
New Revision: 1025964

URL: http://svn.apache.org/viewvc?rev=1025964&view=rev
Log:
2.1: Merged revisions 1002170, 1002589, 1002608 and 1002657 (JCR-2699)

Modified:
    jackrabbit/branches/2.1/   (props changed)
    jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
    jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
    jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java

Propchange: jackrabbit/branches/2.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 21 12:04:43 2010
@@ -2,4 +2,4 @@
 /jackrabbit/sandbox/JCR-1456:774917-886178
 /jackrabbit/sandbox/JCR-2170:812417-816332
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646,933694,934405,934412,934849,935557,936668,938099,945528,950440,950680,955222,955229,955307,955852,961487,961626,964362,965539,986682,986686,986715,991144,996810,1001707,1002065-1002066,1002084,1002101-1002102,1002168
+/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646,933694,934405,934412,934849,935557,936668,938099,945528,950440,950680,955222,955229,955307,955852,961487,961626,964362,965539,986682,986686,986715,991144,996810,1001707,1002065-1002066,1002084,1002101-1002102,1002168,1002170,1002589,1002608,1002657

Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java?rev=1025964&r1=1025963&r2=1025964&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
(original)
+++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
Thu Oct 21 12:04:43 2010
@@ -54,6 +54,11 @@ public class ItemStateReferenceCache imp
      */
     @SuppressWarnings("unchecked")
     private final Map<ItemId, ItemState> refs =
+        // I tried using soft instead of weak references here, but that
+        // seems to have some unexpected performance consequences (notable
+        // increase in the JCR TCK run time). So even though soft references
+        // are generally recommended over weak references for caching
+        // purposes, it seems that using weak references is safer here.
         new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
 
     /**

Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=1025964&r1=1025963&r2=1025964&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Thu Oct 21 12:04:43 2010
@@ -818,28 +818,20 @@ public class NodeState extends ItemState
     //-------------------------------------------------< misc. helper methods >
 
     /**
-     * {@inheritDoc}
+     * Returns an estimate of the memory size of this node state. The return
+     * value actually highly overestimates the amount of required memory, but
+     * changing the estimates would likely cause OOMs in many downstream
+     * deployments that have set their cache sizes based on experience with
+     * these erroneous size estimates. So we don't change the formula used
+     * by this method.
      */
     @Override
     public long calculateMemoryFootprint() {
-        /*
-        private Name nodeTypeName;
-        private Set mixinTypeNames = Collections.EMPTY_SET;
-        private NodeId id;
-        private NodeId parentId;
-        private ChildNodeEntries childNodeEntries = new ChildNodeEntries();
-        private HashSet propertyNames = new HashSet();
-        private boolean sharedSet = Set<NodeId>;
-        private boolean sharedSetRW = false;
-        private NodeStateListener listener = ...;
-
-        We assume only 16 bytes per name or node id,
-        as they are shared between states
-        ChildNodeEntries = 8 + n * (name(16) + index(4) + id(16) + hashentry(16)) ~ n*52
-        MixinTypeNames/PropNames = 8 + n * (name(16) + hashentry(16))
-        */
-        return 100 + mixinTypeNames.size() * 32 + childNodeEntries.size() * 52
-                + propertyNames.size() * 32;
+        // Don't change this formula! See javadoc above.
+        return 350
+            + mixinTypeNames.size() * 250
+            + childNodeEntries.size() * 300
+            + propertyNames.size() * 250;
     }
 
     /**

Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java?rev=1025964&r1=1025963&r2=1025964&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
(original)
+++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
Thu Oct 21 12:04:43 2010
@@ -194,23 +194,16 @@ public class PropertyState extends ItemS
     }
 
     /**
-     * {@inheritDoc}
+     * Returns an estimate of the memory size of this property state. The
+     * return value actually highly overestimates the amount of required
+     * memory, but changing the estimates would likely cause OOMs in many
+     * downstream deployments that have set their cache sizes based on
+     * experience with these erroneous size estimates. So we don't change
+     * the formula used by this method.
      */
     @Override
     public long calculateMemoryFootprint() {
-        /*
-        private PropertyId id;
-        private InternalValue[] values;
-        private int type;
-        private boolean multiValued;
-
-        We assume only 16 bytes per name or node id,
-        as they are shared between states
-        PropertyId = 8 + nodeId(16) + name(16) + hash(4) ~ 44;
-        InternalValue = 8 + n * (values) ~ 8 + n*100;
-        value=approx 100 bytes.
-        */
-        return 64 + values.length * 100;
+        return 350 + values.length * 100;
     }
 
 }

Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java?rev=1025964&r1=1025963&r2=1025964&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
(original)
+++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
Thu Oct 21 12:04:43 2010
@@ -71,7 +71,10 @@ public abstract class AbstractVISProvide
      */
     @SuppressWarnings("unchecked")
     private final Map<NodeId, NodeState> nodes =
-        new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
+        // Using soft references instead of weak ones seems to have
+        // some unexpected performance consequences, so for now it's
+        // better to stick with weak references.
+        new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
 
     /**
      * Listeners (weak references)



Mime
View raw message