[jbosscache-commits] JBoss Cache SVN: r6730 - core/branches/2.2.X/src/test/java/org/jboss/cache/profiling.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Sep 16 06:13:30 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-09-16 06:13:30 -0400 (Tue, 16 Sep 2008)
New Revision: 6730
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
Updated test
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-09-16 10:13:14 UTC (rev 6729)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-09-16 10:13:30 UTC (rev 6730)
@@ -4,9 +4,11 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.xml.XmlHelper;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import org.w3c.dom.Element;
@Test(groups = "profiling")
public abstract class AbstractProfileTest
@@ -49,4 +51,63 @@
public abstract void testCacheLoading() throws Exception;
public abstract void testPassivation() throws Exception;
+
+ public Element getJGroupsConfig() throws Exception
+ {
+ String udp = "<jgroupsConfig>\n" +
+ " <UDP discard_incompatible_packets=\"true\" enable_bundling=\"true\" enable_diagnostics=\"false\" ip_ttl=\"2\"\n" +
+ " loopback=\"false\" max_bundle_size=\"64000\" max_bundle_timeout=\"30\" mcast_addr=\"228.10.10.10\"\n" +
+ " mcast_port=\"45588\" mcast_recv_buf_size=\"100000000\" mcast_send_buf_size=\"640000\"\n" +
+ " oob_thread_pool.enabled=\"true\" oob_thread_pool.keep_alive_time=\"10000\" oob_thread_pool.max_threads=\"20\"\n" +
+ " oob_thread_pool.min_threads=\"8\" oob_thread_pool.queue_enabled=\"false\" oob_thread_pool.queue_max_size=\"10\"\n" +
+ " oob_thread_pool.rejection_policy=\"Run\" thread_naming_pattern=\"pl\" thread_pool.enabled=\"true\"\n" +
+ " thread_pool.keep_alive_time=\"10000\" thread_pool.max_threads=\"30\" thread_pool.min_threads=\"8\"\n" +
+ " thread_pool.queue_enabled=\"false\" thread_pool.queue_max_size=\"10\" thread_pool.rejection_policy=\"Run\"\n" +
+ " tos=\"8\" ucast_recv_buf_size=\"20000000\" ucast_send_buf_size=\"640000\" use_concurrent_stack=\"true\"\n" +
+ " use_incoming_packet_handler=\"true\"/>\n" +
+ " <PING num_initial_members=\"3\" timeout=\"2000\"/>\n" +
+ " <MERGE2 max_interval=\"30000\" min_interval=\"10000\"/>\n" +
+ " <FD_SOCK/>\n" +
+ " <FD max_tries=\"5\" shun=\"true\" timeout=\"10000\"/>\n" +
+ " <VERIFY_SUSPECT timeout=\"1500\"/>\n" +
+ " <pbcast.NAKACK discard_delivered_msgs=\"true\" gc_lag=\"0\" retransmit_timeout=\"300,600,1200,2400,4800\"\n" +
+ " use_mcast_xmit=\"false\"/>\n" +
+ " <UNICAST timeout=\"300,600,1200,2400,3600\"/>\n" +
+ " <pbcast.STABLE desired_avg_gossip=\"50000\" max_bytes=\"400000\" stability_delay=\"1000\"/>\n" +
+ " <pbcast.GMS join_timeout=\"5000\" print_local_addr=\"true\" shun=\"false\" view_ack_collection_timeout=\"5000\"\n" +
+ " view_bundling=\"true\"/>\n" +
+ " <FC max_credits=\"500000\" min_threshold=\"0.2\"/>\n" +
+ " <FRAG2 frag_size=\"60000\"/>\n" +
+ " <pbcast.STREAMING_STATE_TRANSFER use_reading_thread=\"true\"/>\n" +
+ " <pbcast.FLUSH timeout=\"0\"/>\n" +
+ " </jgroupsConfig>";
+
+ String tcp = " <jgroupsConfig>\n" +
+ " <TCP discard_incompatible_packets=\"true\" enable_bundling=\"true\" enable_diagnostics=\"true\"\n" +
+ " enable_unicast_bundling=\"true\" loopback=\"false\" max_bundle_size=\"64000\" max_bundle_timeout=\"30\"\n" +
+ " oob_thread_pool.enabled=\"true\" oob_thread_pool.keep_alive_time=\"10000\" oob_thread_pool.max_threads=\"4\"\n" +
+ " oob_thread_pool.min_threads=\"2\" oob_thread_pool.queue_enabled=\"false\" oob_thread_pool.queue_max_size=\"10\"\n" +
+ " oob_thread_pool.rejection_policy=\"Run\" recv_buf_size=\"20000000\" thread_naming_pattern=\"pl\"\n" +
+ " thread_pool.enabled=\"true\" thread_pool.keep_alive_time=\"30000\" thread_pool.max_threads=\"4\"\n" +
+ " thread_pool.min_threads=\"1\" thread_pool.queue_enabled=\"true\" thread_pool.queue_max_size=\"50000\"\n" +
+ " thread_pool.rejection_policy=\"discard\" use_concurrent_stack=\"true\" use_incoming_packet_handler=\"true\"\n" +
+ " use_send_queues=\"false\" />\n" +
+ " <MPING mcast_addr=\"228.10.10.10\" num_initial_members=\"1\" timeout=\"2000\"/>\n" +
+ " <MERGE2 max_interval=\"30000\" min_interval=\"10000\"/>\n" +
+ " <FD_SOCK/>\n" +
+ " <FD max_tries=\"5\" shun=\"true\" timeout=\"10000\"/>\n" +
+ " <VERIFY_SUSPECT timeout=\"1500\"/>\n" +
+ " <pbcast.NAKACK discard_delivered_msgs=\"true\" gc_lag=\"0\" retransmit_timeout=\"300,600,1200,2400,4800\"\n" +
+ " use_mcast_xmit=\"false\"/>\n" +
+ " <pbcast.STABLE desired_avg_gossip=\"50000\" max_bytes=\"400000\" stability_delay=\"1000\"/>\n" +
+ " <pbcast.GMS join_timeout=\"5000\" print_local_addr=\"true\" shun=\"false\"\n" +
+ " view_ack_collection_timeout=\"5000\" view_bundling=\"true\"/>\n" +
+ " <FC max_credits=\"5000000\" min_threshold=\"0.20\"/>\n" +
+ " <FRAG2 frag_size=\"60000\"/>\n" +
+ " <pbcast.STREAMING_STATE_TRANSFER/>\n" +
+ " <pbcast.FLUSH timeout=\"0\"/>\n" +
+ " </jgroupsConfig>";
+
+ return XmlHelper.stringToElement(udp);
+ }
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2008-09-16 10:13:14 UTC (rev 6729)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2008-09-16 10:13:30 UTC (rev 6730)
@@ -21,19 +21,26 @@
System.in.read();
}
+ @Test(enabled = false)
public void testReplSync() throws Exception
{
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
+ cache.getConfiguration().setExposeManagementStatistics(true);
cache.start();
waitForTest();
}
+ @Test(enabled = true)
public void testReplAsync() throws Exception
{
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
+ cache.getConfiguration().setClusterConfig(getJGroupsConfig());
cache.start();
waitForTest();
}
+ @Test(enabled = false)
public void testReplSyncOptimistic() throws Exception
{
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
@@ -42,6 +49,7 @@
waitForTest();
}
+ @Test(enabled = false)
public void testReplAsyncOptimistic() throws Exception
{
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
@@ -51,6 +59,7 @@
waitForTest();
}
+ @Test(enabled = false)
public void testReplSyncBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -59,14 +68,17 @@
testReplSync();
}
+ @Test(enabled = false)
public void testReplAsyncBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
brc.setEnabled(true);
cache.getConfiguration().setBuddyReplicationConfig(brc);
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
testReplAsync();
}
+ @Test(enabled = false)
public void testReplSyncOptBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -75,6 +87,7 @@
testReplSyncOptimistic();
}
+ @Test(enabled = false)
public void testReplAsyncOptBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -83,27 +96,27 @@
testReplAsyncOptimistic();
}
+ @Test(enabled = false)
public void testStateTransfer() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
+ @Test(enabled = false)
public void testStartup() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
+ @Test(enabled = false)
public void testCacheLoading() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
+ @Test(enabled = false)
public void testPassivation() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
}
Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-09-16 10:13:14 UTC (rev 6729)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-09-16 10:13:30 UTC (rev 6730)
@@ -3,10 +3,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.Test;
import java.util.ArrayList;
@@ -36,24 +37,29 @@
/*
Test configuration options
*/
- protected static final long DURATION = 5 * 60 * 1000; // 15 mins
+ protected static final long NUM_OPERATIONS = 500000; // DURATION is replaced with a fixed number of operations instead.
protected static final int NUM_THREADS = 15;
- protected static final int MAX_RANDOM_SLEEP_MILLIS = 25;
+ protected static final int MAX_RANDOM_SLEEP_MILLIS = 1;
protected static final int MAX_DEPTH = 3;
protected static final int MAX_OVERALL_NODES = 200;
protected static final int WARMUP_LOOPS = 20000;
+ protected static final boolean USE_SLEEP = false; // throttle generation a bit
private List<Fqn> fqns = new ArrayList<Fqn>(MAX_OVERALL_NODES);
private Random r = new Random();
private Log log = LogFactory.getLog(ProfileTest.class);
+ @Test(enabled = false)
public void testLocalModePess() throws Exception
{
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
+ cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
runCompleteTest();
}
+ @Test(enabled = false)
public void testLocalModeOpt() throws Exception
{
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -61,17 +67,23 @@
runCompleteTest();
}
+ @Test(enabled = false)
public void testReplSync() throws Exception
{
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
runCompleteTest();
}
+ @Test(enabled = true)
public void testReplAsync() throws Exception
{
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
+ cache.getConfiguration().setClusterConfig(getJGroupsConfig());
runCompleteTest();
}
+ @Test(enabled = false)
public void testReplSyncOptimistic() throws Exception
{
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
@@ -79,6 +91,7 @@
runCompleteTest();
}
+ @Test(enabled = false)
public void testReplAsyncOptimistic() throws Exception
{
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
@@ -87,6 +100,7 @@
runCompleteTest();
}
+ @Test(enabled = false)
public void testReplSyncBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -95,14 +109,17 @@
testReplSync();
}
+ @Test(enabled = false)
public void testReplAsyncBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
brc.setEnabled(true);
cache.getConfiguration().setBuddyReplicationConfig(brc);
+ cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
testReplAsync();
}
+ @Test(enabled = false)
public void testReplSyncOptBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -111,6 +128,7 @@
testReplSyncOptimistic();
}
+ @Test(enabled = false)
public void testReplAsyncOptBR() throws Exception
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -214,40 +232,43 @@
long duration = System.currentTimeMillis() - startTime;
log.warn("Finished warmup. " + printDuration(duration));
- cache.removeNode(Fqn.ROOT);
+ //cache.removeNode(Fqn.ROOT);
+ cache.stop();
+ cache.start();
}
private void doTest() throws Exception
{
ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
- long end = System.currentTimeMillis() + DURATION;
long startTime = System.currentTimeMillis();
log.warn("Starting test");
- int i = 0;
- while (System.currentTimeMillis() < end)
+ int i;
+ for (i = 0; i < NUM_OPERATIONS; i++)
{
MyRunnable r = null;
switch (i % 3)
{
case 0:
- r = new Putter(i++);
+ r = new Putter(i);
break;
case 1:
- r = new Getter(i++);
+ r = new Getter(i);
break;
case 2:
- r = new Remover(i++);
+ r = new Remover(i);
break;
}
exec.execute(r);
- TestingUtil.sleepRandom(MAX_RANDOM_SLEEP_MILLIS);
+// if (USE_SLEEP) TestingUtil.sleepRandom(MAX_RANDOM_SLEEP_MILLIS);
+ if (USE_SLEEP) TestingUtil.sleepThread(MAX_RANDOM_SLEEP_MILLIS);
}
log.warn("Finished generating runnables; awaiting executor completion");
// wait for executors to complete!
exec.shutdown();
- exec.awaitTermination(((long) i) * 250, TimeUnit.MILLISECONDS); // wait up to 250 millis for each call?
+ exec.awaitTermination(((long) i), TimeUnit.SECONDS); // wait up to 1 sec for each call?
long duration = System.currentTimeMillis() - startTime;
log.warn("Finished test. " + printDuration(duration));
+ log.warn("Throughput: " + (NUM_OPERATIONS * 1000 / duration) + " operations per second (roughly equal numbers of PUT, GET and REMOVE)");
}
enum Mode
@@ -332,27 +353,27 @@
}
}
+ @Test(enabled = false)
public void testStateTransfer() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
+ @Test(enabled = false)
public void testStartup() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
+ @Test(enabled = false)
public void testCacheLoading() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
+ @Test(enabled = false)
public void testPassivation() throws Exception
{
- // TODO implement me
throw new Exception("Implement me");
}
}
More information about the jbosscache-commits
mailing list