My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
RawRequest  

Sampler
Updated Aug 6, 2011 by a...@apc.kg

HTTP Raw Request since 0.4.1

Weak points of original HTTP Request

JMeter's original HTTP Request is quite convenient to use. But in advanced load testing you may notice several drawbacks:

  • your load generator spend too much resources (CPU), so you need distributed testing (aaargh!) with more and more physical machines
  • indirect cookie and headers manipulation, though many Web applications rely on headers and cookies widely
  • if you know exact HTTP request that you want to feed to your server, you'll spend a lot of time setting it up in HTTP Request
  • TCP Sampler does not support measuring latency separately from response time
  • when you send or receive large files, you experience OutOfMemory issues

Advantages of Raw Request

  • really full control over request data
  • option to send file contents directly to network (lower memory usage on big files) (Some details...)
  • option to limit response data stored in results (lower memory consumption)
  • actually it is raw TCP sampler, so you can try to test non-HTTP servers

Using Raw Request

Together with obvious options like hostname and port you should know that:

  • all newlines (\r\n, \r and \n) in request data are converted to \r\n sequence to have correct HTTP request
  • you may not specify data to send, sampler will open connection and wait for data to receive
  • timeout works both for connection and data receiving, triggers when no packets received from server in timeout period
  • file contents sent without variables processing
  • response parsing, if enabled, is very simple for performance reasons, it treats first line as HTTP response line
  • "keep connection open" setting just keeps TCP connection open after request, each sampler has its own connection for now unlike original JMeter samplers
  • set JMeter property kg.apc.jmeter.samplers.ResultDataLimit to limit data stored in JMeter results. Response still read from network, but not fully stored in results.

Read Buffer Length

UDP Request reads response using buffer with default length of 4KB. You may override this value by setting JMeter property kg.apc.jmeter.samplers.ReceiveBufferSize in bytes.

Raw Data Source

If you using Raw Request in non-HTTP communication (which is possible), or just advanced HTTP requests with custom newlines, you may need to pass binary data in request. This is impossible directly from GUI, but you can specify such data with variables, and there's even special pre-processor to read variable from file: Raw Data Source. Attaching this pre-processor to your test plan gives you fast reading of any data into variable, which may be used in Raw Request.

Example

Download Test Plan

Hidden Feature :) and post on it

Comment by pvshew...@gmail.com, Mar 30, 2011

You mentioned that "TCP Sampler does not support latency". Can you please explain how do we get latency support in this Raw Request sampler? I am bit interested in using that.

Comment by project member a...@apc.kg, Mar 31, 2011

Raw Request measures latency as usual - when it receive first byte of response it marks "latency end". When all response bytes read it marks "response time end".

Comment by pvshew...@gmail.com, Mar 31, 2011

Got it. Thanks.

Comment by stanislav.chlebec@gmail.com, May 13, 2011

Is it possible to use this component behind the proxy server?

Comment by project member a...@apc.kg, May 13, 2011

I think it is possible, but I didn't test this. As I see you'll have to compose proxy requests like GET http://apc.kg/ HTTP/1.0 with appropriate headers etc. Could you share if you succeeded with this?

Comment by stanislav.chlebec@gmail.com, May 13, 2011

Sure. For now it fails: Response code: 500 Response message: java.nio.channels.UnresolvedAddressException? I am trying to find out if there is some header by which I can forward the HTTP GET via proxy.

Comment by project member a...@apc.kg, May 13, 2011

UnresolvedAddressException? means that you provided wrong hostname. Have you entered in hostname field the address of your proxy server?

Comment by stanislav.chlebec@gmail.com, May 13, 2011

I entered into hostname: geo.enviroportal.sk TCP port: 80 Request data: GET /catalog-server/CSWStartup?request=GetCapabilities?&service=CSW HTTP/1.0 Host: geo.enviroportal.sk Connection: keep-alive User-Agent: Jakarta Commons-HttpClient?/3.1

Comment by project member a...@apc.kg, May 13, 2011

WEll, for me it worked well, I got the response with page content

Comment by comedy...@gmail.com, Oct 23, 2011

I am wondering that is there any chance to simulate amazon s3 api request by using http raw request? I mean the authorization part(hmac-sha1 and base64 encode part). thank you for replying in advance :)

Comment by project member a...@apc.kg, Oct 24, 2011

I don't familiar with amazon api. But everything is possible since Raw Request is actually TCP sampler. Let's start a discussion in mailing list with details, I'll try to help you.

Comment by cinnamon...@gmail.com, Oct 25, 2011

I used this sampler to connect to google. If tcp port was assigned to 80, it worked. Then, I assigned tcp port to 443, but the response data is empty. Can this sampler work on ssl? Thanks.

Comment by project member a...@apc.kg, Oct 25, 2011

No, this sampler currently can't work with SSL.

Comment by michal.b...@cantstopgames.com, Nov 30, 2011

Hi i have problem wit RawRequest in remote tesing, on my mac, in GUI test is working fine without any problem

i'm starging jmeter server sh: ./jmeter-server Created remote object: UnicastServerRef?? [endpoint:[192.168.0.182:51788?(local),objID:7758286570843188072?]]

And when trying to lunch remotely test plany with HTTP Raw Request i have an error:

Configuring remote engine for 192.168.0.182 Using remote object: UnicastRef?? [endpoint:[192.168.0.182:51788?(remote),objID:7758286570843188072?]] Starting remote engines Starting the test @ Wed Nov 30 13:15:58 CET 2011 (1322655358148) Error in NonGUIDriver org.apache.jmeter.engine.JMeterEngineException: Error in run() method java.rmi.MarshalException??: error marshalling arguments; nested exception is:

java.io.NotSerializableException??: java.nio.DirectByteBuffer?? Can anybody help me?

Comment by kro...@krogon.net, Nov 30, 2011

Confirm above on linux.

$ dpkg -l | grep sun-java ii sun-java6-bin 6.26-1natty1 ii sun-java6-jdk 6.26-1natty1 ii sun-java6-jre 6.26-1natty1

$ ./bin/jmeter --version Copyright (c) 1998-2011 The Apache Software Foundation Version 2.5.1 r1177103

Comment by michal.b...@cantstopgames.com, Nov 30, 2011

on Jmeter 2.4 after lunching remote test there is not answer from jmeter, or remote server.

./jmeter-server

Created remote object: UnicastServerRef? [liveRef: [endpoint:[192.168.0.182:57224](local),objID:[6f5518a2:133f496d49e:-7fff, -1159573675182086088]]]

./jmeter -n -t ~/Dropbox/Jmeter/test/RawRequestExample?.jmx -R 192.168.0.182 Created the tree successfully using /Users/acid/Dropbox/Jmeter/test/RawRequestExample?.jmx Configuring remote engine for 192.168.0.182 Using remote object: UnicastRef? [liveRef: [endpoint:[192.168.0.182:57224](remote),objID:[6f5518a2:133f496d49e:-7fff, -1159573675182086088]]] Starting remote engines Starting the test @ Wed Nov 30 14:21:08 CET 2011 (1322659268779) Remote engines have been started

i wait 5-10 minutes, nothing happend

Comment by project member a...@apc.kg, Nov 30, 2011

Please try latest 0.5.0 snapshot, the issue has been fixed

Comment by kro...@krogon.net, Nov 30, 2011

Hello, are there available binaries for version 0.5 or have to compile it using NetBeans? ?

Comment by michal.b...@cantstopgames.com, Nov 30, 2011

is that possible, that you will compile 0.5.0 for us, it's not easy for us to prepare env to compile jmeter plugins ;]

Comment by kamil.ro...@cantstopgames.com, Dec 1, 2011

Plugin is not compiling using your tutorial. There are missing variables in .properties files, Moreover I had to compile cmd, agent and plugin separately. But finally I got rid of errors.

Didn't notice that link before (I've been searching "Current downloads"). Seems to be working correctly.

Thanks a lot.

Comment by project member a...@apc.kg, Dec 1, 2011

Build doc is pretty obsolete for 0.5.0, I need to find time and update it.

Comment by cinnamon...@gmail.com, Dec 19, 2011

Hi, I used this Http Raw Request to test s3-like api. While I PUT file(using PUT method) larger than 1M, Jmeter threw exceptions(as below). If the upload file is less than 1M, it worked smoothly. Does raw request limit the upload file size? Thanks.

java.io.IOException: ?s?u?w?Q±z?D?÷?W???n???????C at sun.nio.ch.SocketDispatcher?.write0(Native Method) at sun.nio.ch.SocketDispatcher?.write(Unknown Source) at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source) at sun.nio.ch.IOUtil.write(Unknown Source) at sun.nio.ch.SocketChannelImpl?.write(Unknown Source) at kg.apc.jmeter.samplers.HTTPRawSampler.sendFile(HTTPRawSampler.java:229) at kg.apc.jmeter.samplers.HTTPRawSampler.processIO(HTTPRawSampler.java:141) at kg.apc.jmeter.samplers.AbstractIPSampler.sample(AbstractIPSampler.java:115) at kg.apc.jmeter.samplers.HTTPRawSampler.sample(HTTPRawSampler.java:40) at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:381) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:274) at java.lang.Thread.run(Unknown Source)

Comment by project member a...@apc.kg, Dec 19, 2011

Could you create an issue for your case?

Powered by Google Project Hosting