User Tag List

Does anyone have good scripts that use binomial, uniform, or exponential distributions for simulating Vusers? The conditionals are not enough for this in the language. SilkPerformer had specific functions for generating binomial, uniform, and exponential distributions right out of the box. Our company switched tools but wants the exact same functionality (go figure!) but I can't find how to do this out of the box with LoadRunner. Since this is an important point of load testing, I'm assuming the functions are out there somewhere. Any help would be great.

------------------

2. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by AitenB:
Does anyone have good scripts that use binomial, uniform, or exponential distributions for simulating Vusers? The conditionals are not enough for this in the language.<HR></BLOCKQUOTE>

I am at a company that is currently using LoadRunner and is (thankfully, in my opinion) switching to SilkPerformer and, like you, I like to do randomized distributions during simulation but I do think this is something you can do relatively easily with LoadRunner. For a binomial distribution, you just want a probability that a given variable will contain a true value sixty percent of the time and false forty percent of the time. So you could just use a random generator of sorts. Declare an integer called random_number (or whatever you want). Then I think you can do something like:

random_number = (rand()% atoi(BoolValue))+1;

Here "BoolValue" would be either true or false and this would randomly select that. Granted, this does not get you 60/40 but you can at least use this as a base. In general, you can use this as a random number generator:

random_number = (rand()%99)+1;

As far as a uniform distribution, all you really need to do there is select between a certain set of values, say 1 to 10. Just have a random function that selects each value equally. (In other words, the probability is the same for each value from 1 to 10 being selected.) Finally, for exponential distribution, you basically have to choose a value to serve as the mean value. Then you just have to program the function, which is:

f(x) = ae^-ax

You have to have positive a and x has to be greater than or equal to zero, while e is just the base of the natural logarithm. This is just a continuous random variable. I am not sure how easy this would be to code in LoadRunner but you could probably do it. You could also simulate it, so to speak, by just declaring a variable for your mean value and then writing a random function that has the probability of containing many values slightly below your mean value and a smaller number of values that are quite a bit higher than the mean value. Also you might check the Mercury download site and see if anyone has uploaded functions of this sort. I checked briefly before posting this and did not see anything but I might have missed it.

[This message has been edited by Cryptonomic (edited 10-02-2002).]

3. Re: Using Distributions in LoadRunner

Cryptonomic --

I don't get exactly what you're talking about. How would random_number = (rand()%99)+1 help me do my distributions? That just gives a distribution of 100%, doesn't it? What I need is to be able to run certain things like transactions a certain percentage of the time to show randomized activity just like what happens in the real world.

------------------

4. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by AitenB:
What I need is to be able to run certain things like transactions a certain percentage of the time to show randomized activity just like what happens in the real world.<HR></BLOCKQUOTE>

That is what I was describing as well. For example, you could have code like this:

Obviously you have to fill in the details and, of course, you can supplement this by writing your own functions that are called as part of the transactions or even as part of the process of determining the random number selection. You could, for example, do this to randomly alter the order of transactions that are executed so that you simulate random variances in usage patterns. You could also use this to compute "artificial" think times that are meant to simulate randomized periods of when usage patterns are executed. (Just take the duration of your test and divide that by a summation of the number of your transactions.)

------------------

5. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by AitenB:
Cryptonomic --

I don't get exactly what you're talking about. How would random_number = (rand()%99)+1 help me do my distributions? That just gives a distribution of 100%, doesn't it? What I need is to be able to run certain things like transactions a certain percentage of the time to show randomized activity just like what happens in the real world.

<HR></BLOCKQUOTE>

May I just you look in the books online regarding the controller and pacing. In the action section you can create blocks and those can be weighted for randomality. I believe this is what you are looking for. If order to use this functionality you will need to move each "transaction" as you call it into its own action file within the VUGen. If you need more help on this just let us know.

------------------
Simple minds, Simple thoughts!

Doug

6. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by allogene:
In the action section you can create blocks and those can be weighted for randomality.
<HR></BLOCKQUOTE>

Wow! I didn't know you could do that. I was planning on writing up my own little method for randomizing between different action blocks within a script. Since I'm at home right now, I'm going to ask for a little more info, though I will definitely look into this in the docs tomorrow at the office.

What I would have to do is create multiple actions (Action1, Action2, Action3, etc) then group them into blocks (Block1=Action1 and Action2), then I can add randomality so that LR chooses either Block1 or BlockX randomly, correct? Is this randomizing part done as a run-time setting on the pacing tab?

Thanks!

------------------

7. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by allogene:
May I just you look in the books online regarding the controller and pacing. In the action section you can create blocks and those can be weighted for randomality. I believe this is what you are looking for.<HR></BLOCKQUOTE>

Actually Crypto's reply is exactly what I needed. The code works just as we need it. In fact, we've even modified it for some of our randomized think times. We looked at the pacing but that's not the same thing as exponential distributions. Having sections that are random defeats the purpose - it needs to be decided on a case-by-case basis. We also use this to randomize the traffic pattern.

------------------

8. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by AitenB:
Actually Crypto's reply is exactly what I needed. The code works just as we need it. In fact, we've even modified it for some of our randomized think times. We looked at the pacing but that's not the same thing as exponential distributions. Having sections that are random defeats the purpose - it needs to be decided on a case-by-case basis. We also use this to randomize the traffic pattern.

<HR></BLOCKQUOTE>

Well then this sounds like a coding issue. Since I have no experience with Silk I am not familiar with the functionality you mentioned, so it makes it a bit harder to try and see if LoadRunner has equivalant functionality. Just because we have not helped you find what you are looking for does not mean LoadRunner does not have the functionality. I would suggest you contact Mercury and ask them. They will definately let you know if it is possible and if it is not then ask them to put in a prodcut enhancement.

------------------
Simple minds, Simple thoughts!

Doug

9. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by shep_bannister:
Wow! I didn't know you could do that. I was planning on writing up my own little method for randomizing between different action blocks within a script. Since I'm at home right now, I'm going to ask for a little more info, though I will definitely look into this in the docs tomorrow at the office.

What I would have to do is create multiple actions (Action1, Action2, Action3, etc) then group them into blocks (Block1=Action1 and Action2), then I can add randomality so that LR chooses either Block1 or BlockX randomly, correct? Is this randomizing part done as a run-time setting on the pacing tab?

Thanks!

<HR></BLOCKQUOTE>

------------------
Simple minds, Simple thoughts!

Doug

10. Re: Using Distributions in LoadRunner

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by allogene:
Just because we have not helped you find what you are looking for does not mean LoadRunner does not have the functionality.<HR></BLOCKQUOTE>

??! I just said Crypto's reply helped. That code in our VuGen scripts does exactly what we need: randomized distributions with uniform and exponential distributions. So I'm not sure why you think I didn't get help. It works well. It's definitely not the same functionality as SilkPerformer but if it works, I'm not complaining.

------------------

Page 1 of 2 12 Last

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.