[jboss-cvs] JBoss Messaging SVN: r7110 - 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:29:06 EDT 2009


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

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 20:39:35 UTC (rev 7109)
+++ branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java	2009-05-28 21:29:05 UTC (rev 7110)
@@ -53,6 +53,8 @@
    
    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;
@@ -100,9 +102,11 @@
    }
    
    
+   int ITERATIONS = 1;
+   
    public void testAddUpdateAIO() throws Exception
    {
-      for (int i = 0 ; i < 1; i++)
+      for (int i = 0 ; i < ITERATIONS; i++)
       {
          if (i > 0)
          {
@@ -111,14 +115,14 @@
          }
 
          System.out.println("Test AIO # " + i);
-         testAddUpdate(new AIOSequentialFileFactory(getTestDir()));
+         testAddUpdate(new AIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
          
       }
    }
 
    public void testAddUpdateNIO() throws Exception
    {
-      for (int i = 0 ; i < 10; i++)
+      for (int i = 0 ; i < ITERATIONS; i++)
       {
          if (i > 0)
          {
@@ -126,13 +130,13 @@
             setUp();
          }
          System.out.println("Test NIO # " + i);
-         testAddUpdate(new NIOSequentialFileFactory(getTestDir()));
+         testAddUpdate(new NIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
          tearDown();
          setUp();
       }
    }
 
-   public void testAddUpdate(SequentialFileFactory fileFactory) throws Exception
+   public void testAddUpdate(SequentialFileFactory fileFactory, long records, int size) throws Exception
    {
       
       JournalImpl journal = new JournalImpl(10 * 1024 * 1024, // 10M.. we believe that's the usual cilinder
@@ -144,17 +148,17 @@
                                                    "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
+                                                   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();
+      FakeMessage msg = new FakeMessage(size);
       FakeQueueEncoding update = new FakeQueueEncoding();
       
       long timeStart = System.currentTimeMillis();
-      for (long i = 0 ; i < NUM_RECORDS; i++)
+      for (long i = 0 ; i < records; i++)
       {
          if (i == WARMUP_RECORDS)
          {
@@ -173,6 +177,15 @@
    
    class FakeMessage implements EncodingSupport
    {
+      final int size;
+      
+      byte buffer[];
+      
+      FakeMessage(int size)
+      {
+         this.size = size;
+         buffer = new byte[size];
+      }
 
       public void decode(MessagingBuffer buffer)
       {
@@ -180,7 +193,7 @@
 
       public void encode(MessagingBuffer buffer)
       {
-         buffer.writeBytes(new byte[1100]);
+         buffer.writeBytes(new byte[size]);
       }
 
       /* (non-Javadoc)
@@ -188,7 +201,7 @@
        */
       public int getEncodeSize()
       {
-         return 1100;
+         return size;
       }
       
    }




More information about the jboss-cvs-commits mailing list