directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1446593 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/
Date Fri, 15 Feb 2013 14:22:00 GMT
Author: elecharny
Date: Fri Feb 15 14:22:00 2013
New Revision: 1446593

URL: http://svn.apache.org/r1446593
Log:
o Added a counte rof commmits done
o Only commit after N operation (depending on the previous counter
o Synchronizes only after M transactions
Those changes improve the server performance additions by x3.5

Modified:
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1446593&r1=1446592&r2=1446593&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
Fri Feb 15 14:22:00 2013
@@ -162,7 +162,7 @@ public class JdbmIndex<K, V> extends Abs
 
         BaseRecordManager base = new BaseRecordManager( path );
         TransactionManager transactionManager = base.getTransactionManager();
-        transactionManager.setMaximumTransactionsInLog( 200 );
+        transactionManager.setMaximumTransactionsInLog( 2000 );
 
         recMan = new CacheRecordManager( base, new MRU( DEFAULT_INDEX_CACHE_SIZE ) );
 
@@ -669,7 +669,7 @@ public class JdbmIndex<K, V> extends Abs
             reverse.close();
         }
 
-        recMan.commit();
+        commit( recMan );
         recMan.close();
     }
 
@@ -679,7 +679,7 @@ public class JdbmIndex<K, V> extends Abs
      */
     public synchronized void sync() throws IOException
     {
-        recMan.commit();
+        commit( recMan );
     }
 
 
@@ -700,6 +700,20 @@ public class JdbmIndex<K, V> extends Abs
 
 
     /**
+     * Commit the modification on disk
+     * 
+     * @param recordManager The recordManager used for the commit
+     */
+    private void commit( RecordManager recordManager ) throws IOException
+    {
+        if ( commitNumber.incrementAndGet() % 4000 == 0 )
+        {
+            recordManager.commit();
+        }
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1446593&r1=1446592&r2=1446593&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Fri Feb 15 14:22:00 2013
@@ -157,7 +157,7 @@ public class JdbmPartition extends Abstr
 
             BaseRecordManager base = new BaseRecordManager( path );
             TransactionManager transactionManager = base.getTransactionManager();
-            transactionManager.setMaximumTransactionsInLog( 200 );
+            transactionManager.setMaximumTransactionsInLog( 2000 );
 
             if ( cacheSize < 0 )
             {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1446593&r1=1446592&r2=1446593&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
Fri Feb 15 14:22:00 2013
@@ -88,7 +88,7 @@ public class JdbmRdnIndex extends JdbmIn
         //System.out.println( "IDX Created index " + path )
         BaseRecordManager base = new BaseRecordManager( path );
         TransactionManager transactionManager = base.getTransactionManager();
-        transactionManager.setMaximumTransactionsInLog( 200 );
+        transactionManager.setMaximumTransactionsInLog( 2000 );
 
         recMan = new CacheRecordManager( base, new MRU( cacheSize ) );
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=1446593&r1=1446592&r2=1446593&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Fri Feb 15 14:22:00 2013
@@ -585,7 +585,7 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Add ONE {} = {}", name, key );
                 }
 
-                recMan.commit();
+                commit( recMan );
 
                 return;
             }
@@ -624,7 +624,7 @@ public class JdbmTable<K, V> extends Abs
                 }
 
                 count++;
-                recMan.commit();
+                commit( recMan );
 
                 return;
             }
@@ -642,7 +642,7 @@ public class JdbmTable<K, V> extends Abs
                 LOG.debug( "<--- Add BTREE {} = {}", name, key );
             }
 
-            recMan.commit();
+            commit( recMan );
         }
         catch ( Exception e )
         {
@@ -691,7 +691,7 @@ public class JdbmTable<K, V> extends Abs
                         LOG.debug( "<--- Remove ONE " + name + " = " + key + ", " + value
);
                     }
 
-                    recMan.commit();
+                    commit( recMan );
 
                     return;
                 }
@@ -724,7 +724,7 @@ public class JdbmTable<K, V> extends Abs
                         LOG.debug( "<--- Remove AVL " + name + " = " + key + ", " + value
);
                     }
 
-                    recMan.commit();
+                    commit( recMan );
 
                     return;
                 }
@@ -755,7 +755,7 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Remove BTREE " + name + " = " + key + ", " + value
);
                 }
 
-                recMan.commit();
+                commit( recMan );
 
                 return;
             }
@@ -805,7 +805,7 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Remove ONE {} = {}", name, key );
                 }
 
-                recMan.commit();
+                commit( recMan );
 
                 return;
             }
@@ -825,7 +825,7 @@ public class JdbmTable<K, V> extends Abs
                 recMan.delete( tree.getRecordId() );
                 duplicateBtrees.remove( tree.getRecordId() );
 
-                recMan.commit();
+                commit( recMan );
 
                 return;
             }
@@ -839,7 +839,7 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Remove AVL {} = {}", name, key );
                 }
 
-                recMan.commit();
+                commit( recMan );
 
                 return;
             }
@@ -956,8 +956,7 @@ public class JdbmTable<K, V> extends Abs
     {
         long recId = recMan.getNamedObject( name + SZSUFFIX );
         recMan.update( recId, count );
-        recMan.commit();
-
+        commit( recMan );
     }
 
 
@@ -1135,4 +1134,18 @@ public class JdbmTable<K, V> extends Abs
 
         return bTree;
     }
+
+
+    /**
+     * Commit the modification on disk
+     * 
+     * @param recordManager The recordManager used for the commit
+     */
+    private void commit( RecordManager recordManager ) throws IOException
+    {
+        if ( commitNumber.incrementAndGet() % 4000 == 0 )
+        {
+            recordManager.commit();
+        }
+    }
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java?rev=1446593&r1=1446592&r2=1446593&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java
Fri Feb 15 14:22:00 2013
@@ -20,6 +20,8 @@
 package org.apache.directory.server.xdbm;
 
 
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.server.i18n.I18n;
 
@@ -47,6 +49,10 @@ public abstract class AbstractIndex<K, O
     /** Tells if this index has a Reverse table */
     protected boolean withReverse;
 
+    /** A counter used to differ the commit on disk after N operations */
+    protected AtomicInteger commitNumber;
+
+
     /**
      * Creates a new instance of AbstractIndex.
      * 
@@ -54,10 +60,10 @@ public abstract class AbstractIndex<K, O
      */
     protected AbstractIndex()
     {
-        this.withReverse = true;
+        this( null, true );
     }
 
-    
+
     /**
      * Creates a new instance of AbstractIndex.
      * 
@@ -65,7 +71,7 @@ public abstract class AbstractIndex<K, O
      */
     protected AbstractIndex( boolean withReverse )
     {
-        this.withReverse = withReverse;
+        this( null, withReverse );
     }
 
 
@@ -78,6 +84,7 @@ public abstract class AbstractIndex<K, O
     {
         this.attributeId = attributeId;
         this.withReverse = withReverse;
+        commitNumber = new AtomicInteger( 0 );
     }
 
 
@@ -147,8 +154,8 @@ public abstract class AbstractIndex<K, O
             throw new IllegalStateException( I18n.err( I18n.ERR_575, property ) );
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java?rev=1446593&r1=1446592&r2=1446593&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java
Fri Feb 15 14:22:00 2013
@@ -22,6 +22,7 @@ package org.apache.directory.server.xdbm
 
 import java.io.IOException;
 import java.util.Comparator;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.server.i18n.I18n;
@@ -55,6 +56,10 @@ public abstract class AbstractTable<K, V
     /** whether or not this table allows for duplicates */
     protected boolean allowsDuplicates;
 
+    /** A counter used to differ the commit on disk after N operations */
+    protected AtomicInteger commitNumber;
+
+
     /**
      * Create an instance of Table
      * 
@@ -79,6 +84,8 @@ public abstract class AbstractTable<K, V
         }
 
         this.valueComparator = valueComparator;
+
+        commitNumber = new AtomicInteger( 0 );
     }
 
 



Mime
View raw message