directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1330870 - /directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
Date Thu, 26 Apr 2012 14:31:13 GMT
Author: elecharny
Date: Thu Apr 26 14:31:13 2012
New Revision: 1330870

URL: http://svn.apache.org/viewvc?rev=1330870&view=rev
Log:
Added OneLevel and SubLevel perf tests

Modified:
    directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java

Modified: directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java?rev=1330870&r1=1330869&r2=1330870&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
(original)
+++ directory/apacheds/branches/index-work/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
Thu Apr 26 14:31:13 2012
@@ -47,7 +47,7 @@ public class SearchPerfIT extends Abstra
     * A basic search for one single entry
     */
     @Test
-    public void testSearchPerf() throws Exception
+    public void testSearchPerfObjectScope() throws Exception
     {
         LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
 
@@ -98,4 +98,118 @@ public class SearchPerfIT extends Abstra
             + " per s ) /" + ( t1 - t0 ) );
         connection.close();
     }
+
+
+    /**
+    * A basic search for one single entry
+    */
+    @Test
+    public void testSearchPerfOneLevelScope() throws Exception
+    {
+        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+        EntryCursor cursor = connection.search( "ou=system", "(ObjectClass=*)",
+            SearchScope.ONELEVEL, "*" );
+
+        int i = 0;
+
+        while ( cursor.next() )
+        {
+            Entry entry = cursor.get();
+            ++i;
+        }
+
+        cursor.close();
+
+        assertEquals( 5, i );
+
+        int nbIterations = 1500000;
+
+        long t0 = System.currentTimeMillis();
+        long t00 = 0L;
+        long tt0 = System.currentTimeMillis();
+
+        for ( i = 0; i < nbIterations; i++ )
+        {
+            if ( i % 100000 == 0 )
+            {
+                long tt1 = System.currentTimeMillis();
+
+                System.out.println( i + ", " + ( tt1 - tt0 ) );
+                tt0 = tt1;
+            }
+
+            if ( i == 50000 )
+            {
+                t00 = System.currentTimeMillis();
+            }
+
+            cursor = connection.search( "ou=system", "(ObjectClass=*)", SearchScope.ONELEVEL,
"*" );
+            cursor.close();
+        }
+
+        long t1 = System.currentTimeMillis();
+
+        Long deltaWarmed = ( t1 - t00 );
+        System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000
) * 1000 ) / deltaWarmed )
+            + " per s ) /" + ( t1 - t0 ) );
+        connection.close();
+    }
+
+
+    /**
+    * A basic search for one single entry
+    */
+    @Test
+    public void testSearchPerfSublevelScope() throws Exception
+    {
+        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+        EntryCursor cursor = connection.search( "ou=system", "(ObjectClass=*)",
+            SearchScope.SUBTREE, "*" );
+
+        int i = 0;
+
+        while ( cursor.next() )
+        {
+            Entry entry = cursor.get();
+            ++i;
+        }
+
+        cursor.close();
+
+        assertEquals( 10, i );
+
+        int nbIterations = 1500000;
+
+        long t0 = System.currentTimeMillis();
+        long t00 = 0L;
+        long tt0 = System.currentTimeMillis();
+
+        for ( i = 0; i < nbIterations; i++ )
+        {
+            if ( i % 100000 == 0 )
+            {
+                long tt1 = System.currentTimeMillis();
+
+                System.out.println( i + ", " + ( tt1 - tt0 ) );
+                tt0 = tt1;
+            }
+
+            if ( i == 50000 )
+            {
+                t00 = System.currentTimeMillis();
+            }
+
+            cursor = connection.search( "ou=system", "(ObjectClass=*)", SearchScope.SUBTREE,
"*" );
+            cursor.close();
+        }
+
+        long t1 = System.currentTimeMillis();
+
+        Long deltaWarmed = ( t1 - t00 );
+        System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000
) * 1000 ) / deltaWarmed )
+            + " per s ) /" + ( t1 - t0 ) );
+        connection.close();
+    }
 }



Mime
View raw message