[jboss-cvs] JBoss Messaging SVN: r7136 - in branches/Branch_JBM2_Perf_Clebert: src/main/org/jboss/messaging/core/journal/impl and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 29 22:05:46 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-05-29 22:05:46 -0400 (Fri, 29 May 2009)
New Revision: 7136
Added:
branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBufferController.java
Modified:
branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBuffer.java
branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java
branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java
branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java
Log:
Fixes on buffer reuse
Modified: branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBuffer.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBuffer.java 2009-05-29 21:53:27 UTC (rev 7135)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBuffer.java 2009-05-30 02:05:46 UTC (rev 7136)
@@ -45,6 +45,8 @@
// Attributes ----------------------------------------------------
final TimedBufferObserver bufferObserver;
+
+ final TimedBufferController controller;
final long timeout;
@@ -53,6 +55,8 @@
volatile ByteBuffer currentBuffer;
volatile List<AIOCallback> callbacks;
+
+ volatile long writeLastTime = 0;
// Static --------------------------------------------------------
@@ -60,11 +64,12 @@
// Public --------------------------------------------------------
- public TimedBuffer(final TimedBufferObserver bufferObserver, final int size, final long timeout)
+ public TimedBuffer(final TimedBufferController controller, final TimedBufferObserver bufferObserver, final int size, final long timeout)
{
this.bufferSize = size;
this.bufferObserver = bufferObserver;
this.timeout = timeout;
+ this.controller = controller;
}
public int position()
@@ -93,7 +98,7 @@
else
{
// We verify against the currentBuffer.capacity as the observer may return a smaller buffer
- if (currentBuffer == null || (currentBuffer.position() + sizeChecked) > currentBuffer.capacity())
+ if (currentBuffer == null || (currentBuffer.position() + sizeChecked) > currentBuffer.limit())
{
flush();
newBuffer(sizeChecked);
Added: branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBufferController.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBufferController.java (rev 0)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/asyncio/timedbuffer/TimedBufferController.java 2009-05-30 02:05:46 UTC (rev 7136)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.core.asyncio.timedbuffer;
+
+/**
+ * A TimedBufferController
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class TimedBufferController
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java 2009-05-29 21:53:27 UTC (rev 7135)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java 2009-05-30 02:05:46 UTC (rev 7136)
@@ -101,7 +101,7 @@
this.bufferCallback = bufferCallback;
this.executor = executor;
this.pollerExecutor = pollerExecutor;
- this.timedBuffer = new TimedBuffer(new LocalBufferObserver(), bufferSize, bufferTimeoutMilliseconds);
+ this.timedBuffer = new TimedBuffer(null, new LocalBufferObserver(), bufferSize, bufferTimeoutMilliseconds);
}
public boolean isOpen()
Modified: branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java 2009-05-29 21:53:27 UTC (rev 7135)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java 2009-05-30 02:05:46 UTC (rev 7136)
@@ -121,7 +121,8 @@
{
size = (size / 512 + 1) * 512;
}
- return AsynchronousFileImpl.newBuffer(size);
+
+ return buffersControl.newBuffer(size);
}
public void clearBuffer(final ByteBuffer directByteBuffer)
@@ -208,7 +209,7 @@
// buffer.
if (size > bufferSize)
{
- return newBuffer(size);
+ return AsynchronousFileImpl.newBuffer(size);
}
else
{
@@ -222,16 +223,16 @@
if (buffer == null)
{
// if empty create a new one.
- buffer = newBuffer(bufferSize);
+ buffer = AsynchronousFileImpl.newBuffer(bufferSize);
buffer.limit(alignedSize);
}
else
{
+ clearBuffer(buffer);
+
// set the limit of the buffer to the bufferSize being required
buffer.limit(alignedSize);
-
- clearBuffer(buffer);
}
buffer.rewind();
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-29 21:53:27 UTC (rev 7135)
+++ branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java 2009-05-30 02:05:46 UTC (rev 7136)
@@ -61,7 +61,7 @@
private final byte UPDATE2 = 3;
- private final int ITERATIONS = 10;
+ private final int ITERATIONS = 2;
private final boolean PERFORM_UPDATE = true;
@@ -106,7 +106,7 @@
// super.tearDown();
}
- public void testAddDeleteAIO() throws Exception
+ public void disabled_testAddDeleteAIO() throws Exception
{
for (int i = 0; i < ITERATIONS; i++)
{
@@ -126,7 +126,7 @@
}
}
- public void testAddDeleteNIO() throws Exception
+ public void disabled_testAddDeleteNIO() throws Exception
{
for (int i = 0; i < ITERATIONS; i++)
{
@@ -227,7 +227,7 @@
}
System.out.println("Test AIO # " + i);
- testJournal(new AIOSequentialFileFactory(getTestDir(), 100 * 1024, 2),
+ testJournal(new AIOSequentialFileFactory(getTestDir(), 1024 * 1024, 2),
NUM_RECORDS,
SIZE_RECORD,
13,
@@ -250,7 +250,7 @@
}
}
- public void testDeleteme() throws Exception
+ public void disabled_testDeleteme() throws Exception
{
JournalImpl journal = new JournalImpl(1024 * 1024 * 10, // 10M.. we believe that's the usual cilinder
@@ -325,6 +325,7 @@
long timeStart = System.currentTimeMillis();
for (long i = 0; i < records; i++)
{
+// System.out.println("record # " + i);
if (i == WARMUP_RECORDS)
{
timeStart = System.currentTimeMillis();
More information about the jboss-cvs-commits
mailing list