I believe it should be valid.  Would there be a way to have an additional
variable that could be a "user" identifier so to speak, so that we don't
have the same user in two places at once?  Such as using the thread and
group number to make a user identifier that would be unique for each run
through the CSV list or would that be as simple as an actual counter?

I will have to look over that code when I am back at my dev pc.

Thanks again for your input!

On Thu, Dec 9, 2010 at 7:31 PM, Deepak Shetty <[email protected]> wrote:

> hi
> a. so within a thread , a timestamp will always increment so that isnt a
> problem. however the question is , is the following scenario valid?
>
> Thread 1
> 1, 2, 2010-12-9T11:15:00
> rest increment
>
> Thread 2
> 1, 2, 2010-12-9T11:15:00
> rest increment may or may not match other values in thread 1
>
> is this allowed ? If the answer is no , im curious , you have requests
> arriving concurrently , why cant they have the same value if they arrive at
> exactly the same time (different users)?
>
>
> b. This is an example of the way you can implement some custom stuff.
> The jar file source included is available here(minimum java 1.5 , if you
> need lower than this you will have to change the atomic Integer to a normal
> one and synchronize the method) -
>
> http://cid-1bd02fe33f80b8ac.office.live.com/self.aspx/Public/jmeter/StaticCounter/staticcounter.jar
>
> Change the code(org.md.counter.StaticCounter.java) as you need , compile
> into a jar and drop this jar into $JMETER_HOME/lib (or to test you can
> directly drop the jar into your lib).
>
> Then access the incremented shared value as
> ${__BeanShell(org.md.counter.StaticCounter.getNewValue())} sample JMX file
> here
>
> http://cid-1bd02fe33f80b8ac.office.live.com/self.aspx/Public/jmeter/StaticCounter/StaticCounterTest.jmx
>
> you can also change the java code to implement what you need (i.e. return a
> Date string formatted as you want, or added as you want)
>
>
> regards
> deepak
>
>
>
>
> On Thu, Dec 9, 2010 at 5:03 PM, Josh Abts <[email protected]> wrote:
>
> > No, they should not have the same timestamp.  That is the problem,
> > basically
> > the coordinates in the CSV are organized in a "route" so the timestamps
> > have
> > to be successive or the route will be out of order.  Essentially this
> will
> > test a route over and over with time constantly moving forward (no
> repeated
> > time stamps, but repeated coordinates).  A further description:
> >
> > Thread 1
> > 1, 2, 2010-12-9T11:15:00
> > 3, 4, 2010-12-9T11:15:10
> > 5, 6, 2010-12-9T11:15:30
> >
> > Thread 2
> > 1, 2, 2010-12-9T11:15:20
> > 3, 4, 2010-12-9T11:15:40
> > 5, 6, 2010-12-9T11:15:50
> >
> > This would be acceptable.  It would also be nice if the time was
> > configurable (could specify a starting time and the amount by which each
> > successive entry should increment, but that wouldn't be necessary.
> >
> > Thanks again Deepak!
> >
> > On Thu, Dec 9, 2010 at 6:53 PM, Deepak Shetty <[email protected]> wrote:
> >
> > > hi
> > > so why not use a timestamp (different threads may have same values , is
> > > this
> > > allowed?)
> > > http://jakarta.apache.org/jmeter/usermanual/functions.html#__time
> > > again we can help you write a shared incrementing counter , the only
> > > question is do you really need it or whether there are simpler ways.
> > > regards
> > > deepak
> > >
> > >
> > > On Thu, Dec 9, 2010 at 4:47 PM, Josh Abts <[email protected]>
> > wrote:
> > >
> > > > I am not exactly sure how to add a class to do this like you
> mentioned.
> > > > Still new to JMeter.
> > > >
> > > > Basically what I am trying to do is I have a list of coordinates in a
> > > CSV.
> > > > Each HTTP request contains a pair of coordinates (from the CSV) and
> > then
> > > a
> > > > timestamp.  But the timestamp should be increasing by some value
> > > > continuously (persisting throughout runs).  As a very simple example,
> > > > assume
> > > > the csv contains 3 pairs of values {1,2; 3,4; 5,6}  The requests
> would
> > > look
> > > > something like this:
> > > >
> > > > http://myurl/?a=1&b=2&c=2010-12-9T11:15:00
> > > > http://myurl/?a=3&b=4&c=2010-12-9T11:15:10
> > > > http://myurl/?a=5&b=6&c=2010-12-9T11:15:20
> > > > http://myurl/?a=1&b=2&c=2010-12-9T11:15:30
> > > > ...etc.
> > > >
> > > > So we can't easily add values into the CSV because we want the time
> to
> > > > continuously count up say if we had 200 threads in a forever loop for
> 5
> > > > minutes.  Between runs it is fine if the time resets, but there
> should
> > be
> > > > persistence among threads and loops.
> > > >
> > > > I was able to get the CSV to loop properly, its just the time
> > persistence
> > > > that is the issue.
> > > >
> > > > Any ideas, samples/pointers?
> > > >
> > > > Thanks for the help!
> > > > Josh
> > > >
> > > > On Thu, Dec 9, 2010 at 4:59 PM, Deepak Shetty <[email protected]>
> > wrote:
> > > >
> > > > > Hi
> > > > > variables arent shared across threads (even in the same thread
> group)
> > > > > Properties are shared , but when you use multiple threads then you
> > need
> > > > > some
> > > > > way to synchronize access so that only one thread increments the
> > > counter
> > > > at
> > > > > any one time. You could do this with Beanshell , but possibly it
> will
> > > be
> > > > > simpler to write a java class that holds a static counter that
> > > increments
> > > > > synchronously and just call it in a beanshell function to give you
> > your
> > > > > number (avoids having the sampler in your results).
> > > > >
> > > > > However the first question to ask is why do you need actually this
> ?
> > or
> > > > do
> > > > > you know how many numbers you need in advance (or a maximum) ? if
> you
> > > do
> > > > > then you can just generate a CSV file before you run your test(as
> > part
> > > of
> > > > > your ant build or as a separate threadgroup or something) that has
> > the
> > > > > numbers and use a CSV data set config (you can choose the sharing
> > mode
> > > > > option that says all threads or current thread group)
> > > > >
> > > > > regards
> > > > > deepak
> > > > >
> > > > > On Thu, Dec 9, 2010 at 2:50 PM, Josh Abts <[email protected]
> >
> > > > wrote:
> > > > >
> > > > > > Hello all,
> > > > > >
> > > > > > So I am a little confused with how variables are working in a
> > single
> > > > > Thread
> > > > > > Group.
> > > > > >
> > > > > > I have attached a "User Defined Variables" config element to my
> > > thread
> > > > > > group.  From there I setup a HTTP Request sampler under the
> thread
> > > > group.
> > > > > >  I
> > > > > > also under the thread group have a BeanShell Sampler with a
> script
> > > that
> > > > > > basically acts as a special counter to modify the User defined
> > > > variables
> > > > > > that are used in the Http request.
> > > > > >
> > > > > > But when I run the test using say 3 threads and 1 loop, it only
> > makes
> > > 3
> > > > > > http
> > > > > > requests using the same value of the variable (the initial).  If
> I
> > > run
> > > > it
> > > > > > with 1 thread and 3 loops, it works as intended, giving 3
> different
> > > > > values
> > > > > > properly incremented by the BeanShell sampler.
> > > > > >
> > > > > > In reading I ran across something that mentioned using JMeter
> > > > Properties
> > > > > to
> > > > > > share values between threads.  But even with that I am still not
> > able
> > > > to
> > > > > > get
> > > > > > it to properly use the values.
> > > > > >
> > > > > > What is the proper/best way to have a shared value among all the
> > > > threads
> > > > > so
> > > > > > that it increments properly?  And is a BeanShell sampler the
> proper
> > > way
> > > > > to
> > > > > > ensure it increments properly?  I am using a CSV data set config
> > for
> > > > the
> > > > > > http request for two variables in it.  So essentially the CSV has
> a
> > > > > static
> > > > > > list of values that is looped through but the counter should keep
> > > going
> > > > > up
> > > > > > independently of that and just tags those values.
> > > > > >
> > > > > > My test hierarchy looks as such:
> > > > > >
> > > > > > Test plan
> > > > > >   |- Thread Group
> > > > > >      |- Http Request
> > > > > >         |-Simple Data Writer
> > > > > >      |- BeanShell Sampler
> > > > > >   |- User Defined Variables
> > > > > >
> > > > > > Hopefully that is clear enough, if not, let me know I can provide
> > any
> > > > > > additional details/samples.
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > > --
> > > > > > Joshua Abts
> > > > > >
> > > > >
> > >
> >
>



-- 
Joshua Abts
IT Specialist
VisTracks, Inc.
[email protected]
(630) 596-5426

Reply via email to