[jboss-cvs] JBoss Messaging SVN: r7111 - 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 17:35:56 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-05-28 17:35:56 -0400 (Thu, 28 May 2009)
New Revision: 7111

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 21:29:05 UTC (rev 7110)
+++ branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java	2009-05-28 21:35:56 UTC (rev 7111)
@@ -50,15 +50,19 @@
    // Attributes ----------------------------------------------------
 
    private final long NUM_RECORDS = 100000;
-   
+
    private final long WARMUP_RECORDS = 1000;
-   
+
    private int SIZE_RECORD = 1000;
-   
+
    private final byte ADD_RECORD = 1;
+
    private final byte UPDATE1 = 2;
-   private final byte UPDATE2 = 3;
-   
+
+   private final int ITERATIONS = 1;
+
+   private final boolean PERFORM_UPDATE = false;
+
    private static final LoadManager dummyLoader = new LoadManager()
    {
 
@@ -79,7 +83,6 @@
       }
    };
 
-
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -98,15 +101,12 @@
 
    protected void tearDown() throws Exception
    {
-      //super.tearDown();
+      // super.tearDown();
    }
-   
-   
-   int ITERATIONS = 1;
-   
-   public void testAddUpdateAIO() throws Exception
+
+   public void testAIO() throws Exception
    {
-      for (int i = 0 ; i < ITERATIONS; i++)
+      for (int i = 0; i < ITERATIONS; i++)
       {
          if (i > 0)
          {
@@ -115,14 +115,14 @@
          }
 
          System.out.println("Test AIO # " + i);
-         testAddUpdate(new AIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
-         
+         testJournal(new AIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
+
       }
    }
 
-   public void testAddUpdateNIO() throws Exception
+   public void testNIO() throws Exception
    {
-      for (int i = 0 ; i < ITERATIONS; i++)
+      for (int i = 0; i < ITERATIONS; i++)
       {
          if (i > 0)
          {
@@ -130,57 +130,62 @@
             setUp();
          }
          System.out.println("Test NIO # " + i);
-         testAddUpdate(new NIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
+         testJournal(new NIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
          tearDown();
          setUp();
       }
    }
 
-   public void testAddUpdate(SequentialFileFactory fileFactory, long records, int size) throws Exception
+   public void testJournal(SequentialFileFactory fileFactory, long records, int size) throws Exception
    {
-      
+
       JournalImpl journal = new JournalImpl(10 * 1024 * 1024, // 10M.. we believe that's the usual cilinder
-                                                                     // size.. not an exact science here
-                                                   30, // number of files pre-allocated
-                                                   true, // sync on commit
-                                                   false, // no sync on non transactional
-                                                   fileFactory, // AIO or NIO
-                                                   "jbm", // file name
-                                                   "jbm", // extension
-                                                   20000, // it's like a semaphore for callback on the AIO layer
-                                                   size + 1024); // avg buffer size.. it will reuse any buffer smaller than
-                                                              // this during record writes
-      
+                                            // size.. not an exact science here
+                                            30, // number of files pre-allocated
+                                            true, // sync on commit
+                                            false, // no sync on non transactional
+                                            fileFactory, // AIO or NIO
+                                            "jbm", // file name
+                                            "jbm", // extension
+                                            20000, // it's like a semaphore for callback on the AIO layer
+                                            size + 1024); // avg buffer size.. it will reuse any buffer smaller than
+      // this during record writes
+
       journal.start();
       journal.load(dummyLoader);
-      
+
       FakeMessage msg = new FakeMessage(size);
       FakeQueueEncoding update = new FakeQueueEncoding();
-      
+
       long timeStart = System.currentTimeMillis();
-      for (long i = 0 ; i < records; i++)
+      for (long i = 0; i < records; i++)
       {
          if (i == WARMUP_RECORDS)
          {
             timeStart = System.currentTimeMillis();
          }
          journal.appendAddRecord(i, ADD_RECORD, msg);
-         journal.appendUpdateRecord(i, UPDATE1, update);
+         if (PERFORM_UPDATE)
+         {
+            journal.appendUpdateRecord(i, UPDATE1, update);
+         }
       }
-      
-      
+
       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
    {
       final int size;
-      
+
       byte buffer[];
-      
+
       FakeMessage(int size)
       {
          this.size = size;
@@ -203,9 +208,9 @@
       {
          return size;
       }
-      
+
    }
-   
+
    private static class FakeQueueEncoding implements EncodingSupport
    {
       long queueID;
@@ -236,7 +241,6 @@
          return 8;
       }
    }
-   
 
    // Package protected ---------------------------------------------
 




More information about the jboss-cvs-commits mailing list