>Ideally the access log sampler would work as follows:
>-recognize 'session id' to the access log
>-access log sampler groups requests from the same sessions into the same
>session. (it can't re-use the exact same session ID as the servlet
container
>generates it automatically. ).
But you are missing one part. A thread in JMeter must wait till the response
returns. therefore you also need to account for concurrent sessions and
concurrent requests.
If I had to implement this I'd do something like
a. Configure tomcat to also output out SessionIds into the log (along with
post data) - IP address might work as well
b. Pre process your log file to
1. Figure out when a session began and when it ended (first and last
request)
2. calculate the maximum number of concurrent sessions (this is the
number of threads you will need in JMeter).
3. Generate new log files that each thread will use by splitting up
your original log files , based on concurrent sessions(i.e. IP1 - request1
should go into a file for Thread1 , if now you get IP2 - request2 , then the
same thread cannot execute this request and you need to make this request2
from a new thread. If now IP1 session has finished then Thread1 can clear
all its cookies and start making requests again).
c. Now use your sampler (either normal + BSH or a customised version) so
that each thread reads its file and plays the request that it has to(taking
into account that some variables are dynamic so you cannot always replay the
test exactly).
I havent seen the AccessLogSampler code so Im not sure how much of this is
already implemented. Some of the above may be unneccessarily complicated ,
need to think about it a bit more.
regards
deepak
On Thu, Feb 24, 2011 at 2:02 PM, Will Milspec <[email protected]>wrote:
> Some comments:
>
> >>to recreate "actual load" from a very busy system.
> >Actual load is usually concurrent. In most cases you dont get these values
> >from a log file (and its important that the same session use the same
> >thread).
>
> Right. We desire session recreation. From a "functional" perspective
> (recreating actual load), we find that our production servers can get a lot
> of "bot crawls". Each bot request uses its own session. (5000 requests=5000
> sessions). These "smal sessions" add overhead when those sessions expire.
> If
> all 5000 requests came from the same session, we would not see the "session
> expiration overhead".
>
> Technically I've read that Jmeter basically tries to 'recreate sessions' by
> lumping together requests from the same IP address, but have not confirmed
> how the access log sampler simulates these sessions.
>
> Ideally the access log sampler would work as follows:
> -recognize 'session id' to the access log
> -access log sampler groups requests from the same sessions into the same
> session. (it can't re-use the exact same session ID as the servlet
> container
> generates it automatically. ).
>
>
> >If you can generate all POST and GET data, you could use HTTP Raw Sampler
> >(custom sampler, not shipped with JMeter). It allows you have full control
> Where can I find the raw sampler.
>
> Addendum
> ============================
> fwiw, here's (pretty trivial) example code to add the post parameter to the
> tomcat access log. It adds overhead, mostly when the access log valve
> prints
> out the parameters.
>
> A. Access log format to get a request attribute, here called "rpf params".
> e.g.:
> '%{rpfParams}r'
>
> The tomcat access log valve will call
> request.getAttribute("rpfParams").toString()
>
> B. Add a filter that adds sets a 'parameter wrapper' as a request
> attribute.
> public void doFilter(ServletRequest pRequest, ServletResponse pResponse,
> FilterChain pChain) throws IOException, ServletException
> {
> pRequest.setAttribute("rpfParams",new
> RecordParamsFilter.ParameterWrapper(pRequest.getParameterMap()));
> pChain.doFilter(pRequest, pResponse);
> }
>
> /**
> * Class to wrap parameter map. Main "work" occurs in the "toString".
> *
> * Exists to allow printing of both "get" and "post" parameters.
> */
> public class ParameterWrapper
> {
> Map fMap;
>
> public ParameterWrapper(Map pMap)
> {
> fMap = pMap;
> }
>
> @Override
> public String toString()
> {
> StringBuffer sb = new StringBuffer();
> for (Iterator it = fMap.entrySet().iterator(); it.hasNext(); )
> {
> Map.Entry entry = (Map.Entry) it.next();
> String[] values = (String[]) entry.getValue();
> for (String value : values)
> {
> sb.append(entry.getKey()).append("=");
> sb.append(value);
> }
> if (it.hasNext())
> {
> sb.append("&");
> }
> }
> return sb.toString();
> }
> }
>