You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Shane Petroff <sh...@mayet.ca> on 2007/12/21 10:29:19 UTC
CSV
Hello,
Can someone point me to a simple example of how to use the CSV Data Set
Config? I've read the docs, but can't seem to make it function at all.
What I'd like to do is to pull sql queries out of a CSV file and shove
them at a JDBC sampler (specifying the query type in the CSV file would
be a nice touch too). However, I haven't been successful in pulling
simple Id values out, never mind full queries. I know that the JDBC
config is fine since I can execute a simple JDBC sampler and can see
results come through in my SQL Profile tool (a separate monitoring tool
for the db), but when I try to pull sql out of a CSV, all I can see
making it to the database is jibberish. When I try to pull simple data
out, I don't see anything making it to the db.
The test plan consists of a Thread Group with 10 threads, 10 loop
iterations and a 5 second ramp up. It's children are: a functional JDBC
config, a CSV Data Set Config element, a JDBC Sampler and a Graph
results. The sql I'm trying to execute is an exceptionally simple:
SELECT * FROM person WHERE person_id = ${PERSON_ID}
and the CSV file contains a whopping 8 lines (do lines need to be
terminated with a delimiter token when there is only one value per line?).
In JMeter.log, I can see that at 5 threads (or thereabouts), threads
start dying with an OutOfMemoryError.
2007/12/21 03:20:05 INFO - jmeter.threads.JMeterThread: Thread Users
1-6 started
2007/12/21 03:20:05 ERROR - jmeter.threads.JMeterThread: Test failed!
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.util.Arrays.copyOf(Unknown Source)
at java.util.Vector.ensureCapacityHelper(Unknown Source)
at java.util.Vector.addElement(Unknown Source)
at org.apache.jorphan.util.JOrphanUtils.split(JOrphanUtils.java:96)
at
org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:84)
at
org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:225)
at
org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:215)
at
org.apache.jmeter.control.GenericController.next(GenericController.java:84)
at org.apache.jmeter.control.LoopController.next(LoopController.java:91)
at org.apache.jmeter.threads.ThreadGroup.next(ThreadGroup.java:123)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:248)
at java.lang.Thread.run(Unknown Source)
What the hell am I doing wrong here? Thanks.
--
Shane
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: CSV
Posted by Shane Petroff <sh...@mayet.ca>.
Tracy Zhu wrote:
> Hi Shane,
> Have you specified delimiter token in the CSV Data Set Config element?
> According to my experiece, this kind of exception is that delimiter token is
> ommited.
>
I've got it working now. It could have been a delimiter issue, but I
only had one type of element in the file, so there ought not to have
been a need to delimit anything. The main mistake that I had was that
I'd specified a UTF-8 encoding, but the file was actually UTF-16. In any
case, it is now currently working and I've specified the query type and
sql in the same file.
Which leads me to another question: If one wants to test JDBC inserts in
a test, one needs to handle the inherent issues related to primary keys.
What are the best practices for dealing with this? I suppose I could
specify a delete for each insert at the bottom of the CSV file to ensure
that the timing between insert and delete was OK, but this seems rather
cheesey. I'm a little unclear how I'd 'code' up the test to handle it
differently. I'd prefer to actually insert a series of values,
presumably from another CSV file, then clean up in the last statement,
but I'm not sure how I'd parameterize the sql in the first CSV file and
then replace those values inline. I guess one would use the beanshell
preprocessor and replace a string representation in that script before
the JDBC sampler did its thing. I'm thinking of a sql csv file with
lines like:
Update statement; insert into tbl values (@rnd, 'real data', ...)
Then substitute @rnd with a random integer, say > 1000000, then clean up
the whole works in the last statement in the file using
delete from tbl where id > 1000000.
Does that seem like a reasonable approach? (is this how the preprocessor
was intended to work?)
Thanks
Shane
> On Dec 21, 2007 5:29 PM, Shane Petroff <sh...@mayet.ca> wrote:
>
>
>> Hello,
>>
>> Can someone point me to a simple example of how to use the CSV Data Set
>> Config? I've read the docs, but can't seem to make it function at all.
>> What I'd like to do is to pull sql queries out of a CSV file and shove
>> them at a JDBC sampler (specifying the query type in the CSV file would
>> be a nice touch too). However, I haven't been successful in pulling
>> simple Id values out, never mind full queries. I know that the JDBC
>> config is fine since I can execute a simple JDBC sampler and can see
>> results come through in my SQL Profile tool (a separate monitoring tool
>> for the db), but when I try to pull sql out of a CSV, all I can see
>> making it to the database is jibberish. When I try to pull simple data
>> out, I don't see anything making it to the db.
>>
>> The test plan consists of a Thread Group with 10 threads, 10 loop
>> iterations and a 5 second ramp up. It's children are: a functional JDBC
>> config, a CSV Data Set Config element, a JDBC Sampler and a Graph
>> results. The sql I'm trying to execute is an exceptionally simple:
>>
>> SELECT * FROM person WHERE person_id = ${PERSON_ID}
>>
>> and the CSV file contains a whopping 8 lines (do lines need to be
>> terminated with a delimiter token when there is only one value per line?).
>>
>> In JMeter.log, I can see that at 5 threads (or thereabouts), threads
>> start dying with an OutOfMemoryError.
>> 2007/12/21 03:20:05 INFO - jmeter.threads.JMeterThread: Thread Users
>> 1-6 started
>> 2007/12/21 03:20:05 ERROR - jmeter.threads.JMeterThread: Test failed!
>> java.lang.OutOfMemoryError: Java heap space
>> at java.util.Arrays.copyOf(Unknown Source)
>> at java.util.Arrays.copyOf(Unknown Source)
>> at java.util.Vector.ensureCapacityHelper(Unknown Source)
>> at java.util.Vector.addElement(Unknown Source)
>> at org.apache.jorphan.util.JOrphanUtils.split(JOrphanUtils.java:96)
>> at
>> org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:84)
>> at
>> org.apache.jmeter.control.GenericController.fireIterationStart(
>> GenericController.java:225)
>> at
>> org.apache.jmeter.control.GenericController.fireIterEvents(
>> GenericController.java:215)
>> at
>> org.apache.jmeter.control.GenericController.next(GenericController.java
>> :84)
>> at org.apache.jmeter.control.LoopController.next(LoopController.java
>> :91)
>> at org.apache.jmeter.threads.ThreadGroup.next(ThreadGroup.java:123)
>> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:248)
>> at java.lang.Thread.run(Unknown Source)
>>
>>
>> What the hell am I doing wrong here? Thanks.
>>
>> --
>>
>> Shane
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>
>
>
--
Shane
Re: CSV
Posted by Tracy Zhu <tr...@gmail.com>.
Hi Shane,
Have you specified delimiter token in the CSV Data Set Config element?
According to my experiece, this kind of exception is that delimiter token is
ommited.
On Dec 21, 2007 5:29 PM, Shane Petroff <sh...@mayet.ca> wrote:
> Hello,
>
> Can someone point me to a simple example of how to use the CSV Data Set
> Config? I've read the docs, but can't seem to make it function at all.
> What I'd like to do is to pull sql queries out of a CSV file and shove
> them at a JDBC sampler (specifying the query type in the CSV file would
> be a nice touch too). However, I haven't been successful in pulling
> simple Id values out, never mind full queries. I know that the JDBC
> config is fine since I can execute a simple JDBC sampler and can see
> results come through in my SQL Profile tool (a separate monitoring tool
> for the db), but when I try to pull sql out of a CSV, all I can see
> making it to the database is jibberish. When I try to pull simple data
> out, I don't see anything making it to the db.
>
> The test plan consists of a Thread Group with 10 threads, 10 loop
> iterations and a 5 second ramp up. It's children are: a functional JDBC
> config, a CSV Data Set Config element, a JDBC Sampler and a Graph
> results. The sql I'm trying to execute is an exceptionally simple:
>
> SELECT * FROM person WHERE person_id = ${PERSON_ID}
>
> and the CSV file contains a whopping 8 lines (do lines need to be
> terminated with a delimiter token when there is only one value per line?).
>
> In JMeter.log, I can see that at 5 threads (or thereabouts), threads
> start dying with an OutOfMemoryError.
> 2007/12/21 03:20:05 INFO - jmeter.threads.JMeterThread: Thread Users
> 1-6 started
> 2007/12/21 03:20:05 ERROR - jmeter.threads.JMeterThread: Test failed!
> java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Unknown Source)
> at java.util.Arrays.copyOf(Unknown Source)
> at java.util.Vector.ensureCapacityHelper(Unknown Source)
> at java.util.Vector.addElement(Unknown Source)
> at org.apache.jorphan.util.JOrphanUtils.split(JOrphanUtils.java:96)
> at
> org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:84)
> at
> org.apache.jmeter.control.GenericController.fireIterationStart(
> GenericController.java:225)
> at
> org.apache.jmeter.control.GenericController.fireIterEvents(
> GenericController.java:215)
> at
> org.apache.jmeter.control.GenericController.next(GenericController.java
> :84)
> at org.apache.jmeter.control.LoopController.next(LoopController.java
> :91)
> at org.apache.jmeter.threads.ThreadGroup.next(ThreadGroup.java:123)
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:248)
> at java.lang.Thread.run(Unknown Source)
>
>
> What the hell am I doing wrong here? Thanks.
>
> --
>
> Shane
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>