You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Coret Bob <b....@pinkroccade.com> on 2004/09/10 15:56:07 UTC

Addition to XSLT: percentiles

I'd like to share a piece of XSLT with you all. In the distributed report XSLT you have the minimum, maximum and average response times. I always like percentiles in my reports, mainly because performance requirements usually state something like "90% of the pages have to be loaded with 3 seconds". The 90th percentile is the smallest number that is greater than 90% of the numbers in a given set.

So just as you have the minTime and maxTime variables in the pagelist template you can add the followng variable for the 90th percentile:

<xsl:variable name="thisPercentile">
  <xsl:call-template name="percentiles">
    <xsl:with-param name="responsetimes" select="../sampleResult[@label = current()/@label]/@time" />
    <xsl:with-param name="percentile" select="0.9" />
  </xsl:call-template>
</xsl:variable>

This is the percentiles "function" which does the math:

<xsl:template name="percentiles">
  <xsl:param name="responsetimes" select="/.." />
  <xsl:param name="percentile" select="." />
  <xsl:variable name="sortedresponsetimes">
    <xsl:for-each select="$responsetimes">
        <xsl:sort data-type="number"/>
        <xsl:element name="time">
          <xsl:value-of select="."/>
        </xsl:element>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="n" select="count($responsetimes)-1" />
  <xsl:variable name="k" select="floor($percentile*$n)+1" />
  <xsl:variable name="f" select="($percentile*$n+1)-$k" />
  <xsl:variable name="a0" select="$sortedresponsetimes[1]/time[$k]" />
  <xsl:variable name="a1" select="$sortedresponsetimes[1]/time[$k+1]" />
  <xsl:value-of select="$a0+ ( $f *( $a1 - $a0))" />
</xsl:template>

The method of sorting the responsetimes can use some improvements: it works, but is looks like a hack...

To get this to work with Saxon you have to specificy version 1.1:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">


BTW, is there a place where we can share JMeter XSLT's ? I have made a "results to CSV"-XSL as well, for those interested.


With regards,
Bob Coret


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: timing question

Posted by Chuck Henson <ch...@wellinx.com>.
ah.. I see. yes that adds up correctly using that calculation, there is
between 3 and 8 seconds between each sampler.
so it is working correctly!

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com]
Sent: Thursday, September 16, 2004 12:19 PM
To: JMeter Users List; chenson@wellinx.com
Subject: Re: timing question


I don't understand the behaviour you appear to be seeing - samplers
run sequentially within a single thread, in the order in which they
appear in the test plan.

Note that time stamps by default are END time stamps - you can change
this in jmeter.properties.

S.
On Thu, 16 Sep 2004 11:18:19 -0500, Chuck Henson <ch...@wellinx.com>
wrote:
> I'm trying to stress test our web app. I've set a random timer element to
> 3000ms fixed and 5000ms variable so that my timing between samples should
be
> between 3 to 8 seconds. The samplers need to be sequential for each thread
> as some samplers are dependent upon the actions of previous samplers (some
> samplers are adding data and later samplers are removing data). I had
> expected that the samplers would be executed sequentially but, if one
> sampler takes longer than the variable time between samplers, the next
> sampler appears to be executed before the previous one is done.
>
> In the example below (from lister data written to file) Servlet a b and c
> must be run in order and b cannot start until a is complete and c cannot
> start until b is complete. The timer works fine when the test plan starts
> but as it ramps up and the number of threads increases after a while the
> server begins to bog down a little (as expected) and as it bogs down, the
> more intensive servlets take longer to respond (again as expected)
however,
> it's causing the servlets to start executing out of order which puts the
> data in a state of flux and the test is pretty much meaningless after
that.
> Note that servlet c is executed approx 6 seconds after servlet b but the
> response time for servlet b is just over 24 seconds. If servlet c is
trying
> to remove data added by servlet b we have a problem. I need servlet c to
> wait until servlet b is complete or the timer kicks in which ever is
> greater. Obviously I could increase the timer values but then I don't
> believe I'd really be stressing the app.
>
> <sampleResult timeStamp="1095280963067" dataType="text" threadName="Thread
> Group1-11" label="/servlets/SERVLET-A" time="84" res ponseMessage="Moved
> Temporarily" responseCode="302" success="true"/>
>
> <sampleResult timeStamp="1095280994327" dataType="text" threadName="Thread
> Group1-11" label="/servlets/SERVLET-B" time="24554
> " responseMessage="Moved Temporarily" responseCode="302" success="true"/>
>
> <sampleResult timeStamp="1095281000751" dataType="" threadName="Thread
> Group1-11" label="/servlets/SERVLET-C" time="3" res
> ponseMessage="Moved Temporarily" responseCode="302" success="true"/>
>
> Is there a way to have the samplers not execute until the previous sampler
> is done? Can this be accomplished with assertions?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: timing question

Posted by sebb <se...@gmail.com>.
I don't understand the behaviour you appear to be seeing - samplers
run sequentially within a single thread, in the order in which they
appear in the test plan.

Note that time stamps by default are END time stamps - you can change
this in jmeter.properties.

S.
On Thu, 16 Sep 2004 11:18:19 -0500, Chuck Henson <ch...@wellinx.com> wrote:
> I'm trying to stress test our web app. I've set a random timer element to
> 3000ms fixed and 5000ms variable so that my timing between samples should be
> between 3 to 8 seconds. The samplers need to be sequential for each thread
> as some samplers are dependent upon the actions of previous samplers (some
> samplers are adding data and later samplers are removing data). I had
> expected that the samplers would be executed sequentially but, if one
> sampler takes longer than the variable time between samplers, the next
> sampler appears to be executed before the previous one is done.
> 
> In the example below (from lister data written to file) Servlet a b and c
> must be run in order and b cannot start until a is complete and c cannot
> start until b is complete. The timer works fine when the test plan starts
> but as it ramps up and the number of threads increases after a while the
> server begins to bog down a little (as expected) and as it bogs down, the
> more intensive servlets take longer to respond (again as expected) however,
> it's causing the servlets to start executing out of order which puts the
> data in a state of flux and the test is pretty much meaningless after that.
> Note that servlet c is executed approx 6 seconds after servlet b but the
> response time for servlet b is just over 24 seconds. If servlet c is trying
> to remove data added by servlet b we have a problem. I need servlet c to
> wait until servlet b is complete or the timer kicks in which ever is
> greater. Obviously I could increase the timer values but then I don't
> believe I'd really be stressing the app.
> 
> <sampleResult timeStamp="1095280963067" dataType="text" threadName="Thread
> Group1-11" label="/servlets/SERVLET-A" time="84" res ponseMessage="Moved
> Temporarily" responseCode="302" success="true"/>
> 
> <sampleResult timeStamp="1095280994327" dataType="text" threadName="Thread
> Group1-11" label="/servlets/SERVLET-B" time="24554
> " responseMessage="Moved Temporarily" responseCode="302" success="true"/>
> 
> <sampleResult timeStamp="1095281000751" dataType="" threadName="Thread
> Group1-11" label="/servlets/SERVLET-C" time="3" res
> ponseMessage="Moved Temporarily" responseCode="302" success="true"/>
> 
> Is there a way to have the samplers not execute until the previous sampler
> is done? Can this be accomplished with assertions?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


timing question

Posted by Chuck Henson <ch...@wellinx.com>.
I'm trying to stress test our web app. I've set a random timer element to
3000ms fixed and 5000ms variable so that my timing between samples should be
between 3 to 8 seconds. The samplers need to be sequential for each thread
as some samplers are dependent upon the actions of previous samplers (some
samplers are adding data and later samplers are removing data). I had
expected that the samplers would be executed sequentially but, if one
sampler takes longer than the variable time between samplers, the next
sampler appears to be executed before the previous one is done.

In the example below (from lister data written to file) Servlet a b and c
must be run in order and b cannot start until a is complete and c cannot
start until b is complete. The timer works fine when the test plan starts
but as it ramps up and the number of threads increases after a while the
server begins to bog down a little (as expected) and as it bogs down, the
more intensive servlets take longer to respond (again as expected) however,
it's causing the servlets to start executing out of order which puts the
data in a state of flux and the test is pretty much meaningless after that.
Note that servlet c is executed approx 6 seconds after servlet b but the
response time for servlet b is just over 24 seconds. If servlet c is trying
to remove data added by servlet b we have a problem. I need servlet c to
wait until servlet b is complete or the timer kicks in which ever is
greater. Obviously I could increase the timer values but then I don't
believe I'd really be stressing the app.

<sampleResult timeStamp="1095280963067" dataType="text" threadName="Thread
Group1-11" label="/servlets/SERVLET-A" time="84" res ponseMessage="Moved
Temporarily" responseCode="302" success="true"/>

<sampleResult timeStamp="1095280994327" dataType="text" threadName="Thread
Group1-11" label="/servlets/SERVLET-B" time="24554
" responseMessage="Moved Temporarily" responseCode="302" success="true"/>

<sampleResult timeStamp="1095281000751" dataType="" threadName="Thread
Group1-11" label="/servlets/SERVLET-C" time="3" res
ponseMessage="Moved Temporarily" responseCode="302" success="true"/>


Is there a way to have the samplers not execute until the previous sampler
is done? Can this be accomplished with assertions?


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Addition to XSLT: percentiles

Posted by sebb <se...@gmail.com>.
> On Fri, 10 Sep 2004 15:56:07 +0200, Coret Bob <b....@pinkroccade.com> wrote:
> > BTW, is there a place where we can share JMeter XSLT's ? I have made a "results to CSV"-XSL as well, for those interested.

Bugzilla supports attachments, and is suitable for logging enhancement requests.

The JMeter Wiki also allows attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Addition to XSLT: percentiles

Posted by Peter Lin <wo...@gmail.com>.
that's a good idea.

we probably should add them to the website and include it in the distribution.

peter


On Fri, 10 Sep 2004 15:56:07 +0200, Coret Bob <b....@pinkroccade.com> wrote:
> I'd like to share a piece of XSLT with you all. In the distributed report XSLT you have the minimum, maximum and average response times. I always like percentiles in my reports, mainly because performance requirements usually state something like "90% of the pages have to be loaded with 3 seconds". The 90th percentile is the smallest number that is greater than 90% of the numbers in a given set.
> 
> So just as you have the minTime and maxTime variables in the pagelist template you can add the followng variable for the 90th percentile:
> 
> <xsl:variable name="thisPercentile">
>  <xsl:call-template name="percentiles">
>    <xsl:with-param name="responsetimes" select="../sampleResult[@label = current()/@label]/@time" />
>    <xsl:with-param name="percentile" select="0.9" />
>  </xsl:call-template>
> </xsl:variable>
> 
> This is the percentiles "function" which does the math:
> 
> <xsl:template name="percentiles">
>  <xsl:param name="responsetimes" select="/.." />
>  <xsl:param name="percentile" select="." />
>  <xsl:variable name="sortedresponsetimes">
>    <xsl:for-each select="$responsetimes">
>        <xsl:sort data-type="number"/>
>        <xsl:element name="time">
>          <xsl:value-of select="."/>
>        </xsl:element>
>    </xsl:for-each>
>  </xsl:variable>
>  <xsl:variable name="n" select="count($responsetimes)-1" />
>  <xsl:variable name="k" select="floor($percentile*$n)+1" />
>  <xsl:variable name="f" select="($percentile*$n+1)-$k" />
>  <xsl:variable name="a0" select="$sortedresponsetimes[1]/time[$k]" />
>  <xsl:variable name="a1" select="$sortedresponsetimes[1]/time[$k+1]" />
>  <xsl:value-of select="$a0+ ( $f *( $a1 - $a0))" />
> </xsl:template>
> 
> The method of sorting the responsetimes can use some improvements: it works, but is looks like a hack...
> 
> To get this to work with Saxon you have to specificy version 1.1:
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
> 
> BTW, is there a place where we can share JMeter XSLT's ? I have made a "results to CSV"-XSL as well, for those interested.
> 
> With regards,
> Bob Coret
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org