jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1002657 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state: NodeState.java PropertyState.java
Date Wed, 29 Sep 2010 14:38:52 GMT
Author: jukka
Date: Wed Sep 29 14:38:52 2010
New Revision: 1002657

URL: http://svn.apache.org/viewvc?rev=1002657&view=rev
Log:
JCR-2699: Improve read/write concurrency

Revert the item state size estimate fixes from revision 1002084, as they may end up destabilizing
the memory optimizations in downstream deployments.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=1002657&r1=1002656&r2=1002657&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Wed Sep 29 14:38:52 2010
@@ -862,28 +862,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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java?rev=1002657&r1=1002656&r2=1002657&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
Wed Sep 29 14:38:52 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;
     }
 
 }



Mime
View raw message