[jboss-cvs] JBoss Messaging SVN: r7109 - branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 28 16:39:35 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-05-28 16:39:35 -0400 (Thu, 28 May 2009)
New Revision: 7109

Modified:
   branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java
Log:
tweaks

Modified: branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java	2009-05-28 19:33:22 UTC (rev 7108)
+++ branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java	2009-05-28 20:39:35 UTC (rev 7109)
@@ -49,14 +49,35 @@
 
    // Attributes ----------------------------------------------------
 
-   long NUM_RECORDS = 100000;
+   private final long NUM_RECORDS = 100000;
    
-   long WARMUP_RECORDS = 1000;
+   private final long WARMUP_RECORDS = 1000;
    
-   byte ADD_RECORD = 1;
-   byte UPDATE1 = 2;
-   byte UPDATE2 = 3;
+   private final byte ADD_RECORD = 1;
+   private final byte UPDATE1 = 2;
+   private final byte UPDATE2 = 3;
    
+   private static final LoadManager dummyLoader = new LoadManager()
+   {
+
+      public void addPreparedTransaction(final PreparedTransactionInfo preparedTransaction)
+      {
+      }
+
+      public void addRecord(final RecordInfo info)
+      {
+      }
+
+      public void deleteRecord(final long id)
+      {
+      }
+
+      public void updateRecord(final RecordInfo info)
+      {
+      }
+   };
+
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -81,49 +102,53 @@
    
    public void testAddUpdateAIO() throws Exception
    {
-      testAddUpdate(new AIOSequentialFileFactory(getTestDir()));
+      for (int i = 0 ; i < 1; i++)
+      {
+         if (i > 0)
+         {
+            tearDown();
+            setUp();
+         }
+
+         System.out.println("Test AIO # " + i);
+         testAddUpdate(new AIOSequentialFileFactory(getTestDir()));
+         
+      }
    }
 
    public void testAddUpdateNIO() throws Exception
    {
-      testAddUpdate(new NIOSequentialFileFactory(getTestDir()));
+      for (int i = 0 ; i < 10; i++)
+      {
+         if (i > 0)
+         {
+            tearDown();
+            setUp();
+         }
+         System.out.println("Test NIO # " + i);
+         testAddUpdate(new NIOSequentialFileFactory(getTestDir()));
+         tearDown();
+         setUp();
+      }
    }
 
    public void testAddUpdate(SequentialFileFactory fileFactory) throws Exception
    {
+      
       JournalImpl journal = new JournalImpl(10 * 1024 * 1024, // 10M.. we believe that's the usual cilinder
                                                                      // size.. not an exact science here
-                                                   10, // number of files pre-allocated
+                                                   30, // number of files pre-allocated
                                                    true, // sync on commit
                                                    false, // no sync on non transactional
                                                    fileFactory, // AIO or NIO
-                                                   "exjournal", // file name
-                                                   "dat", // extension
-                                                   10000, // it's like a semaphore for callback on the AIO layer
+                                                   "jbm", // file name
+                                                   "jbm", // extension
+                                                   20000, // it's like a semaphore for callback on the AIO layer
                                                    5 * 1024); // avg buffer size.. it will reuse any buffer smaller than
                                                               // this during record writes
       
       journal.start();
-      journal.load(new LoadManager()
-      {
-
-         public void addPreparedTransaction(PreparedTransactionInfo preparedTransaction)
-         {
-         }
-
-         public void addRecord(RecordInfo info)
-         {
-         }
-
-         public void deleteRecord(long id)
-         {
-         }
-
-         public void updateRecord(RecordInfo info)
-         {
-         }
-         
-      });
+      journal.load(dummyLoader);
       
       FakeMessage msg = new FakeMessage();
       FakeQueueEncoding update = new FakeQueueEncoding();
@@ -142,9 +167,8 @@
       
       journal.stop();
       
+      System.out.println("Produced records " + (NUM_RECORDS - WARMUP_RECORDS) + " in " + (System.currentTimeMillis() - timeStart) + " milliseconds");
       
-      System.out.println("Produced records " + (NUM_RECORDS = WARMUP_RECORDS) + " in " + (System.currentTimeMillis() - timeStart) + " milliseconds");
-      
    }
    
    class FakeMessage implements EncodingSupport
@@ -156,7 +180,7 @@
 
       public void encode(MessagingBuffer buffer)
       {
-         buffer.writeBytes(new byte[1024]);
+         buffer.writeBytes(new byte[1100]);
       }
 
       /* (non-Javadoc)




More information about the jboss-cvs-commits mailing list