http://stackoverflow.com/questions/32240287/how-to-send-unique-data-for-each-thread-in-jmeter
Regards, Subhadip ------------------------------------------------------------------------------------------------------------------- On Thu, Aug 27, 2015 at 8:13 PM, Deepak Shetty <[email protected]> wrote: > I tried the CSV data set config - works fine for me - The summary report > always shows 10000 unique requests. > > > https://onedrive.live.com/?id=1BD02FE33F80B8AC!957&cid=1BD02FE33F80B8AC&group=0 > Sample script and CSV file uploaded at link (CSV needs to be in a folder > data relative to wherever your script is) > > regards > deepak > > On Thu, Aug 27, 2015 at 7:29 AM, Deepak Shetty <[email protected]> wrote: > > > Please note - none of your images made it through to the mailing list - > > Please upload the images somewhere and specify the link > > 1) For CSV data set config : Is your sharing model set to all threads? > > Assuming you have verified that the CSV itself has unique values , check > > that Recycle on EOF is set to False (in case you have a problem in your > > script this will check that if for e.g. your file is being reread you > will > > know that. > > 3) Random numbers are not guaranteed to be unique. However you can use > > schemes like using a UUID (e.g. > > http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html) or by > > using a scheme like Thread ID + Timestamp + (plus ensure a delay of 1 ms > > between requests made by the same thread by a timer or add a random > number > > or so). In your case even something like thread number + loop count > should > > work. > > 4) Calling a java method should also work - provided you have written > code > > that works when invoked concurrently (in which case did you test that , > and > > how?) > > > > > > > > On Wed, Aug 26, 2015 at 11:36 PM, Subhadip Bagui <[email protected]> > > wrote: > > > >> I'm using jmeter to test my REST API for 10000 hit for which each http > hit > >> will store some data in DB. I have followed the below test plan > >> > >> [image: enter image description here] > >> > >> > >> I'm running 10 threads in parallel with ramp up time 20 sec each and > loop > >> count 1000 to achieve the same. > >> > >> [image: enter image description here] > >> > >> But the issue here is my threads are not taking unique data set. Whereas > >> my > >> backend HTTP URL expecting unique string for each http hit. > >> > >> Now I have tried with the below approaches. > >> > >> 1. > >> > >> Single CSV data set config with 10000 unique values and all threads > in > >> thread groups are reading the same data. > >> 2. > >> > >> Different CSV Data set for each threads and allocate the csv file > with > >> thread using filename${__threadNum}.csv > >> 3. > >> > >> Using jmeter _RandomString method to generate random strings on > runtime > >> for each http hit, in http post body I'm passing like > >> > >> > >> > {"tenantName":"${*__RandomString*(15,abcdefghijklmnofqrst1234567#@#%^&*,)}"} > >> > >> 1. Using BeanShell preprocessor to call a java method and generate > >> unique pattern all the time win HTTP Request sampler. > >> > >> Now none of the above approaches works for me. While running the test > plan > >> after some point of time 2 threads are trying to use the same data and > hit > >> my HTTP url. And I'm getting conflict error from http response. My error > >> count keeps increasing. > >> > >> Now I really don't understand how these 2 treads trying to hit http with > >> same data? > >> > >> Can some one please explain the issue and help me to set the correct > test > >> plan configuration. > >> > >> > >> Regards, > >> Subhadip > >> > >> > >> > ------------------------------------------------------------------------------------------------------------------- > >> > > > > >
