|
From: Bryan T. <tho...@us...> - 2007-04-10 18:33:38
|
Update of /cvsroot/cweb/bigdata/src/test/com/bigdata/journal In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24584/src/test/com/bigdata/journal Modified Files: BenchmarkJournalWriteRate.java Log Message: Fixed a bug in UUID assignment to index segments. Added some logic for fast data output for btree nodes and leaves. Index: BenchmarkJournalWriteRate.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/test/com/bigdata/journal/BenchmarkJournalWriteRate.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** BenchmarkJournalWriteRate.java 4 Apr 2007 16:53:25 -0000 1.16 --- BenchmarkJournalWriteRate.java 10 Apr 2007 18:33:31 -0000 1.17 *************** *** 60,65 **** --- 60,68 ---- import junit.framework.TestSuite; + import com.bigdata.isolation.IIsolatableIndex; import com.bigdata.isolation.UnisolatedBTree; import com.bigdata.objndx.BTree; + import com.bigdata.objndx.ByteArrayValueSerializer; + import com.bigdata.objndx.IIndex; import com.bigdata.objndx.KeyBuilder; import com.bigdata.rawstore.Bytes; *************** *** 210,213 **** --- 213,217 ---- protected int getBranchingFactor() { + // return 16; return 256; *************** *** 286,291 **** /** ! * Test the index write rate without transactional isolation using 32 bit ! * integer keys and 128 byte values for the index entries. */ public void testUnisolatedIndexWriteRate() throws IOException { --- 290,319 ---- /** ! * Test the index write rate using an index that does NOT support ! * transactional isolation using 32 bit integer keys and 128 byte values for ! * the index entries. ! */ ! public void testNonIsolatableIndexWriteRate() throws IOException { ! ! // register named index that does NOT support isolation. ! String name = "abc"; ! ! journal.registerIndex(name, new BTree(journal, getBranchingFactor(), ! UUID.randomUUID(), ByteArrayValueSerializer.INSTANCE)); ! ! journal.commit(); ! ! // NOT isolated. ! long tx = 0L; ! ! // run test. ! doIndexWriteRateTest(name, tx, 128); ! ! } ! ! /** ! * Test the index write rate using an index that supports transactional ! * isolation but without transactional isolation using 32 bit integer keys ! * and 128 byte values for the index entries. */ public void testUnisolatedIndexWriteRate() throws IOException { *************** *** 418,428 **** KeyBuilder keyBuilder = new KeyBuilder(); System.err.println("Begin: index write rate, isolated=" ! + (tx == 0 ? "no" : "yes") + ", bufferMode=" + journal._bufferStrategy.getBufferMode()); - UnisolatedBTree ndx = (UnisolatedBTree) (tx == 0 ? journal - .getIndex(name) : journal.getTx(tx).getIndex(name)); - // target percentage full to avoid journal overflow. final double percentFull = .90; --- 446,457 ---- KeyBuilder keyBuilder = new KeyBuilder(); + IIndex ndx = (tx == 0 ? journal.getIndex(name) + : journal.getTx(tx).getIndex(name)); + System.err.println("Begin: index write rate, isolated=" ! + (tx == 0 ? "no" : "yes") + ", isolatable=" ! + (ndx instanceof IIsolatableIndex) + ", bufferMode=" + journal._bufferStrategy.getBufferMode()); // target percentage full to avoid journal overflow. final double percentFull = .90; *************** *** 431,448 **** final int nwrites = (int) (journal._bufferStrategy.getExtent() * percentFull / valueSize); - - final long begin = System.currentTimeMillis(); ! for( int i=0; i<nwrites; i++ ) { ! // key[] is new on each insert; keys are monotonically increasing. ! final byte[] key = keyBuilder.reset().append(i).getKey(); ! ! // value[] is new on each insert. ! final byte[] value = new byte[valueSize]; ! ! value[0] = (byte)i; // at least one non-zero byte. ! ! ndx.insert(key,value); } --- 460,484 ---- final int nwrites = (int) (journal._bufferStrategy.getExtent() * percentFull / valueSize); ! final long begin; ! { ! ! begin = System.currentTimeMillis(); ! ! for (int i = 0; i < nwrites; i++) { ! ! // key[] is new on each insert; keys are monotonically ! // increasing. ! final byte[] key = keyBuilder.reset().append(i).getKey(); ! ! // value[] is new on each insert. ! final byte[] value = new byte[valueSize]; ! ! value[0] = (byte) i; // at least one non-zero byte. ! ! ndx.insert(key, value); ! ! } } *************** *** 502,506 **** // The unisolated btree on which the data were actually written. ! final UnisolatedBTree btree = (UnisolatedBTree)journal.getIndex(name); final int nodesWritten = btree.counters.getNodesWritten(); --- 538,542 ---- // The unisolated btree on which the data were actually written. ! final BTree btree = (BTree)journal.getIndex(name); final int nodesWritten = btree.counters.getNodesWritten(); *************** *** 803,807 **** /** * Runs the tests that have not been commented out :-) ! * * Note: Running all benchmarks together can challange the VM by running low * on heap, native memory given over to direct buffers - and things can actually --- 839,843 ---- /** * Runs the tests that have not been commented out :-) ! * <p> * Note: Running all benchmarks together can challange the VM by running low * on heap, native memory given over to direct buffers - and things can actually *************** *** 824,826 **** --- 860,897 ---- } + /** + * Main routine can be used for running the test under a performance + * analyzer. + * + * @param args + * Not used. + * + * @throws Exception + */ + public static void main(String[] args) throws Exception { + + BenchmarkTransientJournal test = new BenchmarkTransientJournal(); + + test.setUp(); + + try { + + /* + * Choose one test to run. (You must setUp/tearDown for each test). + */ + test.testNonIsolatableIndexWriteRate(); + + // test.testUnisolatedIndexWriteRate(); + + // test.testIsolatedIndexWriteRate(); + + } + finally { + + test.tearDown(); + + } + + } + } |