Netflix / CassJMeter

JMeter plugin to run cassandra tests.
Apache License 2.0
163 stars 66 forks source link

Problem inserting timestamp data in cassandra table using Jmeter. #10

Open VishalMakadia opened 11 years ago

VishalMakadia commented 11 years ago

I am trying to insert data into cassandra table using jmeter with cassandra put sampler.This is my table schema in cassandra crated by cql-3 .

CREATE TABLE sensor3 ( sensor_id int, time timestamp, sensor_value text, PRIMARY KEY (sensor_id, time) ) WITH COMPACT STORAGE AND bloom_filter_fp_chance=0.010000 AND caching='KEYS_ONLY' AND comment='' AND dclocal_read_repair_chance=0.000000 AND gc_grace_seconds=864000 AND read_repair_chance=0.100000 AND replicate_on_write='true' AND populate_io_cache_on_flush='false' AND compaction={'class': 'SizeTieredCompactionStrategy'} AND compression={'sstable_compression': 'SnappyCompressor'};

While using cassandra put sampler i define the following inputs.

Client Type : com.netflix.jmeter.connections.a6x.AstyanaxConnection

i have tried two ways to do the same but find different errors. 1) In First case i have used the Inbuilt time function to get the current timstamp which is below

Cassandra Put Properties --

Column family : sensor3 Row Key : 1 Column Name : ${time(yyyyMMdd-HHmmss,YMDHMS)} Column value : ${Random(1,1000)} Column Serializer : DateSerializer Value Serializer : StringSerializer Key Serializer : IntegerSerialzer

Attaching Stack trace of problem :

ERROR: java.lang.IllegalArgumentException java.util.Date.parse(Date.java:615) com.netflix.jmeter.sampler.AbstractSampler.convert(AbstractSampler.java:88) com.netflix.jmeter.sampler.AbstractSampler.getColumnName(AbstractSampler.java:130) com.netflix.jmeter.sampler.PutSampler.execute(PutSampler.java:14) com.netflix.jmeter.sampler.AbstractSampler.sample(AbstractSampler.java:205) org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428) org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) java.lang.Thread.run(Thread.java:679)

2) Second Case tried the Hard coded value of Date Object and got the error

Cassandra Put Properties --

Column family : sensor3 Row Key : 1 Column Name : Sat, 12 Aug 1995 13:30:00 GMT Column value : ${__Random(1,1000)} Column Serializer : DateSerializer Value Serializer : StringSerializer Key Serializer : IntegerSerialzer

Attaching Stack trace of problem :

ERROR: java.lang.IllegalArgumentException java.util.Date.parse(Date.java:615) com.netflix.jmeter.sampler.AbstractSampler.convert(AbstractSampler.java:88) com.netflix.jmeter.sampler.AbstractSampler.getColumnName(AbstractSampler.java:130) com.netflix.jmeter.sampler.PutSampler.execute(PutSampler.java:14) com.netflix.jmeter.sampler.AbstractSampler.sample(AbstractSampler.java:205) org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428) org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) java.lang.Thread.run(Thread.java:679)

please tell me ,What i'm doing wrong or is there other way to do the same ?

MattSeese commented 11 years ago

Vishal - have you tried using a Unix time (Epoch time) format instead of the human time stamp :"Sat, 12 Aug 1995 13:30:00 GMT"? That time in milliseconds would be "808234200000"