Author: mircea.markus
Date: 2008-10-06 09:29:06 -0400 (Mon, 06 Oct 2008)
New Revision: 6844
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
Log:
enhanced session simulator
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
---
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-10-06
13:14:38 UTC (rev 6843)
+++
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-10-06
13:29:06 UTC (rev 6844)
@@ -146,7 +146,6 @@
log.info("Gathering replication delay");
String key = "registerReplicationDelay";
List<String> path = Arrays.asList(key);
- Set received = new HashSet();
int clusterSize = configuration.getClusterConfig().getClusterSize();
while (notAllAck(path, cacheWrapper))
{
@@ -157,16 +156,11 @@
if (log.isTraceEnabled()) log.trace("replication delay value from
node " + i + " is " + replicatedValue);
if (replicatedValue != null)
{
- received.add(replicatedValue);
cacheWrapper.put(path,
buildAckKey(Integer.parseInt(String.valueOf(replicatedValue)), getNodeIndex()),
"recieved");
}
}
- if (received.size() < clusterSize)
- {
- //todo mmarkus this brings a delay of 1 sec to the async replication
config
- log.info("Recieved " + received.size() + " replication
messages. Sleeping 1 sec before moving on");
- Thread.sleep(1000);
- }
+ //todo mmarkus this brings a delay of 1 sec to the async replication config
+ Thread.sleep(1000);
}
replicationDelay = System.currentTimeMillis() - replicationDelay;
log.info("Replication delay is " + replicationDelay + "
millis.");
@@ -174,7 +168,7 @@
return replicationDelay;
}
- private String buildAckKey(int sender, int receiver )
+ private String buildAckKey(int sender, int receiver)
{
return sender + "->" + receiver;
}
@@ -185,18 +179,21 @@
{
for (int j = 0; j < configuration.getClusterConfig().getClusterSize(); j++)
{
- if (cacheWrapper.get(path, buildAckKey(i,j)) == null) return false;
-
+ if (cacheWrapper.get(path, buildAckKey(i, j)) == null)
+ {
+ if (log.isTraceEnabled()) log.trace("Missing replication message:
" + buildAckKey(i,j));
+ return true;
+ }
}
}
- return true;
+ return false;
}
private void logRunCount(int i)
{
if (((i + 1) % LOG_AFTER_OPERATION_COUNT == 0) || (i == 0))
{
- log.info("SessionSimulatorTest performed " + (i == 0 ? 0 : (i+1)) +
" operations");
+ log.info("SessionSimulatorTest performed " + (i == 0 ? 0 : (i + 1)) +
" operations");
}
}
Show replies by date