Author: ron.sigal(a)jboss.com
Date: 2008-03-15 05:10:59 -0400 (Sat, 15 Mar 2008)
New Revision: 3651
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java
Log:
JBREM-931: Updated soak test.
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java 2008-03-15
03:04:24 UTC (rev 3650)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java 2008-03-15
09:10:59 UTC (rev 3651)
@@ -66,7 +66,8 @@
private static String host;
private static boolean creationDone;
- private static long DURATION = 3000;
+ private static long DURATION = 3600000;
+ private static int MAX_CLIENTS = 20;
public static void main(String[] args)
{
@@ -82,13 +83,19 @@
host = InetAddress.getLocalHost().getHostAddress();
random = new Random(System.currentTimeMillis());
Timer timer = new Timer(false);
- timer.schedule(new DisplayTimerTask(), 5000, 5000);
+ timer.schedule(new DisplayTimerTask(), 30000, 30000);
long start = System.currentTimeMillis();
-
+
while (System.currentTimeMillis() - start < DURATION)
{
- createClient();
- int n = random.nextInt(30) * 100;
+ if (mockEJBClientCurrentCounter.getCount() +
+ mockJBMClientCurrentCounter.getCount() +
+ heavyComputeClientCurrentCounter.getCount() < MAX_CLIENTS)
+ {
+ createClient();
+ }
+
+ int n = random.nextInt(80) * 100;
log.debug("waiting " + n + " ms");
Thread.sleep(n);
}
@@ -106,6 +113,7 @@
protected static void createClient() throws Throwable
{
int k = random.nextInt(4);
+ k = 3;
String transport = transports[k];
int port = ports[k];
transportCounters[k]++;
@@ -128,12 +136,12 @@
protected static void createMockEJBClient(String transport, int port) throws
Throwable
{
- String locatorURI = transport + "://" + host + ":" + port;
+ String locatorURI = transport + "://" + host + ":" + port +
"/?timeout=0";
Map metadata = new HashMap();
- metadata.put(NAME, "MockEJBClient" + mockEJBClientCounter.increment());
+ metadata.put(NAME, "MockEJBClient" + mockEJBClientCounter.increment() +
"[" + transport + "]");
metadata.put(COUNTER, mockEJBClientCurrentCounter);
metadata.put(FAILURE_COUNTER, mockEJBClientFailureCounter);
- metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(20000)));
+ metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(2000)));
MockEJBClient c = new MockEJBClient(locatorURI, metadata);
Thread t = new Thread(c);
t.start();
@@ -142,13 +150,13 @@
protected static void createMockJBMClient(String transport, int port) throws
Throwable
{
- String locatorURI = transport + "://" + host + ":" + port;
+ String locatorURI = transport + "://" + host + ":" + port +
"/?timeout=0";
Map metadata = new HashMap();
- metadata.put(NAME, "MockJBMClient" + mockJBMClientCounter.increment());
+ metadata.put(NAME, "MockJBMClient" + mockJBMClientCounter.increment() +
"[" + transport + "]");
metadata.put(COUNTER, mockJBMClientCurrentCounter);
metadata.put(FAILURE_COUNTER, mockJBMClientFailureCounter);
- metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(5000)));
- metadata.put(NUMBER_OF_CALLBACKS, Integer.toString(random.nextInt(8)));
+ metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(1000)));
+ metadata.put(NUMBER_OF_CALLBACKS, Integer.toString(random.nextInt(3)));
MockJBMClient c = new MockJBMClient(locatorURI, metadata);
Thread t = new Thread(c);
t.start();
@@ -157,13 +165,13 @@
protected static void createHeavyComputeClient(String transport, int port) throws
Throwable
{
- String locatorURI = transport + "://" + host + ":" + port;
+ String locatorURI = transport + "://" + host + ":" + port +
"/?timeout=0";
Map metadata = new HashMap();
- metadata.put(NAME, "HeavyComputeClient" +
heavyComputeClientCounter.increment());
+ metadata.put(NAME, "HeavyComputeClient" +
heavyComputeClientCounter.increment() + "[" + transport + "]");
metadata.put(COUNTER, heavyComputeClientCurrentCounter);
metadata.put(FAILURE_COUNTER, heavyComputeClientFailureCounter);
- metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(10)));
- metadata.put(SPIN_TIME, "10000");
+ metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(5)));
+ metadata.put(SPIN_TIME, "4000");
HeavyComputeClient c = new HeavyComputeClient(locatorURI, metadata);
heavyComputeClientCounter.increment();
Thread t = new Thread(c);
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java 2008-03-15
03:04:24 UTC (rev 3650)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java 2008-03-15
09:10:59 UTC (rev 3651)
@@ -84,15 +84,29 @@
protected void makeCall(int i) throws Throwable
{
- Client client = new Client(locator);
- client.connect();
- Object response = client.invoke(SPIN, metadata);
- if (!"done".equals(response))
+ Client client = null;
+
+ try
{
+ client = new Client(locator);
+ client.connect();
+ Object response = client.invoke(SPIN, metadata);
+ if (!"done".equals(response))
+ {
+ ok = false;
+ log.info(name + ": failure on call " + i);
+ }
+ }
+ catch (Throwable t)
+ {
ok = false;
log.info(name + ": failure on call " + i);
+ throw t;
}
- client.disconnect();
+ finally
+ {
+ client.disconnect();
+ }
}
}
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java 2008-03-15
03:04:24 UTC (rev 3650)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java 2008-03-15
09:10:59 UTC (rev 3651)
@@ -81,20 +81,34 @@
if (!ok) failureCounter.increment();
}
}
-
+
protected void makeCall(int i) throws Throwable
{
- Client client = new Client(locator);
- client.connect();
- Map metadata = new HashMap();
- metadata.put(PAYLOAD, "abc");
- Object response = client.invoke(COPY, metadata);
- if (!"abc".equals(response))
+ Client client = null;
+
+ try
{
+ client = new Client(locator);
+ client.connect();
+ Map metadata = new HashMap();
+ metadata.put(PAYLOAD, "abc");
+ Object response = client.invoke(COPY, metadata);
+ if (!"abc".equals(response))
+ {
+ ok = false;
+ log.info(name + ": failure on call " + i);
+ }
+ }
+ catch (Throwable t)
+ {
ok = false;
log.info(name + ": failure on call " + i);
+ throw t;
}
- client.disconnect();
+ finally
+ {
+ client.disconnect();
+ }
}
}
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java 2008-03-15
03:04:24 UTC (rev 3650)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java 2008-03-15
09:10:59 UTC (rev 3651)
@@ -30,6 +30,7 @@
import org.jboss.remoting.callback.Callback;
import org.jboss.remoting.callback.HandleCallbackException;
import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.bisocket.Bisocket;
/**
* @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
@@ -69,7 +70,12 @@
client.connect();
TestCallbackHandler callbackHandler = new TestCallbackHandler();
Map callbackMetadata = new HashMap();
+ if ("bisocket".equals(locator.getProtocol()))
+ {
+ callbackMetadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ }
client.addListener(callbackHandler, callbackMetadata, null, true);
+ log.debug(client.getSessionId() + ": added callback listener");
String s = (String) metadata.get(NUMBER_OF_CALLS);
int calls = Integer.valueOf(s).intValue();
for (int i = 0; i < calls; i++)
@@ -89,9 +95,11 @@
catch (Throwable t)
{
log.error(name, t);
+ ok = false;
}
finally
{
+ client.disconnect();
log.info(name + ": " + (ok ? "PASS" : "FAIL"));
counter.decrement();
if (!ok) failureCounter.increment();
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java 2008-03-15
03:04:24 UTC (rev 3650)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java 2008-03-15
09:10:59 UTC (rev 3651)
@@ -88,7 +88,7 @@
connector = setupServer(host, 6669, "socket");
locators.put("socket", connector.getLocator().getLocatorURI());
- log.info("servers: " + locators);
+ log.info("SERVERS CREATED: " + locators);
}
catch (Exception e)
{
@@ -99,7 +99,7 @@
protected static Connector setupServer(String host, int port, String transport) throws
Exception
{
- String locatorURI = transport + "://" + host + ":" + port;
+ String locatorURI = transport + "://" + host + ":" + port +
"/?timeout=0";
InvokerLocator serverLocator = new InvokerLocator(locatorURI);
log.info("Starting remoting server with locator uri of: " + locatorURI);
HashMap config = new HashMap();
@@ -120,12 +120,13 @@
public void addListener(InvokerCallbackHandler callbackHandler)
{
+ log.debug("entering addListener()");
synchronized (lock)
{
String id =
((ServerInvokerCallbackHandler)callbackHandler).getClientSessionId();
listeners.put(id, callbackHandler);
}
- log.debug("added InvokerCallbackHandler");
+ log.debug("added InvokerCallbackHandler: " + listeners);
}
public Object invoke(final InvocationRequest invocation) throws Throwable
@@ -161,6 +162,11 @@
callbackHandler = (InvokerCallbackHandler) listeners.get(id);
}
+ if (callbackHandler == null)
+ {
+ log.info("sessionId: " + id);
+ log.info("listeners: " + listeners);
+ }
Callback callback = new Callback("callback");
for (int i = 0; i < callbacks; i++)
{
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java 2008-03-15
03:04:24 UTC (rev 3650)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java 2008-03-15
09:10:59 UTC (rev 3651)
@@ -31,14 +31,16 @@
*/
public class SoakConstants
{
- public static final int SENDERS = 5;
+ public static final int SENDERS = 5;
public static final int CALLBACK_LISTENERS = 5;
- public static final int DURATION = 30000;
+ public static final int DURATION = 36000000;
- public static final int INTERVAL = 1000;
+ public static final int INTERVAL = 1000000;
+ public static final String locator = "://localhost:5678";
+
public static final String NUMBER_OF_CALLS = "numberOfCalls";
public static final String NAME = "name";