activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r961107 - in /activemq/sandbox/activemq-apollo-actor: ./ activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/ activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/ activemq-stomp/ activemq-stomp/src/main/scala/...
Date Wed, 07 Jul 2010 03:57:40 GMT
Author: chirino
Date: Wed Jul  7 03:57:39 2010
New Revision: 961107

URL: http://svn.apache.org/viewvc?rev=961107&view=rev
Log:
fixed a couple of shutdown cleanup issues
benchmarks now report the best out of all the samples
enabled -server jvm option for the benchmarks.

Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Delivery.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/pom.xml
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
    activemq/sandbox/activemq-apollo-actor/pom.xml

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Delivery.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Delivery.scala?rev=961107&r1=961106&r2=961107&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Delivery.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Delivery.scala
Wed Jul  7 03:57:39 2010
@@ -412,7 +412,7 @@ trait DeliverySink {
  */
 class TransportDeliverySink(var transport:Transport) extends DeliverySink {
   def full:Boolean = transport.isFull
-  def send(delivery:Delivery) = transport.oneway(delivery.message, delivery)
+  def send(delivery:Delivery) = if( transport.isConnected ) { transport.oneway(delivery.message,
delivery) }
 }
 
 /**

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala?rev=961107&r1=961106&r2=961107&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala
Wed Jul  7 03:57:39 2010
@@ -37,8 +37,8 @@ import org.apache.activemq.util.{IOHelpe
 import scala.util.matching.Regex
 
 object BaseBrokerPerfSupport {
-  var PERFORMANCE_SAMPLES = Integer.parseInt(System.getProperty("PERFORMANCE_SAMPLES", "5"))
-  var SAMPLE_PERIOD = java.lang.Long.parseLong(System.getProperty("SAMPLE_PERIOD", "3000"))
+  var PERFORMANCE_SAMPLES = Integer.parseInt(System.getProperty("PERFORMANCE_SAMPLES", "6"))
+  var SAMPLE_PERIOD = java.lang.Long.parseLong(System.getProperty("SAMPLE_PERIOD", "1000"))
 
   // Set to use tcp IO
   protected var TCP = true;
@@ -77,8 +77,7 @@ abstract class BaseBrokerPerfSupport ext
   val producers = new ArrayList[RemoteProducer]()
   val consumers = new ArrayList[RemoteConsumer]()
 
-  var spread_sheet_stats:List[(String, AnyRef)] = Nil
-
+  var samples:List[(String, AnyRef)] = Nil
 
   override protected def beforeEach() = {
     totalProducerRate.removeAllMetrics
@@ -132,11 +131,16 @@ abstract class BaseBrokerPerfSupport ext
     val template = IOHelper.readText(classOf[BaseBrokerPerfSupport].getResourceAsStream("report.html"))
     template match {
       case report_parser(report_header, _, report_footer) =>
-        val version = new String(ProcessSupport.system("git", "rev-list", "--max-count=1",
"HEAD").toByteArray).trim
+        var notes = System.getProperty("notes")
+        if( notes==null ) {
+          val version = new String(ProcessSupport.system("git", "rev-list", "--max-count=1",
"HEAD").toByteArray).trim
+          notes = "commit "+version
+        }
+
         if( !report_data.isEmpty ) {
           report_data += ",\n"
         }
-        report_data += "            ['commit "+version+"', "+spread_sheet_stats.map(x=>String.format("%.2f",x._2)).mkString(",
")+"]\n"
+        report_data += "            ['"+jsescape(notes)+"', "+samples.map(x=>String.format("%.2f",x._2)).mkString(",
")+"]\n"
         IOHelper.writeText(csvfile, report_header+report_data+report_footer)
       case _ =>
         println("could not parse template report file");
@@ -145,12 +149,27 @@ abstract class BaseBrokerPerfSupport ext
     println("Updated: "+csvfile);
     
     if( DUMP_REPORT_COLS ) {
-      spread_sheet_stats.map(_._1).foreach{x=>
+      samples.map(_._1).foreach{x=>
         println("          data.addColumn('number', '"+x+"');");
       }
     }
   }
 
+  def jsescape(value:String) = {
+    var rc = ""
+    value.foreach{ c=>
+      c match {
+        case '\n'=> rc+="\\n"
+        case '\r'=> rc+="\\r"
+        case '\t'=> rc+="\\t"
+        case '\''=> rc+="\\\'"
+        case '\"'=> rc+="\\\""
+        case _ => rc+=c
+      }
+    }
+    rc
+  }
+
   // Test all the combinations
   for( PTP<- List(true,false) ; PERSISTENT <- List(false); DURABLE <- List(false)
; size <- List(20,1024,1024*256)) {
 
@@ -476,9 +495,19 @@ abstract class BaseBrokerPerfSupport ext
     }
 
     def reportRates() = {
-      val best_sample = PERFORMANCE_SAMPLES/2
 
-      println("Checking "+(if (PTP) "ptp" else "topic")+" rates...");
+      println("Warming up...");
+      Thread.sleep(SAMPLE_PERIOD);
+      totalProducerRate.reset();
+      totalConsumerRate.reset();
+
+      println("Sampling rates");
+
+      case class Summary(producer:java.lang.Float, pdev:java.lang.Float, consumer:java.lang.Float,
cdev:java.lang.Float)
+
+      val sample_rates = new Array[Summary](PERFORMANCE_SAMPLES)
+      var best = 0;
+
       for (i <- 0 until PERFORMANCE_SAMPLES) {
         var p = new Period();
         Thread.sleep(SAMPLE_PERIOD);
@@ -489,25 +518,33 @@ abstract class BaseBrokerPerfSupport ext
           println(totalConsumerRate.getRateSummary(p));
         }
 
-        if( i == best_sample ) {
-          if( producerCount > 0 ) {
-            spread_sheet_stats = spread_sheet_stats ::: ( testName+" producer", totalProducerRate.total(p)
) :: Nil
-            if( producerCount > 1 ) {
-              spread_sheet_stats = spread_sheet_stats ::: ( testName+" producer sd", totalProducerRate.deviation
) :: Nil
-            }
-          }
-          if( consumerCount > 0 ) {
-            spread_sheet_stats = spread_sheet_stats ::: ( testName+" consumer", totalConsumerRate.total(p)
) :: Nil
-            if( consumerCount > 1 ) {
-              spread_sheet_stats = spread_sheet_stats ::: ( testName+" consumer sd", totalConsumerRate.deviation
) :: Nil
-            }
-          }
+        sample_rates(i) = Summary(totalProducerRate.total(p), totalProducerRate.deviation,
totalConsumerRate.total(p), totalConsumerRate.deviation)
+
+        val current_sum = sample_rates(i).producer.longValue + sample_rates(i).consumer.longValue
+        val best_sum = sample_rates(i).producer.longValue + sample_rates(i).consumer.longValue
+        if( current_sum > best_sum ) {
+          best = i
         }
 
         totalProducerRate.reset();
         totalConsumerRate.reset();
       }
 
+
+      if( producerCount > 0 ) {
+        samples = samples ::: ( testName+" producer", sample_rates(best).producer ) :: Nil
+        if( producerCount > 1 ) {
+          samples = samples ::: ( testName+" producer sd", sample_rates(best).pdev ) :: Nil
+        }
+      }
+      if( consumerCount > 0 ) {
+        samples = samples ::: ( testName+" consumer", sample_rates(best).consumer ) :: Nil
+        if( consumerCount > 1 ) {
+          samples = samples ::: ( testName+" consumer sd", sample_rates(best).cdev ) :: Nil
+        }
+      }
+
+
     }
   }
   

Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/pom.xml?rev=961107&r1=961106&r2=961107&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/pom.xml (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/pom.xml Wed Jul  7 03:57:39 2010
@@ -116,7 +116,6 @@
             <version>${maven-surefire-plugin-version}</version>
             <configuration>
               <failIfNoTests>true</failIfNoTests>
-              <argLine></argLine>
               <includes>
                 <include>**/StompBrokerPerfTest.*</include>
               </includes>

Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala?rev=961107&r1=961106&r2=961107&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
Wed Jul  7 03:57:39 2010
@@ -100,7 +100,7 @@ class StompProtocolHandler extends Proto
   override def onTransportConnected() = {
     outboundChannel = new TransportDeliverySink(connection.transport) {
       override def send(delivery: Delivery) = {
-        if( !connection.stopped ) {
+        if( transport.isConnected ) {
           transport.oneway(delivery.message.asInstanceOf[StompFrameMessage].frame, delivery)
         }
       }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=961107&r1=961106&r2=961107&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Wed Jul  7 03:57:39 2010
@@ -527,14 +527,14 @@ public class TcpTransport extends BaseSe
     }
 
     public void suspendRead() {
-        if( assertConnected() ) {
+        if( isConnected() ) {
             readSource.suspend();
         }
     }
 
 
     public void resumeRead() {
-        if( assertConnected() ) {
+        if( isConnected() ) {
             readSource.resume();
         }
     }

Modified: activemq/sandbox/activemq-apollo-actor/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/pom.xml?rev=961107&r1=961106&r2=961107&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/pom.xml (original)
+++ activemq/sandbox/activemq-apollo-actor/pom.xml Wed Jul  7 03:57:39 2010
@@ -492,6 +492,10 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <version>${maven-surefire-plugin-version}</version>
             <configuration>
+              <argLine>-server</argLine>
+              <systemPropertyVariables>
+                <notes>${notes}</notes>
+              </systemPropertyVariables>
               <excludes>
                 <exclude>**/**</exclude>
               </excludes>



Mime
View raw message