jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Problem with CSVRead and multithread
Date Tue, 01 Aug 2006 16:00:35 GMT
On 01 Aug 2006 16:18:14 +0200, mart@interia.pl <mart@interia.pl> wrote:
> Hello,
>
> Sorry for breaking the thread, I've had problem with post.
>
>
> >> As long as I run one-thread tests all seems to be working properly. The problem
> >> begins in case of number of threads. CSVRead allows to manage file pointers
in each
> >> thread independently but - here is the catch - each time I load value from

They are not independent. There is only one pointer to the next free row.

CSV in
> >> new thread - I'm given not the first value from file, but the next to previously
> >> read by another thread. So - I cannot operate on the same whole file with number
of
> >> threads.
> >

No idea what that means.

> > Did you remember to add a next() command?
> >
>
> of course. I'm afraid you haven't catch the problem - it is not with switching to next.
It is unable to switch to previous one (e.g. first one).
>

Still not clear what you are trying to do.

> > I've tried to use *ALIAS statement, but it doesn't work for me. There are no
> > examples of *ALIAS in manual nor in mailing lists.
> >
CSVRead(file,*ALIAS) - open file and assign to ALIAS
CSVRead(*ALIAS,0) - read column 0

> > I've tried also CSV Data Set Config and StringFromFile either - but both of them
are
> > unusual in this context.
>
> CSV Data Set  is the preferred way to read from a file.
>
> I've tried as I've written. But CSV Data Set is not "thread safe". Every "fetch" (reference
to ${var} defined in CSV Data Set) returns the next value from file, independently of thread
id.
>

This is intentional.

> More detailed:
>
> This is a simple test plan:
>
> Simple Controller
>  CSV Data Set Config (->${moduleId}, Recycle on EOF = false)
> Loop Controller (x6)
>  HTTP Request (diagnostic only)
>
> Http request contains two diagnostic parameters (thread Id and read module Id) and refers
to diagnostic script. Both the parameters are written to log file by mentioned script.
>
> Scenario file contents:
> 12
> 23
> 10
> 15
> END
>
>
> Running in 3 threads I produces following results:
> 2006-08-01 16:06:00     127.0.0.1       thread:1,module:12
> 2006-08-01 16:06:00     127.0.0.1       thread:1,module:12
> 2006-08-01 16:06:00     127.0.0.1       thread:1,module:12
> 2006-08-01 16:06:00     127.0.0.1       thread:2,module:23
> 2006-08-01 16:06:01     127.0.0.1       thread:1,module:12
> 2006-08-01 16:06:01     127.0.0.1       thread:2,module:23
> 2006-08-01 16:06:01     127.0.0.1       thread:1,module:12
> 2006-08-01 16:06:01     127.0.0.1       thread:2,module:23
> 2006-08-01 16:06:01     127.0.0.1       thread:3,module:10
> 2006-08-01 16:06:01     127.0.0.1       thread:1,module:12
> 2006-08-01 16:06:01     127.0.0.1       thread:2,module:23
> 2006-08-01 16:06:01     127.0.0.1       thread:3,module:10
> 2006-08-01 16:06:01     127.0.0.1       thread:2,module:23
> 2006-08-01 16:06:02     127.0.0.1       thread:3,module:10
> 2006-08-01 16:06:02     127.0.0.1       thread:2,module:23
> 2006-08-01 16:06:02     127.0.0.1       thread:3,module:10
> 2006-08-01 16:06:02     127.0.0.1       thread:3,module:10
> 2006-08-01 16:06:02     127.0.0.1       thread:3,module:10
>
> You can see that every thread reads one value, independently of number of requests. The
value is up to the run order (1st thread takes 1st value, 2nd thread - 2nd value, etc).
>
> Alternatively when I move CSV Data Set Config into Loop Controller before Http Request
the results are:
> 2006-08-01 16:08:23     127.0.0.1       thread:1,module:12
> 2006-08-01 16:08:23     127.0.0.1       thread:1,module:23
> 2006-08-01 16:08:24     127.0.0.1       thread:1,module:10
> 2006-08-01 16:08:24     127.0.0.1       thread:2,module:15
> 2006-08-01 16:08:24     127.0.0.1       thread:1,module:END
> 2006-08-01 16:08:24     127.0.0.1       thread:2,module:<EOF>
> 2006-08-01 16:08:24     127.0.0.1       thread:1,module:<EOF>
> 2006-08-01 16:08:24     127.0.0.1       thread:2,module:<EOF>
> 2006-08-01 16:08:24     127.0.0.1       thread:3,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:1,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:2,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:3,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:2,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:3,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:2,module:<EOF>
> 2006-08-01 16:08:25     127.0.0.1       thread:3,module:<EOF>
> 2006-08-01 16:08:26     127.0.0.1       thread:3,module:<EOF>
> 2006-08-01 16:08:26     127.0.0.1       thread:3,module:<EOF>
>
> It is also unusual for me, despite of (easy to fix) EOF problem.
>
> This is why I've drop this solution as unusual.
>
>
> > Perhaps is there any undocumented function of CSVRead allowing to fetch the value
in
> > next thread from the very beginning of file?
> >

No, the next read will always take place from the next "free" row in the file.
When the end of the file is reached, CSVRead wraps round to the first row.

> > Can anybody help me? Any suggestions are welcome.
> >

I'm still not clear on how you expect multiple threads to interact.

CSVRead, StringFromFile and CSV Data Set are all designed to be used
in much the same way. The file contains multiple rows. Each time a
thread is ready for more data it is given the next line of data.

>
> Use CSV Data Set instead.
>
> I cannot as I described.
>
>
> --
>
> Greetings,
>
> mart
>
>
> ------------------------------------------------------------------------
> Szybko i tanio ubezpiecz samochod!
> Kupno polisy zajmie Ci 15 minut! Kontakt przez telefon albo Internet.
> Kliknij i sprawdz: http://link.interia.pl/f198b
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message