jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasanna bhat <prasannabha...@gmail.com>
Subject Re: Huge difference in throughput when reading a file from Bean Shell Sampler
Date Mon, 24 May 2010 17:40:32 GMT
>>What happens when you compare a single JMeter thread with the Eclipse
timings?

  File Size (in KB)

Eclipse Timings (ms)

JMeter Bean Shell (single thread) (ms)

16

32

59

32

31

81

48

47

120

54

15

134

64

16

159

128

31

317

192

141

477

240

94

569

256

62

612

512

94

1223

768

125

1874

1000

187

2474

1024

172

2527

2048

422

5299

4096

609

16089

When i repeated the same tests, the eclipse timings again dropped,  while
the JMeter timings almost remained in the same range.

>>Also, note that the Http Sampler can read files.
This will be more efficient than using BeanShell, especially if all the code
is defined in the GUI. Consider using a script file - or
better, a startup file to define a method that does the processing.

1) Since i'm pretty much new to JMeter, it would be really helpful if you
can elaborate the above method and provide me some pointers.

2) The actual requirement is to measure the time difference involved in
accessing a file from file system and accessing a BLOB content from
database.

To access the varbinary/BLOB content from the database, i have again used a
Java code snippet (in Bean Shell) to fetch the BLOB data.

   code snippet:

   rs=pstmt.executeQuery();

    rs.next();
    doc_name=rs.getString(1);
    doc_length=rs.getInt(2);
    *InputStream is=rs.getBinaryStream(3);*

    BufferedInputStream bais=new BufferedInputStream(is);

    int c;
    while((c=bais.read())!=-1){
    }

Well, i intially thought of using JDBC Sampler for the same but i had to
iterate/read through the input stream, so i thought of using a Bean Shell
sampler.What will be the efficient way of doing this action from JMeter?

Can you please provide some inputs as to how best can this scenario
(Comparing FileSystem with DB) be simulated in JMeter??

Thanks for your time.

Regards,
Prasanna

On Mon, May 24, 2010 at 8:44 PM, sebb <sebbaz@gmail.com> wrote:

> On 24/05/2010, prasanna bhat <prasannabhat38@gmail.com> wrote:
> > Hi,
> >
> >  In one of the projects, i have to measure the time taken to read file of
> >  varied sizes from NTFS file system and i have used JMeter tool to get
> this
> >  information. Providing the details below:
> >
> >  1) I have a thread group with 20 threads and 250 loop count and no ramp
> up
> >  time.
> >
> >  2) The file size to be read are in the interval of 16kb-64kb,
> 64kb-256kb,
> >  256kb-1024kb, 1024kb-4096kb
> >
> >  3) I have a config file (added in CSV Data Set) containing 5000 records
> >  giving the file size to be read , which acts as an input for the Java
> >  Program in Bean Shell Sampler.
> >
> >  4) I have sample files created for each of the file size intervals
> mentioned
> >  above and referencing the same for each read. *To illustrate, If suppose
> >  there are 1000 files of 16kb size to be read then the java module
> references
> >  the same 16kb file (say C:\SampleFile\File16.pdf) 1000 times*. the same
> >  thing is followed if a file of particular size has to be read multiple
> >  times.
> >
> >  5)  code snippet to read a file in Java place in Bean Shell Sampler.
> (file
> >  name is passed as a parameter)
> >
> >        docFile=new File(fileName);
> >         BufferedInputStream bin;
> >
> >         bin = new BufferedInputStream(new FileInputStream(docFile));
> >         while(bin.read()!=-1){
> >         }
> >
> >         bin.close();
> >
> >  6) When i executed this test plan i see the following samples in the
> >  logs(.jtl) file:
> >     [doc__name is the name of the file, doc_length is the file size in
> bytes
> >  and exec_time or t is the time taken to read the file in milli seconds]
> >
> >  *Some of the samples for different file sizes:*
> >
> >  For 1MB file: <sample t="6765" ts="1274687736006" rc="200"
> >  doc__name="File_1024.pdf" doc__length="1046739" exec__time="6766"/>
> >  For 1MB file: <sample t="6765" ts="1274687736006" rc="200"
> >  doc__name="File_1024.pdf" doc__length="1046739" exec__time="6766"/>
> >  For 2MB File: <sample t="21442" ts="1274687805269" rc="200"
> >  doc__name="File_2048.pdf" doc__length="2095655" exec__time="21437"/>
> >  For 4MB File: <sample t="49297"  ts="1274687946567" rc="200"
> >  doc__name="File_4096.pdf" doc__length="4193028" exec__time="49296"/>
> >
> >  The Average throughout is around : 130-150 KB/sec for the file size
> interval
> >  1MB-4MB and 110-120 KB/sec for the file size interval 256KB - 1024KB.
> >
> >  But when i execute the the same piece of Java code standalone ( from
> >  eclipse, however this was not a multi-threaded execution)
> >
> >  The average throughput is in MB/sec.
> >
> >  So i'm wondering if  20 active threads is putting an additional overhead
> and
> >  delaying the file read!!
>
> Quite possibly.
>
> >  Can you please help me understand why is there such a huge difference in
> the
> >  throughput??? your inputs here will be greatly appreciated.
>
> What happens when you compare a single JMeter thread with the Eclipse
> timings?
>
> Also, note that the Http Sampler can read files.
> This will be more efficient than using BeanShell, especially if all
> the code is defined in the GUI. Consider using a script file - or
> better, a startup file to define a method that does the processing.
>
> BeanShell is intended for prototyping. It's reasonably efficient, but
> not as efficient as Java.
>
> >  Thanks & Regards,
> >
> > Prasanna
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message