You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Carl Nygaard (カール)" <ca...@gmail.com> on 2006/07/07 03:28:29 UTC

JMeter __regexFunction

I have faith in JMeter; I just know there is some way to do this.

I'm trying to do an http post request.  The post is based on a form
that can have a variable number of parameters.  These parameters are
caused by html like this:

<select name="p" multiple id="p">  <option value="a"
selected>a</option>  <option value="b" selected>b</option> ...

Note that everything is on one line.  I would like to match every one
of the possible values in the form and submit them as selected.

I hunted through the mailing list archives and found that the
__regexFunction is a handy way to get around the problem of not having
a variable number of parameters.  So I made this up:

${__regexFunction(<option value="([^"]*)" selected>,p=$1$,ALL,&,,variableName)}

My hope was that this would result in the expression:

p=a&p=b

which could be added (with some trickery) to the parameter list of the
request.  What i get is this:

p=a

It only matches ONE of the expressions, not all of them.  I assume it
is because they are all on the same line, but despite my attempts to
use fancier regular expressions, I simply can't get it to match all of
them.  Does anyone have any ideas how to do this?

Thanks,
Carl

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


Re: JMeter __regexFunction

Posted by Carl Nygaard <cn...@hmc.edu>.
As for Geoff's advice:
Geoff has sent me a jar to try out -- thanks Geoff, i'll certainly
give that a try.  In an ideal world i won't need to add any jars to
JMeter, since this script will likely be running on various computers
and the less that needs to be kept track of the better.

As for Ricardo's advice:
I have considered using the RexEx post process as you mentioned.  How
would you suggest I join all the matches together, when there can be
up to n of them?  Can this be done in javascript or using some other
trickery?

Thanks,
Carl

On 7/7/06, Richard <rd...@siu.edu.ar> wrote:
> Have you tried with a RegEx post processor?. Maybe this could help you
> RegEx conf:
>
> Reference Name: VarName
> Regular Expression: <option value="([^"]*)" selected>
> Template: p=$1$
> Match No.: -1
> Default Value: your default value
>
> Once you've set this.... in the test the RegEx set the next variables:
>
> VarName_matchNr - the number of matches found; could be 0
> VarName_n, where n = 1,2,3 etc - the strings as generated by the template
>
> So with VarName_n you can access the matches, in your example:
> VarName_1 ==> p=a
> VarName_2 ==> p=b
>
> You have to join them and add to the parameter list.
>
> Regards
>
> Dalinger Ricardo
> Toba Programmer
> SIU - Ministerio Educaci��n y Tecnolog��a
> Argentina
>
> Carl Nygaard (���`��) wrote:
> > I have faith in JMeter; I just know there is some way to do this.
> >
> > I'm trying to do an http post request.  The post is based on a form
> > that can have a variable number of parameters.  These parameters are
> > caused by html like this:
> >
> > <select name="p" multiple id="p">  <option value="a"
> > selected>a</option>  <option value="b" selected>b</option> ...
> >
> > Note that everything is on one line.  I would like to match every one
> > of the possible values in the form and submit them as selected.
> >
> > I hunted through the mailing list archives and found that the
> > __regexFunction is a handy way to get around the problem of not having
> > a variable number of parameters.  So I made this up:
> >
> > ${__regexFunction(<option value="([^"]*)"
> > selected>,p=$1$,ALL,&,,variableName)}
> >
> > My hope was that this would result in the expression:
> >
> > p=a&p=b
> >
> > which could be added (with some trickery) to the parameter list of the
> > request.  What i get is this:
> >
> > p=a
> >
> > It only matches ONE of the expressions, not all of them.  I assume it
> > is because they are all on the same line, but despite my attempts to
> > use fancier regular expressions, I simply can't get it to match all of
> > them.  Does anyone have any ideas how to do this?
> >
> > Thanks,
> > Carl
> >
> > ---------------------------------------------------------------------
> > 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: Having 1000 threads (also fails with 500 and 200) for the test, and only ~600 in logs

Posted by Gaël LHEZ <gl...@glowria.fr>.
I'm using the console since it's quicker :)

(and does not eat up memory for Swing)

I can go up to 650 users, but I was just wandering why I add only that since
I was using 1000 threads.

Thanks for the answers :)

-----Message d'origine-----
De : Peter Lin [mailto:woolfel@gmail.com] 
Envoyé : lundi 10 juillet 2006 14:06
À : JMeter Users List
Objet : Re: Having 1000 threads (also fails with 500 and 200) for the test,
and only ~600 in logs

On 7/10/06, Gaël LHEZ <gl...@glowria.fr> wrote:
>
> Well :)
>
> If you can explain, why when I do 200 threads, with enough iteration, 
> I can go up to 190 users? :)
>
> However I understand the limits here, but I can't add machine as I'm 
> comparing to a production server.



the explanation is pretty simple really. JMeter is doing a lot of work, so
if you're testing a simple webpage, the server is able to respond much
faster than a single JMeter instance. I've been able to get up to 350
concurrent threads on Tomcat using 2 jmeter instances on 2 systems going
against a single webserver on a third system.

one way to improve things is to run jmeter in console mode, which should
help it generate higher loads (aka more concurrent requests). Though
realistically, sustaining 200 concurrent requests on the server means a lot
of traffic. 40 concurrent requests/second adds up to over 10million page
views per day.

hope that helps

peter

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.10/383 - Release Date: 07/07/2006
 


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


Re: Having 1000 threads (also fails with 500 and 200) for the test, and only ~600 in logs

Posted by Peter Lin <wo...@gmail.com>.
On 7/10/06, Gaël LHEZ <gl...@glowria.fr> wrote:
>
> Well :)
>
> If you can explain, why when I do 200 threads, with enough iteration, I
> can
> go up to 190 users? :)
>
> However I understand the limits here, but I can't add machine as I'm
> comparing to a production server.



the explanation is pretty simple really. JMeter is doing a lot of work, so
if you're testing a simple webpage, the server is able to respond much
faster than a single JMeter instance. I've been able to get up to 350
concurrent threads on Tomcat using 2 jmeter instances on 2 systems going
against a single webserver on a third system.

one way to improve things is to run jmeter in console mode, which should
help it generate higher loads (aka more concurrent requests). Though
realistically, sustaining 200 concurrent requests on the server means a lot
of traffic. 40 concurrent requests/second adds up to over 10million page
views per day.

hope that helps

peter

RE: Having 1000 threads (also fails with 500 and 200) for the test, and only ~600 in logs

Posted by Gaël LHEZ <gl...@glowria.fr>.
Well :)

If you can explain, why when I do 200 threads, with enough iteration, I can
go up to 190 users? :)

However I understand the limits here, but I can't add machine as I'm
comparing to a production server.

-----Message d'origine-----
De : Peter Lin [mailto:woolfel@gmail.com] 
Envoyé : vendredi 7 juillet 2006 20:19
À : JMeter Users List
Objet : Re: Having 1000 threads (also fails with 500 and 200) for the test,
and only ~600 in logs

getting 1000 concurrent users is actually very hard to do on a single
server. Unless the server is a SMP machine with a gigabit ethernet on a
gigabit router, it's probably going to be a pain. To simulate 1000
concurrent requests on the client side, it's going to require atleast 2
powerful systems, possibly 3. Hope that helps

peter

On 7/7/06, Gaël LHEZ <gl...@glowria.fr> wrote:
>
> Hi,
>
> I set up a test with 1000 threads (users), and let him run.
>
> - We have one user per 10 seconds, thus the ramp up is 10000
> - We have 26 samples, with 2 at least seconds between each
> - We have I iteration, which I set in a way that I*26*2 > 10000 (the 
> ramp
> up)
>
> I calculated the minimal time per each user (with I = 42), it give 
> 19.000 seconds, which is enough to have for at least 9.000 seconds, 
> 1000 users in concurrent time.
>
> But this never happens : the max user is 600.
>
> Since, I've got no error in jmeter.log, I don't understand why I can't 
> get 1000 users at a same time ?
>
> And if you think it's due to the number of threads, it do the same 
> with 200 threads : the max is only 190 (with no httpd error...)
>
> Why won't I get 1000 users concurrently?
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.10/383 - Release Date: 07/07/2006
 


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


Re: Having 1000 threads (also fails with 500 and 200) for the test, and only ~600 in logs

Posted by Peter Lin <wo...@gmail.com>.
getting 1000 concurrent users is actually very hard to do on a single
server. Unless the server is a SMP machine with a gigabit ethernet on a
gigabit router, it's probably going to be a pain. To simulate 1000
concurrent requests on the client side, it's going to require atleast 2
powerful systems, possibly 3. Hope that helps

peter

On 7/7/06, Gaël LHEZ <gl...@glowria.fr> wrote:
>
> Hi,
>
> I set up a test with 1000 threads (users), and let him run.
>
> - We have one user per 10 seconds, thus the ramp up is 10000
> - We have 26 samples, with 2 at least seconds between each
> - We have I iteration, which I set in a way that I*26*2 > 10000 (the ramp
> up)
>
> I calculated the minimal time per each user (with I = 42), it give 19.000
> seconds, which is enough to have for at least 9.000 seconds, 1000 users in
> concurrent time.
>
> But this never happens : the max user is 600.
>
> Since, I've got no error in jmeter.log, I don't understand why I can't get
> 1000 users at a same time ?
>
> And if you think it's due to the number of threads, it do the same with
> 200
> threads : the max is only 190 (with no httpd error...)
>
> Why won't I get 1000 users concurrently?
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Having 1000 threads (also fails with 500 and 200) for the test, and only ~600 in logs

Posted by Gaël LHEZ <gl...@glowria.fr>.
Hi,

I set up a test with 1000 threads (users), and let him run.

- We have one user per 10 seconds, thus the ramp up is 10000
- We have 26 samples, with 2 at least seconds between each
- We have I iteration, which I set in a way that I*26*2 > 10000 (the ramp
up)

I calculated the minimal time per each user (with I = 42), it give 19.000
seconds, which is enough to have for at least 9.000 seconds, 1000 users in
concurrent time.

But this never happens : the max user is 600.

Since, I've got no error in jmeter.log, I don't understand why I can't get
1000 users at a same time ? 

And if you think it's due to the number of threads, it do the same with 200
threads : the max is only 190 (with no httpd error...)

Why won't I get 1000 users concurrently?







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


Re: JMeter __regexFunction

Posted by Richard <rd...@siu.edu.ar>.
Have you tried with a RegEx post processor?. Maybe this could help you
RegEx conf:

Reference Name: VarName
Regular Expression: <option value="([^"]*)" selected>
Template: p=$1$
Match No.: -1
Default Value: your default value

Once you've set this.... in the test the RegEx set the next variables:

VarName_matchNr - the number of matches found; could be 0
VarName_n, where n = 1,2,3 etc - the strings as generated by the template

So with VarName_n you can access the matches, in your example:
VarName_1 ==> p=a
VarName_2 ==> p=b

You have to join them and add to the parameter list.

Regards

Dalinger Ricardo
Toba Programmer
SIU - Ministerio Educación y Tecnología
Argentina

Carl Nygaard (カール) wrote:
> I have faith in JMeter; I just know there is some way to do this.
> 
> I'm trying to do an http post request.  The post is based on a form
> that can have a variable number of parameters.  These parameters are
> caused by html like this:
> 
> <select name="p" multiple id="p">  <option value="a"
> selected>a</option>  <option value="b" selected>b</option> ...
> 
> Note that everything is on one line.  I would like to match every one
> of the possible values in the form and submit them as selected.
> 
> I hunted through the mailing list archives and found that the
> __regexFunction is a handy way to get around the problem of not having
> a variable number of parameters.  So I made this up:
> 
> ${__regexFunction(<option value="([^"]*)"
> selected>,p=$1$,ALL,&,,variableName)}
> 
> My hope was that this would result in the expression:
> 
> p=a&p=b
> 
> which could be added (with some trickery) to the parameter list of the
> request.  What i get is this:
> 
> p=a
> 
> It only matches ONE of the expressions, not all of them.  I assume it
> is because they are all on the same line, but despite my attempts to
> use fancier regular expressions, I simply can't get it to match all of
> them.  Does anyone have any ideas how to do this?
> 
> Thanks,
> Carl
> 
> ---------------------------------------------------------------------
> 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