You are viewing a plain text version of this content. The canonical link for it is here.
Posted to olio-commits@incubator.apache.org by sh...@apache.org on 2009/03/19 17:49:17 UTC

svn commit: r756109 - in /incubator/olio/workload/rails/trunk: deploy/config.xhtml deploy/run.xml src/org/apache/olio/workload/driver/UIDriver.java src/org/apache/olio/workload/harness/OlioBenchmark.java

Author: shanti
Date: Thu Mar 19 17:49:16 2009
New Revision: 756109

URL: http://svn.apache.org/viewvc?rev=756109&view=rev
Log:
Fixes for OLIO-51, OLIO-80.
Included some cleanup and checks to ensure entries for host exist before usage (ported from PHP UIDriver.java)

Modified:
    incubator/olio/workload/rails/trunk/deploy/config.xhtml
    incubator/olio/workload/rails/trunk/deploy/run.xml
    incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/driver/UIDriver.java
    incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java

Modified: incubator/olio/workload/rails/trunk/deploy/config.xhtml
URL: http://svn.apache.org/viewvc/incubator/olio/workload/rails/trunk/deploy/config.xhtml?rev=756109&r1=756108&r2=756109&view=diff
==============================================================================
--- incubator/olio/workload/rails/trunk/deploy/config.xhtml (original)
+++ incubator/olio/workload/rails/trunk/deploy/config.xhtml Thu Mar 19 17:49:16 2009
@@ -80,15 +80,16 @@
                         <xforms:bind id="bind-dataStorage-userCommands" xforms:nodeset="fh:userCommands"/>
                     </xforms:bind>
                     <xforms:bind id="bind-reloadMedia" xforms:nodeset="reloadMedia" xforms:type="boolean"/>
+                    <xforms:bind id="bind-mediaDir" xforms:nodeset="mediaDir"/>
                 </xforms:bind>
 <!-- change here -->
                 <xforms:bind id="bind-cacheServers" xforms:nodeset="cacheServers">
                     <xforms:bind id="bind-cacheServers-hostConfig" xforms:nodeset="fa:hostConfig">
+                        <xforms:bind id="bind-cacheServers-hostPorts" xforms:nodeset="fa:hostPorts"/>
                         <xforms:bind id="bind-cacheServers-tools" xforms:nodeset="fh:tools"/>
                         <xforms:bind id="bind-cacheServers-userCommands" xforms:nodeset="fh:userCommands"/>
                     </xforms:bind>
                     <xforms:bind id="bind-cache-binPath" xforms:nodeset="cacheBinPath"/>
-                    <xforms:bind id="bind-cacheServers-serverList" xforms:nodeset="serverList"/>
                 </xforms:bind>
                 <!-- Shanti - comenting for now, as not used
                 <xforms:bind id="bind-otherServers" xforms:nodeset="otherServers">
@@ -135,10 +136,11 @@
                     <reloadDB>Reload Database</reloadDB>
                     <reloadMedia>Reload Images</reloadMedia>
                     <dbHomePath>Path for Database Home</dbHomePath>
-                    <webserverType>Webserver type(apache,lighttpd)</webserverType>
+                    <webserverType>Web Server</webserverType>
                     <webserverBinPath>Webserver bin Directory</webserverBinPath>
                     <webserverLogPath>Webserver logs Directory</webserverLogPath>
                     <webserverConfPath>Webserver config files Directory</webserverConfPath>
+                    <mediaDir>Media Directory</mediaDir>
                     <phpIniPath>php.ini Directory</phpIniPath>
                     <dbConfPath>DB config file Directory</dbConfPath>
                     <otherServers>Cache, Storage, or Other Servers</otherServers>
@@ -150,12 +152,15 @@
                     <hosts>Hosts</hosts>
                     <hostPorts>Host:Port Pairs</hostPorts>
                     <port>Port</port>
-                    <serverList>Memcached Hosts:Ports</serverList>
+                    <cacheHostPorts>Memcached Hosts:Ports</cacheHostPorts>
                     <cacheBinPath>Memcached bin Directory</cacheBinPath>
                     <pathConfig>URL Path Configurations</pathConfig>
                     <java>Java</java>
                     <php>PHP</php>
                     <rails>Rails</rails>
+                    <apache>Apache</apache>
+                    <lighttpd>lighttpd</lighttpd>
+                    <glassfish>GlassFish</glassfish>
                     <tools>Tools</tools>
                     <userCommands>User Commands</userCommands>
                     <ok>Ok</ok>
@@ -305,11 +310,25 @@
                             <xforms:hint>The server host names or IP addresses and ports in the form host:port, space separated</xforms:hint>
                             <xforms:help>Enter the server host names or IP addresses and ports in the form host:port, space separated</xforms:help>
                         </xforms:input>
-                      <xforms:input id="input-webServer-type" xforms:bind="bind-webServer-type">
-                            <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/webserverType"/>
-                            <xforms:hint>Which webserver (apache or lighttpd)</xforms:hint>
-                            <xforms:help>Enter the webserver type</xforms:help>
-                       </xforms:input>
+                        <xforms:select1 id="select1-webServer-type" xforms:bind="bind-webServer-type">
+                             <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/webserverType"/>
+                             <xforms:choices>
+                                 <xforms:item>
+                                     <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/apache"/>
+                                     <xforms:value>apache</xforms:value>
+                                 </xforms:item>
+                                 <xforms:item>
+                                     <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/lighttpd"/>
+                                     <xforms:value>lighttpd</xforms:value>
+                                 </xforms:item>
+                                 <xforms:item>
+                                     <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/glassfish"/>
+                                     <xforms:value>glassfish</xforms:value>
+                                 </xforms:item>
+                                 <xforms:hint>Choose the web server type.</xforms:hint>
+                                 <xforms:help>Choose the web server type.</xforms:help>
+                             </xforms:choices>
+                         </xforms:select1>
                         <xforms:input id="input-webServer-binPath" xforms:bind="bind-webServer-binPath">
                             <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/webserverBinPath"/>
                             <xforms:hint>Enter the path to the webserver bin directory</xforms:hint>
@@ -363,7 +382,7 @@
                         <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/dbServer"/>
                         <xforms:input id="input-dbServer-host" xforms:bind="bind-dbServer-host">
                             <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/host"/>
-                            <xforms:hint>The server host name or IP address</xforms:hint>
+                            <xforms:hint>The Database server host name or IP address. For multiple servers, enter the master first then the slaves</xforms:hint>
                             <xforms:help>Enter the server host name or IP address</xforms:help>
                         </xforms:input>
                         <xforms:input id="input-dbDriver" xforms:bind="bind-dbDriver">
@@ -439,6 +458,11 @@
                                 <xforms:help>Yes to reload the images, otherwise images not reloaded.</xforms:help>
                             </xforms:choices>
                         </xforms:select1>
+                        <xforms:input id="input-mediaDir" xforms:bind="bind-mediaDir">
+                            <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/mediaDir"/>
+                            <xforms:hint>The directory where images are stored</xforms:hint>
+                            <xforms:help>Enter the directory where the images are stored</xforms:help>
+                        </xforms:input>
                         <xforms:input id="input-dataStorage-tools" xforms:bind="bind-dataStorage-tools">
                             <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/tools"/>
                             <xforms:hint>Enter tool commands to collect statistics, separated by semi-colon</xforms:hint>
@@ -452,8 +476,8 @@
                     </xforms:group>
                     <xforms:group id="group-cacheServers">
                         <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/cacheServers"/>
-                        <xforms:input id="input-cacheServers-serverList" xforms:bind="bind-cacheServers-serverList">
-                            <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/serverList"/>
+                        <xforms:input id="input-cacheServers-hostPorts" xforms:bind="bind-cacheServers-hostPorts">
+                            <xforms:label xforms:model="benchmark-labels" xforms:ref="/labels/cacheHostPorts"/>
                             <xforms:hint>The memcached servers' [host:port] pairs, space separated</xforms:hint>
                             <xforms:help>Enter the memcached servers' [host:port] pairs, space separated</xforms:help>
                         </xforms:input>

Modified: incubator/olio/workload/rails/trunk/deploy/run.xml
URL: http://svn.apache.org/viewvc/incubator/olio/workload/rails/trunk/deploy/run.xml?rev=756109&r1=756108&r2=756109&view=diff
==============================================================================
--- incubator/olio/workload/rails/trunk/deploy/run.xml (original)
+++ incubator/olio/workload/rails/trunk/deploy/run.xml Thu Mar 19 17:49:16 2009
@@ -52,8 +52,7 @@
             <runtimeStats target="9988"/>
 	    
             <properties>
-                <property name="serverType">php</property>
-                <property name="resourcePath">/apps/faban/benchmarks/olio/resources/</property>
+                <property name="serverType">html</property>
             </properties>            
         </driverConfig>
     </fa:runConfig>
@@ -63,28 +62,28 @@
             <fa:hostPorts>webserverHost:8080</fa:hostPorts>
             <enabled>true</enabled>
             <cpus>0</cpus>
-            <tools>vmstat 10; mpstat 10; netsum -a -i 10</tools>           
+            <tools>vmstat 10; mpstat 10; iostat -xn 10; nicstat 10</tools>           
             <userCommands/>            
         </fa:hostConfig>
-        <type>apache</type>
-        <hostBinPath>/opt/coolstack/apache2/bin</hostBinPath>
-        <hostLogPath>/opt/coolstack/apache2/logs</hostLogPath>
-        <hostConfPath>/opt/coolstack/apache2/conf</hostConfPath>
-        <phpIniPath>/opt/coolstack/php5/lib</phpIniPath>
+        <type></type>
+        <hostBinPath></hostBinPath>
+        <hostLogPath></hostLogPath>
+        <hostConfPath></hostConfPath>
+        <phpIniPath></phpIniPath>
     </webServer>
     <dbServer>
         <fa:hostConfig xmlns="http://faban.sunsource.net/ns/fabanharness" xmlns:fa="http://faban.sunsource.net/ns/faban">
             <fa:host>dbHost</fa:host>
             <enabled>true</enabled>
             <cpus>0</cpus>
-            <tools>vmstat 10; mpstat 10; netsum -a -i 10</tools>
+            <tools>vmstat 10; mpstat 10; nicstat 10; iostat -xn 10</tools>
             <userCommands/>
         </fa:hostConfig>
         <dbDriver>com.mysql.jdbc.Driver</dbDriver>
-        <connectURL>jdbc:mysql://dbHost/web20ror?user=web20&amp;password=web20&amp;relaxAutoCommit=true&amp;sessionVariables=FOREIGN_KEY_CHECKS=0</connectURL>
+        <connectURL>jdbc:mysql://dbHost/olio?user=olio&amp;password=olio&amp;relaxAutoCommit=true&amp;sessionVariables=FOREIGN_KEY_CHECKS=0</connectURL>
         <reloadDB>true</reloadDB>
         <scale>50</scale>
-        <dbHomePath>/opt/coolstack/mysql_32bit</dbHomePath>
+        <dbHomePath>/opt/coolstack/mysql</dbHomePath>
         <dbConfPath>/etc</dbConfPath>
     </dbServer>
     <dataStorage>
@@ -97,17 +96,17 @@
             <userCommands></userCommands>
         </fa:hostConfig>
         <reloadMedia>false</reloadMedia>        
+		<mediaDir>/filestore</mediaDir>
     </dataStorage>
     <cacheServers>
         <fa:hostConfig xmlns="http://faban.sunsource.net/ns/fabanharness" xmlns:fa="http://faban.sunsource.net/ns/faban">
-            <fa:host></fa:host>
+		    <fa:hostPorts>cacheHost:11211</fa:hostPorts>
             <enabled>true</enabled>
             <cpus>0</cpus>
             <tools>NONE</tools>
             <userCommands/>
         </fa:hostConfig>
-        <cacheBinPath>/opt/coolstack/bin</cacheBinPath>
-        <serverList>cacheHost:11212 cacheHost:11211</serverList>
+        <cacheBinPath></cacheBinPath>
     </cacheServers>
     <!-- Shanti - commenting as not used
     <otherServers>

Modified: incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/driver/UIDriver.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/driver/UIDriver.java?rev=756109&r1=756108&r2=756109&view=diff
==============================================================================
--- incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/driver/UIDriver.java (original)
+++ incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/driver/UIDriver.java Thu Mar 19 17:49:16 2009
@@ -60,13 +60,13 @@
 //                  "Logout", "AddEvent",  "AddPerson"},
     operations = { "HomePage", "Login", "TagSearch", "EventDetail", "PersonDetail", "AddPerson", "AddEvent" },
 
-    mix = { @Row({  0, 10, 50, 35,  0, 5,  0 }), // Home Page
-            @Row({  0,  0, 30, 20, 20, 0, 30 }), // Login
-            @Row({ 20,  5, 40, 30,  0, 5,  0 }), // Tag Search
-            @Row({ 70, 20,  0,  0,  0, 5,  0 }), // Event Detail
-            @Row({  0,  0,  0, 30, 10, 0, 30 }), // Person Detail
-            @Row({ 30, 65,  0,  0,  0, 0,  0 }), // Add Person
-            @Row({  0,  0, 25, 75, 15, 0,  0 })  // Add Event
+    mix = { @Row({  0, 11, 52, 36,  0, 1,  0 }), // Home Page
+            @Row({  0,  0, 60, 20,  0, 0, 20 }), // Login
+            @Row({ 21,  6, 41, 31,  0, 1,  0 }), // Tag Search
+            @Row({ 72, 21,  0,  0,  6, 1,  0 }), // Event Detail
+            @Row({ 52,  6,  0, 31, 11, 0,  0 }), // Person Detail
+            @Row({  0,  0,  0,  0,100, 0,  0 }), // Add Person
+            @Row({  0,  0,  0,100,  0, 0,  0 })  // Add Event
           }
 )
 @NegativeExponential (
@@ -320,12 +320,12 @@
         driverMetrics = new UIDriverMetrics();
         ctx.attachMetrics(driverMetrics);
         String hostPorts = ctx.getXPathValue(
-                                "//webServer/fa:hostConfig/fa:hostPorts");
+                                "/olio/webServer/fa:hostConfig/fa:hostPorts");
         List<NameValuePair<Integer>> hostPortList =
                                             Utilities.parseHostPorts(hostPorts);
         int loadedScale = Integer.parseInt(
-                                    ctx.getXPathValue("//dbServer/scale"));
-        loadedUsers = 4 * loadedScale;
+                                    ctx.getXPathValue("/olio/dbServer/scale"));
+        loadedUsers = ScaleFactors.USERS_RATIO * loadedScale;
         if (scale > loadedScale)
             throw new FatalException("Data loaded only for " + loadedScale +
                     " concurrent users. Run is set for " + scale +
@@ -334,7 +334,7 @@
 
         //String type = ctx.getProperty("serverType");
         String type = "html";
-        String resourcePath = ctx.getProperty("resourcePath");
+        String resourcePath = ctx.getResourceDir();
         if (!resourcePath.endsWith(File.separator))
             resourcePath += File.separator;
         eventImg = new File(resourcePath + "event.jpg");
@@ -352,7 +352,10 @@
                             ctx.getClientsInDriver(), hostPortList.size());
         NameValuePair<Integer> hostPort = hostPortList.get(bucket);
 
-        baseURL = "http://" + hostPort.name + ':' + hostPort.value;
+        if (hostPort.value == null)
+            baseURL = "http://" + hostPort.name;
+        else
+            baseURL = "http://" + hostPort.name + ':' + hostPort.value;
         personDetailURL = baseURL + "/users/";
         tagSearchURL = baseURL + "/events/tag_search/";
         tagCloudURL = baseURL + "/tagCloud." + type;
@@ -377,7 +380,10 @@
         addPersonStatics = populateList(ADDPERSON_STATICS);
         addEventStatics = populateList(ADDEVENT_STATICS);
 
-        loginHeaders.put("Host", hostPort.name + ':' + hostPort.value);
+       if (hostPort.value == null)
+            loginHeaders.put("Host", hostPort.name);
+        else
+            loginHeaders.put("Host", hostPort.name + ':' + hostPort.value);
         loginHeaders.put("User-Agent", "Mozilla/5.0");
         loginHeaders.put("Accept", "text/xml.application/xml,application/" +
                 "xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;" +
@@ -391,6 +397,7 @@
 
         isLoggedOn = false;
         isCached = cached();
+// Shanti: Why are we creating httpClient here ?
         httpClient = new HttpClient();
         httpClient.setConnectionTimeout(5000);
     }
@@ -504,7 +511,7 @@
 
     @BenchmarkOperation (
         name    = "AddEvent",
-        max90th = 3,
+        max90th = 4,
         timing  = Timing.MANUAL
     )
     public void doAddEvent() throws Exception {
@@ -827,8 +834,8 @@
     }
 
     public int selectUserID() {
-        return random.random(0,3) * ScaleFactors.activeUsers +
-                                                        ctx.getThreadId() + 1;
+        return random.random(0, ScaleFactors.USERS_RATIO - 1) *
+                     ScaleFactors.activeUsers + ctx.getThreadId() + 1;
     }
 
 
@@ -996,6 +1003,7 @@
                 el[2].passed = Boolean.FALSE;
             }
 
+// Shanti: This should be 3. Changed to 2.5 temporarily
             el[3] = new Element();
             el[3].description = "Average images loaded per Home Page";
             el[3].target = "&gt;= 2.5";

Modified: incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java?rev=756109&r1=756108&r2=756109&view=diff
==============================================================================
--- incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java (original)
+++ incubator/olio/workload/rails/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java Thu Mar 19 17:49:16 2009
@@ -27,10 +27,12 @@
 import com.sun.faban.harness.RunContext;
 import com.sun.faban.harness.engine.ApacheHttpdService;
 import com.sun.faban.harness.engine.LighttpdService;
+import com.sun.faban.harness.engine.GlassfishService;
 import com.sun.faban.harness.engine.MemcachedService;
 
 import com.sun.faban.harness.engine.WebServerService;
 import java.io.File;
+import java.util.List;
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.logging.Logger;
@@ -53,73 +55,12 @@
     static Logger logger = Logger.getLogger(
                                         OlioBenchmark.class.getName());
     int totalRunningTimeInSecs = 0;
-    private LinkedHashSet<String> hostsSet;
-    private ArrayList<NameValuePair<Integer>> hostsPorts;    
+	private List<NameValuePair<Integer>> memcacheServers;
     private String webServerBinPath, webServerLogPath, webServerConfPath;
     private String webServerPidPath, phpIniPath, cacheBinPath, dbConfPath;
     WebServerService webServerService;
     MemcachedService memcachedService = MemcachedService.getHandle();
 
-    /**
-     * Allows benchmark to validate the configuration file. Note that no
-     * execution facility is available during validation.
-     *
-     * @throws Exception if any error occurred.
-     * @see com.sun.faban.harness.RunContext#exec(com.sun.faban.common.Command)
-     */
-    public void validate() throws Exception {
-        params = getParamRepository();
-        params.setParameter("fa:runConfig/fd:driverConfig" +
-                "[@name='UIDriver']/fd:properties/fd:property" +
-                "[@name='resourcePath']",
-                getBenchmarkDir() + "resources" + File.separator);
-
-        //cache servers get list of servers for the host
-        String cacheServers = params.getParameter("cacheServers/serverList");
-
-        // replacing all the newline characters and other white space
-        // characters with a blank space
-        cacheServers = cacheServers.replaceAll("\\s", " ");
-
-        // Find the patterns that have either hostname or hostname:port values
-        Pattern p1 = Pattern.compile("([a-zA-Z_0-9-\\.]+):?(\\w*)\\s*");
-        Matcher m1 = p1.matcher(cacheServers + ' '); // add a whitespace at end
-
-        hostsSet = new LinkedHashSet<String>();
-        hostsPorts = new ArrayList<NameValuePair<Integer>>();
-
-        //need to get these data structures for restarting memcache servers for RunContext
-
-        //  Fill up the hosts set with names of all the hosts
-        for (boolean found = m1.find(); found; found = m1.find()) {
-            NameValuePair<Integer> hostPort = new NameValuePair<Integer>();
-            hostPort.name = m1.group(1);
-            String port = m1.group(2);
-            if (port != null && port.length() > 1)
-                hostPort.value = new Integer(port);
-            else
-                hostPort.value = 11211;
-            //logger.info("with port number " + hostPort.value);
-            hostsSet.add(hostPort.name);
-            hostsPorts.add(hostPort);
-        }
-
-        // Now extract the unique hosts
-        StringBuffer hosts = new StringBuffer();
-        for (String host : hostsSet) {
-            hosts.append(host);
-            hosts.append(' ');
-        }
-
-        // Update the unique hosts to the host filed and save
-        String cacheHosts = hosts.toString().trim();
-        params.setParameter("cacheServers/fa:hostConfig/fa:host", cacheHosts);
-        logger.info("Memcached Hosts: " + cacheHosts);
-
-        params.save();
-        super.validate();
-
-    }
 
     /**
      * This method is called to configure the specific benchmark run
@@ -130,6 +71,8 @@
      */
     public void configure() throws Exception {
         
+		params = getParamRepository();
+
         //Obtaining configuration parameters
         String webserverType = params.getParameter("webServer/type");
  
@@ -137,30 +80,42 @@
         webServerLogPath = params.getParameter("webServer/hostLogPath");
         webServerConfPath = params.getParameter("webServer/hostConfPath");
         webServerPidPath = params.getParameter("webServer/hostPidPath");
-        phpIniPath = params.getParameter("webServer/phpIniPath");
         cacheBinPath = params.getParameter("cacheServers/cacheBinPath");
         dbConfPath = params.getParameter("dbServer/dbConfPath");
-        String dbhost = params.getParameter("dbServer/fa:hostConfig/fa:host");
-        String webhost = params.getParameter("webServer/fa:hostConfig/fa:host");
-        /*
-       if (webserverType.equals("apache")) {
-            webServerService = ApacheHttpdService.getHandle();                           
-            RunContext.getFile(webhost, webServerConfPath +
-                    File.separator + "httpd.conf",
-                            RunContext.getOutDir() + "httpd.conf." + webhost);
-       } else {
+        String[] dbhosts = params.getParameter(
+                            "dbServer/fa:hostConfig/fa:host").split(" ");
+        String[] webhosts = params.getParameter(
+                            "webServer/fa:hostConfig/fa:host").split(" ");
+
+        if ("apache".equals(webserverType)) {
+            webServerService = ApacheHttpdService.getHandle();
+            for (String webhost : webhosts) {
+                RunContext.getFile(webhost, webServerConfPath +
+                        File.separator + "httpd.conf", RunContext.getOutDir() +
+                        "httpd_conf.log." + getHostName(webhost));
+            }
+        } else if ("lighttpd".equals(webserverType)) {
             webServerService = LighttpdService.getHandle();
-            RunContext.getFile(webhost, webServerConfPath + 
-                    File.separator + "lighttpd.conf",
-                            RunContext.getOutDir() + "lighttpd.conf." + webhost);
-       }
-       */
-        /* RunContext.getFile(webhost, phpIniPath + "/php.ini",
-                            RunContext.getOutDir() + "php.ini." + webhost);
-
-        RunContext.getFile(dbhost, dbConfPath + "/my.cnf",
-                RunContext.getOutDir() + "my.cnf." + dbhost);
-        */
+            for (String webhost : webhosts) {
+                RunContext.getFile(webhost, webServerConfPath +
+                        File.separator + "lighttpd.conf",
+                        RunContext.getOutDir() + "lighttpd_conf.log." +
+                        getHostName(webhost));
+            }
+        } else if ("glassfish".equals(webserverType)) {
+            webServerService = GlassfishService.getHandle();
+            for (String webhost : webhosts) {
+                RunContext.getFile(webhost, webServerConfPath +
+                        File.separator + "domain.xml",
+                        RunContext.getOutDir() + "domain_xml.log." +
+                        getHostName(webhost));
+            }
+        }
+ 
+        for (String dbhost : dbhosts) {
+            RunContext.getFile(dbhost, dbConfPath + "/my.cnf",
+            RunContext.getOutDir() + "my_cnf.log." + getHostName(dbhost));
+        }
 
         // Reloading database and media as necessary.
         boolean reloadDB = Boolean.parseBoolean(
@@ -175,27 +130,34 @@
         CommandHandle dbHandle = null;
         CommandHandle mediaHandle = null;
         if (reloadDB) {
-            String dbHost =
-                    params.getParameter("dbServer/fa:hostConfig/fa:host");
+           logger.info("Reloading the database for " + scale + " users!");
+            String dbhost = dbhosts[0];
             String driver = params.getParameter("dbServer/dbDriver");
             String connectURL = params.getParameter("dbServer/connectURL");
             // Un-escape the URL.
             connectURL = connectURL.replace("&amp;", "&");
-            Command c = new Command("-Dcommit.tx=false " +
-                                    "org.apache.olio.workload.loader.LoadController " +
-                                    driver + ' ' + connectURL + ' ' + scale);
+            ArrayList<String> cmdList = new ArrayList<String>();
+            cmdList.add("-Dcommit.tx=false");
+            cmdList.add("org.apache.olio.workload.loader.LoadController");
+            cmdList.add(driver);
+            cmdList.add(connectURL);
+            cmdList.add(String.valueOf(scale));
+            Command c = new Command(cmdList);
+
             c.setSynchronous(false);
-            dbHandle = java(dbHost, c);
+            dbHandle = java(dbhost, c);
         }
 
         if (reloadMedia) {
+            logger.info("Reloading images/media for " + scale + " users!");
             String mediaHost = params.getParameter(
                                         "dataStorage/fa:hostConfig/fa:host");
-            Command c = new Command("loader.pl -d sfbay.sun.com -s " + scale);
+            String mediaDir = params.getParameter("dataStorage/mediaDir");
+            Command c = new Command("org.apache.olio.workload.fsloader.FileLoader",
+                        getBenchmarkDir() + "resources", mediaDir,
+                        String.valueOf(scale));
             c.setSynchronous(false);
-            c.setStreamHandling(Command.STDOUT, Command.TRICKLE_LOG);
-            c.setStreamHandling(Command.STDERR, Command.TRICKLE_LOG);            
-            mediaHandle = exec(mediaHost, c);
+            mediaHandle = java(mediaHost, c);
         }
         
         if (dbHandle != null) {
@@ -213,70 +175,53 @@
 		}
 
         //start the memcache servers
-        /*int index = 0;
-        String memServers[] = new String[hostsPorts.size()];
-        int ports[] = new int[hostsPorts.size()];
-        for (NameValuePair<Integer> thisCacheServer : hostsPorts) {
+        /************
+        memcacheServers =
+                 params.getHostPorts("cacheServers/fa:hostConfig/fa:hostPorts");
+
+         // Assign the default port.
+         for (NameValuePair<Integer> hostPort : memcacheServers) {
+             if (hostPort.value == null)
+                 hostPort.value = 11211;
+         }
+
+        int index = 0;
+        String memServers[] = new String[memcacheServers.size()];
+        int ports[] = new int[memcacheServers.size()];
+        for (NameValuePair<Integer> thisCacheServer : memcacheServers) {
             memServers[index] = thisCacheServer.name;
             ports[index++] = thisCacheServer.value;
-        } 
+        }
         memcachedService.setup(memServers, ports, "-u mysql -m 256",
                 cacheBinPath);
         if ( !memcachedService.restartServers())
             throw (new Exception("Memcached server(s) restart failed"));
-        
+
+        *********/
         
         // Now start the web servers
-        String ahosts[] = new String[1];
-        ahosts[0] = webhost;
-        webServerService.setup(ahosts, webServerBinPath, webServerLogPath, 
-                webServerConfPath, webServerPidPath);
-        if ( !webServerService.restartServers())
-            throw (new Exception("Webserver(s) restart failed"));
-        */
+        if (webServerService != null) {
+            webServerService.setup(webhosts, webServerBinPath, webServerLogPath,
+                                    webServerConfPath, webServerPidPath);
+            if (!webServerService.restartServers())
+                throw (new Exception("Webserver(s) restart failed"));
+        }
+
+        //calculate total running time, including rampUp, steadyState,
+        // and rampDown
+        String rampUp = params.getParameter(
+                               "fa:runConfig/fa:runControl/fa:rampUp");
+        String steadyState = params.getParameter(
+                               "fa:runConfig/fa:runControl/fa:steadyState");
+        String rampDown = params.getParameter(
+                               "fa:runConfig/fa:runControl/fa:rampDown");
+
+        this.totalRunningTimeInSecs = Integer.parseInt(rampUp) +
+                Integer.parseInt(steadyState) + Integer.parseInt(rampDown);
+
         super.configure();
     }
 
-     /**
-      * override DefaultBenchmark's start method so memcache stats can be
-      * collected via the Web20benchmark harness class
-      */
-    public void start() throws Exception {
-
-         //get the server list
-         String cacheServers = params.getParameter("cacheServers/serverList");
-         String[] cacheHosts = params.getTokenizedValue(
-                                        "cacheServers/fa:hostConfig/fa:host");
-         String rampUp = params.getParameter(
-                                "fa:runConfig/fa:runControl/fa:rampUp");
-         String steadyState = params.getParameter(
-                                "fa:runConfig/fa:runControl/fa:steadyState");
-         String rampDown = params.getParameter(
-                                "fa:runConfig/fa:runControl/fa:rampDown");
-         String interval = params.getParameter("fa:runConfig/" +
-                 "fd:driverConfig[@name='UIDriver']/fd:stats/fd:interval");
-
-
-         //calculate total running time, including rampUp, steadyState,
-         // and rampDown
-         this.totalRunningTimeInSecs = Integer.parseInt(rampUp) +
-                 Integer.parseInt(steadyState) + Integer.parseInt(rampDown);
-
-//         Command statsCommand = new Command(
-//                 "com.sun.web20.util.MemCacheUtility " + cacheServers + " -s "
-//                 + rampUp + " -e " + steadyState + " -i " + interval);
-//         statsCommand.setSynchronous(false);
-//         statsCommand.setStreamHandling(Command.STDOUT, Command.CAPTURE);
-//         statsCommand.setOutputFile(Command.STDOUT,  RunContext.getOutDir() +
-//                 "memcachestats.log." + getHostName(cacheHosts[0]));
-         // Use the real name of the first host.
-
-         super.start();
-
-//         logger.info("Launching memcache stats collection with " +
-//                        "interval time of " + interval);
-//         RunContext.java(statsCommand);
-     }
     
     /* override DefaultBenchmark's end method to collect apache log file
      * via the OlioBenchmark harness class
@@ -290,13 +235,23 @@
         //logger.info("Stopping Memcached servers");
         //memcachedService.stopServers();
         
-        // xfer apache logs
-        //logger.info("Transferring Apache error logs");
-        //webServerService.xferLogs(totalRunningTimeInSecs);
-   
-        // stop apache servers
-        //logger.info("Stopping Apache servers");
-        //webServerService.stopServers();
+        if (webServerService != null) {
+            // xfer logs
+            logger.info("Transferring webserver error logs");
+            webServerService.xferLogs(totalRunningTimeInSecs);
+
+            // stop web servers
+            logger.info("Stopping web servers");
+            webServerService.stopServers();
+        }
     }
     
+    /* Override DefaultBenchmark's kill method to stop the servers.
+     */
+    public void kill() throws Exception {
+        // memcachedService.stopServers();
+        if (webServerService != null)
+            webServerService.kill();
+        super.kill();
+    }
 }