jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Fisher <>
Subject RE: Extending JMeter with a new generative controller
Date Fri, 27 Sep 2002 18:42:02 GMT
Well, I am already writing the log parser, and actually that's quite simple,
really.  Of course, I'm not trying to be clever and create a generic apache
log parser, I am only writing a simple one that knows how to read the
specific log format we happen to have chosen here.  A friend of mine worked
on the Apache project and he told me such generic tools exist, but I
couldn't find them so I am rolling my own simple tool.

Thanks for telling me where to hook into the system.  There was one detail I
think your answer missed, which is that I'd like the gui to accept not just
the log file location but also the domain of the server to test.  That way I
can launch the test against different machines in the server farm without
having to recompile.

Thanks so much for your input so far.  I will finish my log parser then I
will try to implement as you suggested.  I am positive I'll have another
question or two, but since you seem so nice about helping out....


-----Original Message-----
From: Mike Stover []
Sent: Friday, September 27, 2002 11:36 AM
To: JMeter Users List
Subject: RE: Extending JMeter with a new generative controller

> Incidentally, Mike, it would seem to me that the interaction from the gui
> down to the underlying Sampler object involves many objects.   I want to
> intercept the HTTP Request controller behavior at a couple of points.
> First, in the gui I want to take in a file location for the apache log to
> use, as well as the domain of the server to test, but I no longer need the
> 'path' info.  Second I want the path info to no longer come from the gui,
> but rather to come from a new line of the log for each request that is
> I am currently trying to trace the code from gui to sampler, but there is
> lot there and it's all new to me.  I am positive that it would be faster
> simply pick your brain for the answers, but I realize that you are, of
> course, a busy man.....

Indeed, and I am currently taking a break from JMeter.  But, helping you is
no problem. 
It's probably simpler than it looks.  You shouldn't need to change
HTTPSampler in any
way - it already does everything you need, which is generate an HTTP
request.  The 
gui, however, only generates a single HTTPSampler object to test (see the 
createTestElement() method).  You want to read a file and create many
objects.  This is not accounted for in the current framework,

I suggest you do the following.  Create a new Sampler - call it
ServerLogSampler, or whatever.  
Create a simple GUI class (that extends
that has a simple field for the user to enter the filename of the server
log.  In your 
createTestElement() method, create your ServerLogSampler and hand it the
file handle.  

In ServerLogSampler, extend org.apache.jmeter.sampler.AbstractSampler.  Do
the work 
necessary to parse the server log, creating a list of HTTPSampler objects
(These objects are 
easy to create, use the setPath(), setDomain(), addArgument() etc methods).
When you 
implement the sample(Entry) method, call the sample(Entry) method of each
object in your list in turn, returning the SampleResult object each time.

The ServerLogSampler will have to implement PerThreadClonable for this to
work, because 
you'll have to save state for each thread (ie, you'll have to save which
element in the list you're 
currently on, and increment each time).  But you don't have to write the
clone() method - that's 
taken care of when you extend AbstractSampler.  

This may sound like a lot, but it really isn't.  The hardest part will be
parsing the server log - 
particularly since I will be happy to look over your code and point things


> Thanks,
> Jason

Michael Stover
Yahoo IM: mstover_ya
ICQ: 152975688

To unsubscribe, e-mail:
For additional commands, e-mail:

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