From commits-return-33980-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Thu Apr 26 14:31:35 2012 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B89959E8D for ; Thu, 26 Apr 2012 14:31:35 +0000 (UTC) Received: (qmail 12532 invoked by uid 500); 26 Apr 2012 14:31:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 12501 invoked by uid 500); 26 Apr 2012 14:31:34 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 12493 invoked by uid 99); 26 Apr 2012 14:31:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2012 14:31:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2012 14:31:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 66FF72388847 for ; Thu, 26 Apr 2012 14:31:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120426143113.66FF72388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); + } }