JBoss Native SVN: r2435 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 16:54:43 -0400 (Mon, 18 May 2009)
New Revision: 2435
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
Log:
Drop flood of log messages
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 20:53:51 UTC (rev 2434)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 20:54:43 UTC (rev 2435)
@@ -77,8 +77,6 @@
{
long end = Long.parseLong(parameter);
- log.info("Handling busy connector request from: " + request.getRequestURL().toString());
-
if (end > System.currentTimeMillis())
{
HttpClient client = new HttpClient();
15 years, 7 months
JBoss Native SVN: r2434 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 16:53:51 -0400 (Mon, 18 May 2009)
New Revision: 2434
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
Log:
oops - if condition is backwards
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 20:37:36 UTC (rev 2433)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 20:53:51 UTC (rev 2434)
@@ -79,7 +79,7 @@
log.info("Handling busy connector request from: " + request.getRequestURL().toString());
- if (end < System.currentTimeMillis())
+ if (end > System.currentTimeMillis())
{
HttpClient client = new HttpClient();
HttpMethod method = new GetMethod(this.createLocalURL(request, Collections.singletonMap(END, String.valueOf(end))));
15 years, 7 months
JBoss Native SVN: r2433 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 16:37:36 -0400 (Mon, 18 May 2009)
New Revision: 2433
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
Log:
Use new HttpClient requests, since demo app does not handle redirects.
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 19:54:34 UTC (rev 2432)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 20:37:36 UTC (rev 2433)
@@ -30,6 +30,7 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.jboss.logging.Logger;
@@ -71,8 +72,6 @@
{
new Thread(task).start();
}
-
- this.writeLocalName(request, response);
}
else
{
@@ -82,9 +81,13 @@
if (end < System.currentTimeMillis())
{
- response.sendRedirect(response.encodeRedirectURL(this.createLocalURL(request, Collections.singletonMap(END, String.valueOf(end)))));
+ HttpClient client = new HttpClient();
+ HttpMethod method = new GetMethod(this.createLocalURL(request, Collections.singletonMap(END, String.valueOf(end))));
+ client.executeMethod(method);
}
}
+
+ this.writeLocalName(request, response);
}
private class ExecuteMethodTask implements Runnable
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java 2009-05-18 19:54:34 UTC (rev 2432)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java 2009-05-18 20:37:36 UTC (rev 2433)
@@ -27,6 +27,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.jboss.logging.Logger;
/**
@@ -54,11 +57,11 @@
log.info("Sending request count redirect to: " + url);
- response.sendRedirect(url);
+ HttpClient client = new HttpClient();
+ HttpMethod method = new GetMethod(url);
+ client.executeMethod(method);
}
- else
- {
- this.writeLocalName(request, response);
- }
+
+ this.writeLocalName(request, response);
}
}
15 years, 7 months
JBoss Native SVN: r2432 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 15:54:34 -0400 (Mon, 18 May 2009)
New Revision: 2432
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
Log:
don't use connector domain
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java 2009-05-18 18:12:56 UTC (rev 2431)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java 2009-05-18 19:54:34 UTC (rev 2432)
@@ -68,7 +68,7 @@
{
ServletContext context = config.getServletContext();
context.setAttribute(PORT, Integer.valueOf(connector.getPort()));
- context.setAttribute(HOST, connector.getDomain());
+// context.setAttribute(HOST, connector.?);
}
}
@@ -84,9 +84,14 @@
protected String createLocalURL(HttpServletRequest request, Map<String, String> parameterMap)
{
ServletContext context = this.getServletContext();
- String host = (String) context.getAttribute(HOST);
- Integer port = (Integer) context.getAttribute(PORT);
- return this.createURL(request, (host != null) ? host : System.getProperty("jboss.bind.address", "localhost"), (port != null) ? port.intValue() : request.getLocalPort(), parameterMap);
+
+ String contextHost = (String) context.getAttribute(HOST);
+ String host = (contextHost != null) ? contextHost : System.getProperty("jboss.bind.address", request.getLocalName());
+
+ Integer contextPort = (Integer) context.getAttribute(PORT);
+ int port = (contextPort != null) ? contextPort.intValue() : request.getLocalPort();
+
+ return this.createURL(request, host, port, parameterMap);
}
private String createURL(HttpServletRequest request, String host, int port, Map<String, String> parameterMap)
15 years, 7 months
JBoss Native SVN: r2431 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 14:12:56 -0400 (Mon, 18 May 2009)
New Revision: 2431
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
Log:
Use local host from connector.
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java 2009-05-18 17:30:51 UTC (rev 2430)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java 2009-05-18 18:12:56 UTC (rev 2431)
@@ -69,7 +69,7 @@
for (int i = 0; i < count; ++i)
{
HttpClient client = new HttpClient();
- HttpMethod method = new HeadMethod(this.createLocalURL(request, null));
+ HttpMethod method = new HeadMethod(url);
client.executeMethod(method);
}
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java 2009-05-18 17:30:51 UTC (rev 2430)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java 2009-05-18 18:12:56 UTC (rev 2431)
@@ -26,6 +26,7 @@
import java.util.Map;
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -48,6 +49,7 @@
protected static final String DEFAULT_DURATION = "15";
protected static final String COUNT = "count";
+ private static final String HOST = "host";
private static final String PORT = "port";
private static final String JVM_ROUTE = "jvmRoute";
@@ -64,7 +66,9 @@
{
if (connector.getProtocol().startsWith("HTTP"))
{
- config.getServletContext().setAttribute(PORT, Integer.valueOf(connector.getPort()));
+ ServletContext context = config.getServletContext();
+ context.setAttribute(PORT, Integer.valueOf(connector.getPort()));
+ context.setAttribute(HOST, connector.getDomain());
}
}
@@ -79,8 +83,10 @@
protected String createLocalURL(HttpServletRequest request, Map<String, String> parameterMap)
{
- Integer port = (Integer) this.getServletContext().getAttribute(PORT);
- return this.createURL(request, "localhost", (port != null) ? port.intValue() : request.getLocalPort(), parameterMap);
+ ServletContext context = this.getServletContext();
+ String host = (String) context.getAttribute(HOST);
+ Integer port = (Integer) context.getAttribute(PORT);
+ return this.createURL(request, (host != null) ? host : System.getProperty("jboss.bind.address", "localhost"), (port != null) ? port.intValue() : request.getLocalPort(), parameterMap);
}
private String createURL(HttpServletRequest request, String host, int port, Map<String, String> parameterMap)
15 years, 7 months
JBoss Native SVN: r2430 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 13:30:51 -0400 (Mon, 18 May 2009)
New Revision: 2430
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
Log:
Use "localhost" for local urls, instead of request.getLocalName()
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java 2009-05-18 17:30:51 UTC (rev 2430)
@@ -80,7 +80,7 @@
protected String createLocalURL(HttpServletRequest request, Map<String, String> parameterMap)
{
Integer port = (Integer) this.getServletContext().getAttribute(PORT);
- return this.createURL(request, request.getLocalName(), (port != null) ? port.intValue() : request.getLocalPort(), parameterMap);
+ return this.createURL(request, "localhost", (port != null) ? port.intValue() : request.getLocalPort(), parameterMap);
}
private String createURL(HttpServletRequest request, String host, int port, Map<String, String> parameterMap)
15 years, 7 months
JBoss Native SVN: r2429 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 11:49:00 -0400 (Mon, 18 May 2009)
New Revision: 2429
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java
Log:
Use jboss-logging, instead of servlet log methods
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -30,6 +30,7 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
+import org.jboss.logging.Logger;
/**
* @author Paul Ferraro
@@ -39,6 +40,7 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -946741803216943778L;
+ private static Logger log = Logger.getLogger(ActiveSessionsLoadServlet.class);
/**
* @{inheritDoc}
@@ -48,7 +50,7 @@
protected void doHead(HttpServletRequest request, HttpServletResponse response)
{
HttpSession session = request.getSession(true);
- this.log("Handling session load request from: " + request.getRequestURL().toString() + ", using session id: " + session.getId());
+ log.info("Handling session load request from: " + request.getRequestURL().toString() + ", using session id: " + session.getId());
}
/**
@@ -62,7 +64,7 @@
String url = this.createLocalURL(request, null);
- this.log("Sending " + count + " requests to: " + url);
+ log.info("Sending " + count + " requests to: " + url);
for (int i = 0; i < count; ++i)
{
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -31,6 +31,7 @@
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
+import org.jboss.logging.Logger;
/**
* @author Paul Ferraro
@@ -40,6 +41,7 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -946741803216943778L;
+ private static Logger log = Logger.getLogger(BusyConnectorsLoadServlet.class);
private static final String END = "end";
@@ -63,7 +65,7 @@
int count = Integer.parseInt(this.getParameter(request, COUNT, "50"));
- this.log("Sending " + count + " concurrent requests to: " + url);
+ log.info("Sending " + count + " concurrent requests to: " + url);
for (int i = 0; i < count; ++i)
{
@@ -76,7 +78,7 @@
{
long end = Long.parseLong(parameter);
- this.log("Handling busy connector request from: " + request.getRequestURL().toString());
+ log.info("Handling busy connector request from: " + request.getRequestURL().toString());
if (end < System.currentTimeMillis())
{
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -33,6 +33,8 @@
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
+import org.jboss.logging.Logger;
+
/**
* @author Paul Ferraro
*
@@ -44,6 +46,7 @@
private static final String DATASOURCE = "datasource";
private static final String USER = "user";
private static final String PASSWORD = "password";
+ private static Logger log = Logger.getLogger(ConnectionPoolLoadServlet.class);
/**
* @{inheritDoc}
@@ -64,7 +67,7 @@
String user = this.getParameter(request, USER, null);
String password = this.getParameter(request, PASSWORD, null);
- this.log("Acquiring " + count + " database connections to: " + name);
+ log.info("Acquiring " + count + " database connections to: " + name);
List<Connection> connections = new ArrayList<Connection>(count);
@@ -83,7 +86,7 @@
}
finally
{
- this.log("Closing " + count + " database connections to: " + name);
+ log.info("Closing " + count + " database connections to: " + name);
for (Connection connection: connections)
{
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -30,6 +30,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.jboss.logging.Logger;
+
/**
* @author Paul Ferraro
*
@@ -38,6 +40,7 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -8183119455180366670L;
+ private static Logger log = Logger.getLogger(HeapMemoryLoadServlet.class);
private static final int MB = 1024 * 1024;
@@ -61,9 +64,9 @@
// Reserve half the available free memory
long reserve = free / 2;
- this.log((total / MB) + "MB total memory");
- this.log((free / MB) + "MB free memory");
- this.log("Reserving " + (reserve / MB) + "MB of memory");
+ log.info((total / MB) + "MB total memory");
+ log.info((free / MB) + "MB free memory");
+ log.info("Reserving " + (reserve / MB) + "MB of memory");
List<Object> list = new ArrayList<Object>(2);
@@ -84,7 +87,7 @@
Thread.currentThread().interrupt();
}
- this.log("Freeing " + (reserve / MB) + "MB of memory");
+ log.info("Freeing " + (reserve / MB) + "MB of memory");
list.clear();
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -30,6 +30,7 @@
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
+import org.jboss.logging.Logger;
/**
* @author Paul Ferraro
@@ -40,6 +41,7 @@
/** The serialVersionUID */
private static final long serialVersionUID = 2344830128026153418L;
private static final String SIZE = "size";
+ private static Logger log = Logger.getLogger(ReceiveTrafficLoadServlet.class);
/**
* @{inheritDoc}
@@ -61,7 +63,7 @@
{
long start = System.currentTimeMillis();
- this.log("Sending " + (size / 1024) + "KB packet to: " + url);
+ log.info("Sending " + (size / 1024) + "KB packet to: " + url);
PutMethod method = new PutMethod(url);
method.setRequestEntity(entity);
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -27,6 +27,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.jboss.logging.Logger;
+
/**
* @author Paul Ferraro
*
@@ -35,6 +37,7 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -5001091954463802789L;
+ private static Logger log = Logger.getLogger(RequestCountLoadServlet.class);
/**
* @{inheritDoc}
@@ -49,7 +52,7 @@
{
String url = this.createLocalURL(request, Collections.singletonMap(COUNT, String.valueOf(count - 1)));
- this.log("Sending request count redirect to: " + url);
+ log.info("Sending request count redirect to: " + url);
response.sendRedirect(url);
}
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -31,6 +31,7 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.PostMethod;
+import org.jboss.logging.Logger;
/**
* @author Paul Ferraro
@@ -41,6 +42,7 @@
/** The serialVersionUID */
private static final long serialVersionUID = -8586013739155819909L;
private static final String SIZE = "size";
+ private static Logger log = Logger.getLogger(SendTrafficLoadServlet.class);
/**
* @{inheritDoc}
@@ -51,7 +53,7 @@
{
int size = Integer.parseInt(request.getParameter(SIZE)) * 1024;
- this.log("Writing " + (size / 1024) + "KB blob to response for: " + request.getRequestURL().toString());
+ log.info("Writing " + (size / 1024) + "KB blob to response for: " + request.getRequestURL().toString());
response.getOutputStream().write(new byte[size]);
response.flushBuffer();
@@ -74,7 +76,7 @@
for (int i = 0; i < duration; ++i)
{
- this.log("Sending send traffic load request to: " + url);
+ log.info("Sending send traffic load request to: " + url);
long start = System.currentTimeMillis();
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java 2009-05-18 15:49:00 UTC (rev 2429)
@@ -26,6 +26,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.jboss.logging.Logger;
+
/**
* @author Paul Ferraro
*
@@ -34,6 +36,7 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = 5665079393261425098L;
+ private static Logger log = Logger.getLogger(SystemLoadServlet.class);
/**
* @{inheritDoc}
@@ -46,7 +49,7 @@
int duration = Integer.parseInt(this.getParameter(request, DURATION, "15")) * 1000;
- this.log("Begin handling system load request");
+ log.info("Begin handling system load request");
// Naughty loop
while (System.currentTimeMillis() - start < duration)
@@ -64,7 +67,7 @@
}
}
- this.log("End handling system load request");
+ log.info("End handling system load request");
this.writeLocalName(request, response);
}
15 years, 7 months
JBoss Native SVN: r2428 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-18 11:13:48 -0400 (Mon, 18 May 2009)
New Revision: 2428
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java
Log:
Add detailed logging
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -25,6 +25,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
@@ -46,7 +47,8 @@
@Override
protected void doHead(HttpServletRequest request, HttpServletResponse response)
{
- request.getSession(true);
+ HttpSession session = request.getSession(true);
+ this.log("Handling session load request from: " + request.getRequestURL().toString() + ", using session id: " + session.getId());
}
/**
@@ -58,6 +60,10 @@
{
int count = Integer.parseInt(this.getParameter(request, COUNT, "20"));
+ String url = this.createLocalURL(request, null);
+
+ this.log("Sending " + count + " requests to: " + url);
+
for (int i = 0; i < count; ++i)
{
HttpClient client = new HttpClient();
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -63,6 +63,8 @@
int count = Integer.parseInt(this.getParameter(request, COUNT, "50"));
+ this.log("Sending " + count + " concurrent requests to: " + url);
+
for (int i = 0; i < count; ++i)
{
new Thread(task).start();
@@ -73,6 +75,8 @@
else
{
long end = Long.parseLong(parameter);
+
+ this.log("Handling busy connector request from: " + request.getRequestURL().toString());
if (end < System.currentTimeMillis())
{
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -64,6 +64,8 @@
String user = this.getParameter(request, USER, null);
String password = this.getParameter(request, PASSWORD, null);
+ this.log("Acquiring " + count + " database connections to: " + name);
+
List<Connection> connections = new ArrayList<Connection>(count);
try
@@ -81,6 +83,8 @@
}
finally
{
+ this.log("Closing " + count + " database connections to: " + name);
+
for (Connection connection: connections)
{
try
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -39,6 +39,8 @@
/** The serialVersionUID */
private static final long serialVersionUID = -8183119455180366670L;
+ private static final int MB = 1024 * 1024;
+
/**
* @{inheritDoc}
* @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
@@ -59,6 +61,10 @@
// Reserve half the available free memory
long reserve = free / 2;
+ this.log((total / MB) + "MB total memory");
+ this.log((free / MB) + "MB free memory");
+ this.log("Reserving " + (reserve / MB) + "MB of memory");
+
List<Object> list = new ArrayList<Object>(2);
if (free > Integer.MAX_VALUE)
@@ -78,6 +84,8 @@
Thread.currentThread().interrupt();
}
+ this.log("Freeing " + (reserve / MB) + "MB of memory");
+
list.clear();
System.gc();
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -50,16 +50,20 @@
{
int duration = Integer.parseInt(this.getParameter(request, DURATION, DEFAULT_DURATION));
- int size = Integer.parseInt(this.getParameter(request, SIZE, "100")) * 1000;
+ int size = Integer.parseInt(this.getParameter(request, SIZE, "100")) * 1024;
HttpClient client = new HttpClient();
RequestEntity entity = new ByteArrayRequestEntity(new byte[size]);
+ String url = this.createLocalURL(request, null);
+
for (int i = 0; i < duration; ++i)
{
long start = System.currentTimeMillis();
- PutMethod method = new PutMethod(this.createLocalURL(request, null));
+ this.log("Sending " + (size / 1024) + "KB packet to: " + url);
+
+ PutMethod method = new PutMethod(url);
method.setRequestEntity(entity);
client.executeMethod(method);
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -47,7 +47,11 @@
if (count > 1)
{
- response.sendRedirect(this.createLocalURL(request, Collections.singletonMap(COUNT, String.valueOf(count - 1))));
+ String url = this.createLocalURL(request, Collections.singletonMap(COUNT, String.valueOf(count - 1)));
+
+ this.log("Sending request count redirect to: " + url);
+
+ response.sendRedirect(url);
}
else
{
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -49,8 +49,10 @@
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
- int size = Integer.parseInt(request.getParameter(SIZE)) * 1000;
+ int size = Integer.parseInt(request.getParameter(SIZE)) * 1024;
+ this.log("Writing " + (size / 1024) + "KB blob to response for: " + request.getRequestURL().toString());
+
response.getOutputStream().write(new byte[size]);
response.flushBuffer();
}
@@ -65,12 +67,15 @@
int duration = Integer.parseInt(this.getParameter(request, DURATION, DEFAULT_DURATION));
String size = this.getParameter(request, SIZE, "100");
+ String url = this.createLocalURL(request, Collections.singletonMap(SIZE, size));
HttpClient client = new HttpClient();
- HttpMethod method = new PostMethod(this.createLocalURL(request, Collections.singletonMap(SIZE, size)));
+ HttpMethod method = new PostMethod(url);
for (int i = 0; i < duration; ++i)
{
+ this.log("Sending send traffic load request to: " + url);
+
long start = System.currentTimeMillis();
client.executeMethod(method);
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java 2009-05-18 15:13:48 UTC (rev 2428)
@@ -46,6 +46,8 @@
int duration = Integer.parseInt(this.getParameter(request, DURATION, "15")) * 1000;
+ this.log("Begin handling system load request");
+
// Naughty loop
while (System.currentTimeMillis() - start < duration)
{
@@ -62,6 +64,8 @@
}
}
+ this.log("End handling system load request");
+
this.writeLocalName(request, response);
}
}
\ No newline at end of file
15 years, 7 months
JBoss Native SVN: r2427 - in trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo: client/load and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-17 16:45:35 -0400 (Sun, 17 May 2009)
New Revision: 2427
Removed:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ThreadCountLoadServlet.java
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/load/ServerLoadServlets.java
Log:
Remove thread count load servlet since it no longer has a corresponding metric
Renamed "Connection Pool Use" to "Connector Thread Use"
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java 2009-05-17 03:41:56 UTC (rev 2426)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java 2009-05-17 20:45:35 UTC (rev 2427)
@@ -529,10 +529,10 @@
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
loadPanel.add(targetLoadServletCombo, gridBagConstraints);
- targetLoadServletCombo.setSelectedItem(ServerLoadServlets.CONNECTION_POOL_USAGE);
- selectedLoadServlet = ServerLoadServlets.CONNECTION_POOL_USAGE;
+ targetLoadServletCombo.setSelectedItem(ServerLoadServlets.CONNECTOR_THREAD_USAGE);
+ selectedLoadServlet = ServerLoadServlets.CONNECTOR_THREAD_USAGE;
- ServerLoadParam param = ServerLoadServlets.CONNECTION_POOL_USAGE.getParams().get(0);
+ ServerLoadParam param = ServerLoadServlets.CONNECTOR_THREAD_USAGE.getParams().get(0);
targetServletParamLabel1 = new JLabel();
targetServletParamLabel1.setText(param.getLabel() + ":");
@@ -551,7 +551,7 @@
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
loadPanel.add(targetServletParamField1, gridBagConstraints);
- param = ServerLoadServlets.CONNECTION_POOL_USAGE.getParams().get(1);
+ param = ServerLoadServlets.CONNECTOR_THREAD_USAGE.getParams().get(1);
targetServletParamLabel2 = new JLabel();
targetServletParamLabel2.setText(param.getLabel() + ":");
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/load/ServerLoadServlets.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/load/ServerLoadServlets.java 2009-05-17 03:41:56 UTC (rev 2426)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/load/ServerLoadServlets.java 2009-05-17 20:45:35 UTC (rev 2427)
@@ -46,7 +46,7 @@
new ServerLoadParam("duration", "Duration",
"Number of seconds to hold the connections before returning to datasource", "15")),
- CONNECTION_POOL_USAGE("Connection Pool Use",
+ CONNECTOR_THREAD_USAGE("Connector Thread Use",
"Generates server load by tieing up threads in the webserver connections pool for a period",
"connectors",
new ServerLoadParam("count", "Number of Connections",
@@ -65,15 +65,7 @@
"cpu",
new ServerLoadParam("duration", "Duration",
"Number of seconds to maintain CPU usage", "15")),
-
- THREAD_USAGE("Thread Use",
- "Generates server load by spawning threads (which do nothing but sleep)",
- "database",
- new ServerLoadParam("count", "Number of Threads",
- "Number of threads to spawn", "50"),
- new ServerLoadParam("duration", "Duration",
- "Number of seconds threads should live before exiting", "15")),
-
+
RECEIVE_TRAFFIC_USAGE("Server Receive Traffic",
"Generates server traffic receipt load by POSTing a large byte array to the server once per second for a period",
"receive",
Deleted: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ThreadCountLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ThreadCountLoadServlet.java 2009-05-17 03:41:56 UTC (rev 2426)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/ThreadCountLoadServlet.java 2009-05-17 20:45:35 UTC (rev 2427)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.modcluster.demo.servlet;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author Paul Ferraro
- *
- */
-public class ThreadCountLoadServlet extends LoadServlet
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 4975054340996769991L;
-
- /**
- * @{inheritDoc}
- * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- @Override
- protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException
- {
- final int duration = Integer.parseInt(this.getParameter(request, DURATION, DEFAULT_DURATION)) * 1000;
-
- int count = Integer.parseInt(this.getParameter(request, COUNT, "50"));
-
- for (int i = 0; i < count; ++i)
- {
- Thread thread = new Thread()
- {
- @Override
- public void run()
- {
- try
- {
- Thread.sleep(duration);
- }
- catch (InterruptedException e)
- {
- this.interrupt();
- }
- }
- };
-
- thread.start();
- }
-
- this.writeLocalName(request, response);
- }
-}
15 years, 7 months
JBoss Native SVN: r2426 - trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-05-16 23:41:56 -0400 (Sat, 16 May 2009)
New Revision: 2426
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java
Log:
sendRequest(...) and sendRequests(...) need to use serializable versions of MCMPServerState
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java 2009-05-16 20:35:41 UTC (rev 2425)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java 2009-05-17 03:41:56 UTC (rev 2426)
@@ -689,7 +689,7 @@
{
for (Proxy proxy: this.proxies)
{
- map.put(proxy, this.sendRequest(request, proxy));
+ map.put(new MCMPServerStateImpl(proxy), this.sendRequest(request, proxy));
}
}
finally
@@ -718,7 +718,7 @@
list.add(this.sendRequest(request, proxy));
}
- map.put(proxy, list);
+ map.put(new MCMPServerStateImpl(proxy), list);
}
}
finally
15 years, 7 months