[jboss-cvs] JBoss Messaging SVN: r7126 - in branches/Branch_JBM2_Perf_Clebert: tests/src/org/jboss/messaging/tests/performance/journal and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 29 01:38:20 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-05-29 01:38:20 -0400 (Fri, 29 May 2009)
New Revision: 7126
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/JournalImpl.java
branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java
branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java
Log:
backup
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 05:02:49 UTC (rev 7125)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java 2009-05-29 05:38:20 UTC (rev 7126)
@@ -242,6 +242,7 @@
aioFile.open(journalDir + "/" + fileName, currentMaxIO);
position.set(0);
aioFile.setBufferCallback(bufferCallback);
+ this.fileSize = aioFile.size();
}
@@ -342,9 +343,9 @@
private void execWrite(final ByteBuffer bytes, final IOCallback callback)
{
- final int bytesToWrite = bytes.limit();
+ final int bytesToWrite = factory.calculateBlockSize(bytes.limit());
- bytes.limit(factory.calculateBlockSize(bytesToWrite));
+ bytes.limit(bytesToWrite);
final long positionToWrite = position.getAndAdd(bytesToWrite);
@@ -471,11 +472,6 @@
long availableSize = fileSize - position.get();
- if (availableSize < size)
- {
- System.out.println("oops... only have " + availableSize + " now");
- }
-
if (availableSize == 0 || availableSize < minSize)
{
return null;
Modified: branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-05-29 05:02:49 UTC (rev 7125)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-05-29 05:38:20 UTC (rev 7126)
@@ -1860,7 +1860,7 @@
throw new IllegalArgumentException("Record is too large to store " + size);
}
- if (currentFile.getFile().fits(size))
+ if (!currentFile.getFile().fits(size))
{
moveNextFile();
}
Modified: branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java
===================================================================
--- branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java 2009-05-29 05:02:49 UTC (rev 7125)
+++ branches/Branch_JBM2_Perf_Clebert/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java 2009-05-29 05:38:20 UTC (rev 7126)
@@ -27,6 +27,7 @@
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import java.util.concurrent.atomic.AtomicLong;
import org.jboss.messaging.core.journal.IOCallback;
import org.jboss.messaging.core.journal.SequentialFile;
@@ -53,6 +54,8 @@
private FileChannel channel;
private RandomAccessFile rfile;
+
+ private final AtomicLong position = new AtomicLong(0);
public NIOSequentialFile(final String directory, final String fileName)
{
@@ -72,14 +75,7 @@
public boolean fits(final int size)
{
- try
- {
- return channel.position() + size < fileSize;
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unexpected IOException", e);
- }
+ return this.position.get() + size < fileSize;
}
public String getFileName()
@@ -122,6 +118,8 @@
channel.force(false);
channel.position(0);
+
+ fileSize = channel.size();
}
public void close() throws Exception
@@ -194,6 +192,8 @@
{
try
{
+ position.addAndGet(bytes.limit());
+
channel.write(bytes);
if (callback != null)
@@ -221,11 +221,12 @@
public void position(final long pos) throws Exception
{
channel.position(pos);
+ position.set(pos);
}
public long position() throws Exception
{
- return channel.position();
+ return position.get();
}
public void renameTo(final String newFileName) throws Exception
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 05:02:49 UTC (rev 7125)
+++ branches/Branch_JBM2_Perf_Clebert/tests/src/org/jboss/messaging/tests/performance/journal/PerformanceComparissonTest.java 2009-05-29 05:38:20 UTC (rev 7126)
@@ -59,9 +59,9 @@
private final byte UPDATE1 = 2;
- private final int ITERATIONS = 1;
+ private final int ITERATIONS = 2;
- private final boolean PERFORM_UPDATE = false;
+ private final boolean PERFORM_UPDATE = true;
private static final LoadManager dummyLoader = new LoadManager()
{
@@ -115,7 +115,11 @@
}
System.out.println("Test AIO # " + i);
- testJournal(new AIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
+ testJournal(new AIOSequentialFileFactory(getTestDir(), 100 * 1024, 2),
+ NUM_RECORDS,
+ SIZE_RECORD,
+ 13,
+ 10 * 1024 * 1024);
}
}
@@ -130,22 +134,22 @@
setUp();
}
System.out.println("Test NIO # " + i);
- testJournal(new NIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD);
+ testJournal(new NIOSequentialFileFactory(getTestDir()), NUM_RECORDS, SIZE_RECORD, 13, 10 * 1024 * 1024);
}
}
- public void testJournal(SequentialFileFactory fileFactory, long records, int size) throws Exception
+ public void testJournal(SequentialFileFactory fileFactory, long records, int size, int numberOfFiles, int journalSize) throws Exception
{
- JournalImpl journal = new JournalImpl(10 * 1024 * 1024, // 10M.. we believe that's the usual cilinder
+ JournalImpl journal = new JournalImpl(journalSize, // 10M.. we believe that's the usual cilinder
// size.. not an exact science here
- 2, // number of files pre-allocated
+ numberOfFiles, // 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
+ 500); // it's like a semaphore for callback on the AIO layer
// this during record writes
journal.start();
@@ -175,7 +179,6 @@
journal.stop();
-
System.out.println("Produced records after stop " + (NUM_RECORDS - WARMUP_RECORDS) +
" in " +
(System.currentTimeMillis() - timeStart) +
More information about the jboss-cvs-commits
mailing list