[jboss-cvs] JBoss Messaging SVN: r7228 - in trunk: examples/core/perf/server0 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 5 12:50:25 EDT 2009


Author: timfox
Date: 2009-06-05 12:50:25 -0400 (Fri, 05 Jun 2009)
New Revision: 7228

Modified:
   trunk/examples/core/perf/perf.properties
   trunk/examples/core/perf/server0/jbm-configuration.xml
   trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java
Log:
log rates fix

Modified: trunk/examples/core/perf/perf.properties
===================================================================
--- trunk/examples/core/perf/perf.properties	2009-06-05 16:22:39 UTC (rev 7227)
+++ trunk/examples/core/perf/perf.properties	2009-06-05 16:50:25 UTC (rev 7228)
@@ -1,6 +1,6 @@
 num-messages=1000000
-num-warmup-messages=10000
-message-size=1000
+num-warmup-messages=20000
+message-size=1024
 durable=true
 transacted=false
 batch-size=1000

Modified: trunk/examples/core/perf/server0/jbm-configuration.xml
===================================================================
--- trunk/examples/core/perf/server0/jbm-configuration.xml	2009-06-05 16:22:39 UTC (rev 7227)
+++ trunk/examples/core/perf/server0/jbm-configuration.xml	2009-06-05 16:50:25 UTC (rev 7228)
@@ -17,7 +17,7 @@
    
    <persistence-enabled>true</persistence-enabled>
 
-   <journal-sync-non-transactional>true</journal-sync-non-transactional>
+   <journal-sync-non-transactional>false</journal-sync-non-transactional>
    <journal-type>ASYNCIO</journal-type>
    <journal-min-files>20</journal-min-files>
    <journal-aio-buffer-timeout>20000</journal-aio-buffer-timeout>

Modified: trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java	2009-06-05 16:22:39 UTC (rev 7227)
+++ trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java	2009-06-05 16:50:25 UTC (rev 7228)
@@ -93,41 +93,7 @@
    private TimerTask logRatesTimerTask;
    
    private long lastExecution;
-   
-   private class LogRatesTimerTask extends TimerTask
-   {
-      private boolean closed;
       
-      @Override
-      public synchronized void run()
-      {
-         if (!closed)
-         {
-            long now = System.currentTimeMillis();
-            
-            if (lastExecution != 0)
-            {                             
-               double rate = 1000 * ((double)bytesFlushed) / ( now  - lastExecution);
-               
-               log.info("Write rate = " + rate + " bytes / sec");                                      
-            }
-            else
-            {
-               lastExecution = now;
-            }
-            
-            bytesFlushed = 0;
-         }
-      }
-      
-      public synchronized boolean cancel()
-      {
-         closed = true;
-         
-         return super.cancel();
-      }
-   }
-
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -280,7 +246,7 @@
          // Resume latch
          latchTimer.down();
       }
-
+      
       currentBuffer.put(bytes);
       callbacks.add(callback);
 
@@ -313,12 +279,22 @@
       if (currentBuffer.limit() > 0)
       {
          latchTimer.up();
+         
+         int pos = currentBuffer.position();
+         
+         if (logRates)
+         {
+            bytesFlushed += pos;                     
+         }
 
-         ByteBuffer directBuffer = bufferObserver.newBuffer(bufferSize, currentBuffer.position());
+         ByteBuffer directBuffer = bufferObserver.newBuffer(bufferSize, pos);
 
          // Putting a byteArray on a native buffer is much faster, since it will do in a single native call.
          // Using directBuffer.put(currentBuffer) would make several append calls for each byte
-         directBuffer.put(currentBuffer.array(), 0, currentBuffer.position());
+         
+         //TODO we could optimise this further by making currentBuffer a simple byte[] and using System.arrayCopy to add bytes to it
+         //then we wouldn't need the array() call
+         directBuffer.put(currentBuffer.array(), 0, pos);
 
          bufferObserver.flushBuffer(directBuffer, callbacks);
 
@@ -326,12 +302,7 @@
 
          active = false;
          pendingSync = false;
-         
-         if (logRates)
-         {
-            bytesFlushed += currentBuffer.position();
-         }
-
+                  
          currentBuffer.limit(0);
       }
    }
@@ -368,6 +339,38 @@
 
    // Inner classes -------------------------------------------------
 
+   private class LogRatesTimerTask extends TimerTask
+   {
+      private boolean closed;
+      
+      @Override
+      public synchronized void run()
+      {
+         if (!closed)
+         {
+            long now = System.currentTimeMillis();
+            
+            if (lastExecution != 0)
+            {                             
+               double rate = 1000 * ((double)bytesFlushed) / ( now  - lastExecution);
+               
+               log.info("Write rate = " + rate + " bytes / sec");                                      
+            }
+
+            lastExecution = now;
+            
+            bytesFlushed = 0;
+         }
+      }
+      
+      public synchronized boolean cancel()
+      {
+         closed = true;
+         
+         return super.cancel();
+      }
+   }
+   
    private class CheckTimer implements Runnable
    {
       private volatile boolean closed = false;




More information about the jboss-cvs-commits mailing list