Bug 56961 - Add 'Start from line', 'Step by' parameters to CSV Dataset Config, also enabling it to read random lines
Summary: Add 'Start from line', 'Step by' parameters to CSV Dataset Config, also enabl...
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-11 12:10 UTC by Flavio Cysne
Modified: 2017-09-16 20:30 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Flavio Cysne 2014-09-11 12:10:46 UTC
These parameters can help to better control test data. For distributed environments these parameters will be more valuable, since they can avoid the need to split CSV data file across JMeter slaves.

'Start from line' defines from what line, in a CSV Data file, JMeter will start reading when the first thread requires it. Defaults to 1 (one). If set to 0 or below it will start reading from a random line.

'Step by' defines how many lines will be skipped before reading from CSV file. For example, if 'Step by' is set to 5 then JMeter CSV reader will read lines 1, 6, 11 and so on. If this parameter is set to 0 (zero) no further lines will be read.

'Read random lines' defines if JMeter will read lines sequentially, if false (default), from CSV file or randomly, if set to true. This parameter would be a combination of the two parameters above. If 'Start from line' is set to 0 or less then JMeter CSV reader will read a random line from CSV file for its first thread. If 'Step by' is set to -1 (or any negative number, to prevent errors) then a random line will be read from CSV file every time it is required to.
Comment 1 Sebb 2014-09-11 13:40:07 UTC
(In reply to Flavio Cysne from comment #0)
> 'Read random lines' defines if JMeter will read lines sequentially, if false
> (default), from CSV file or randomly, if set to true. This parameter would
> be a combination of the two parameters above. If 'Start from line' is set to
> 0 or less then JMeter CSV reader will read a random line from CSV file for
> its first thread. If 'Step by' is set to -1 (or any negative number, to
> prevent errors) then a random line will be read from CSV file every time it
> is required to.

This is going to be expensive to implement, as it's not possible to skip to the start of a random line within a file. It's only possible to skip to a random byte in general. Far better to randomise the file before starting the test.
Comment 2 Sebb 2014-09-11 13:43:44 UTC
(In reply to Flavio Cysne from comment #0)
> These parameters can help to better control test data. For distributed
> environments these parameters will be more valuable, since they can avoid
> the need to split CSV data file across JMeter slaves.

However the slaves will still need to be configured with different starting lines. This means each slave will need a different config anyway.
Comment 3 Flavio Cysne 2014-09-11 19:13:20 UTC
Yes, each slave will have to have its own '-J' parameter set to distinguish from others.

'Step by' parameter is hardly needed to be different among JMeter slaves, but it'll be a choice for the tester.

I'm thinking about how to ease the process of distributing CSV files across the distributed environment without the need to split/randomize the main CSV file in as many files as the number of slaves used.

With this I could have many JMeter slaves within the same machine and even they read the same file, lines read would be distinct ones. Even if slaves were in different machines, I could have then reading the same file (pointing to the same file or with the same content) and each thread of each slave would get a different set of values from it.

The randomness is a condition that makes JMeter reads a random number of times before really assigning the values to variables.
Comment 4 Sebb 2014-09-11 22:52:48 UTC
(In reply to Flavio Cysne from comment #3)
> 
> The randomness is a condition that makes JMeter reads a random number of
> times before really assigning the values to variables.

The user would have to provide the maximum random number or the code would have to read the file once to determine how many lines there were. Unless you just mean it should skip a random number of lines from current position, though there is still the issue of the maximum possible skip value.

Though I suppose it might be possible to seek to the random byte offset in the file and then find the next line boundary (not 100% sure that's always possible with multi-byte characters). If the records varied much in length this would not give a very even distribution; it would favour the next record after long records.

I don't see a use case for this that cannot be solved much more simply by randomising the input before the test starts.