jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@interia.pl
Subject Re: Problem with CSVRead and multithread
Date Tue, 01 Aug 2006 14:18:14 GMT
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 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.
>
> 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).


> 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.
>
> 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.

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?
>
> Can anybody help me? Any suggestions are welcome.
>

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


Mime
View raw message