How to use JMeter to load test Flex applications


JMeter, AMF setting for HTTP SamplerFlex applications use a binary protocol called AMF. The easiest way to use JMeter with a Flex application is to use Charles (the indispensable 100% pure Java cross platform http debugging proxy). Here are the steps:

  1. Start Charles and visit the site whose Flex application you wish to load test. In Charles, you will see the entire HTTP traffic.
  2. Click on the Charles’s Sequence panel to see the ordered list of HTTP requests.
  3. Right click (on Mac control click) and save the HTTP request corresponding to a Flex AMF call to a file.
  4. On JMeter create a new HTTP sampler for this request. Set the Send a File with Request to the file that you saved on the step before. Set the MIME Type to application/x-amp (click here to see the JMeter screen)

That is really it. Just save the request using Charles, and then reference it in the JMeter HTTP Sampler. Couldn’t get much easier than this. The solution gets a bit more complicated if you need to read the requests and extract data for use in subsequent requests. To do this, you’ll have to write some code. I’ll add an entry on how to do this soon.

20 Responses to “How to use JMeter to load test Flex applications”

  1. Bruno Says:

    Hello, it seems to be nice, but looks that Charles is commercial. Do you have any other suggestions with open source tools?
    Thanks.

  2. Bruno Says:

    Hello, it seems is possible to record AMF request with JMeter(https://issues.apache.org/bugzilla/show_bug.cgi?id=39641), but I could not make it work. Any ideas?
    Thanks.

  3. sj Says:

    Hi Bruno, The Charles HTTP debugging proxy is worth every cent of its cost. If you need to monitor HTTP traffic and view AMF messages then it may be your only choice. It is cross platform. On Windows there is Fiddler which I think is free but I’m not sure if it can parse AMF message.

    I’ve not used the HTTP proxy that comes with JMeter. Simply recording AMF has its limitations, however, it works for simple workflows that do not need any user input, but if you need to modify the requests based on the responses, then you will need to write a Java Sampler that can read/write AMF messages. I’ve started doing just that, but other projects are keeping me too busy at this point.

  4. novice Says:

    thanks for the post!
    it provides novice like me a good ref on how to use charlesproxy to record AMF request.

    may i know when will you be writing the subsequent article on how to read the requests and extract data for use in subsequent requests?

  5. Solution Hacker - Load and stress testing my website Says:

    [...] to load test your application via replaying this AMF request. To do that, you can look at this article for detail. However, Charles is a commerical product. If you want a free solution, you can try [...]

  6. Herberth Amaral Says:

    It isn’t the same thing, but you can use HTTPFox (an extension for FF) for record HTTP requests and then debug you AMF.

    An obs: the AMF mime-type is application/x-amf, not application/x-amp :)

  7. Aina Says:

    hi all

    I’ve tried to load test a flex app. Actually, JMeter can record the scenario but when playing back the stuff : i have 100% errors on my swf :’(

    do you know whether JMeter has problems handling flex app components ? or some kind of Session problems whithin Flex perhaps ?

    thx

  8. Mediocre-Ninja.blogSpot.com Says:

    With current version of JMeter you can use the built-in HTTP Proxy Server to record the requests and load the tests.

  9. Peter Says:

    I can record with Jmeter(it saves .binary files for each request) and playback no problem. But if I’m going to do real load testing then I need to vary each request with slightly different data. Any ideas on how to modify/parameterize the .binary file or any other solution?

    Thanks,
    Peter

  10. Rachit Says:

    I am facing the same problem, which is mentioned by Peter above.
    If anybody has the solution, please help!

    Thanks
    Rachit

  11. chris Says:

    I discovered a very interesting free alternative to Charles Proxy : TcpCatcher (http://www.tcpcatcher.org)

    cheers
    Chris

  12. Jacky Says:

    Hey Chris, tcpcatcher is a great tool.

    is there any ways to post data using jmeter ?

  13. Kathy Says:

    I met the same problem which is mentioned by Peter above, any solution?
    Shahram, please help me.

    Thanks
    Kathy

  14. racsor Says:

    JMeter plugin visualizer for deserialize response in text.
    http://code.google.com/p/jmeter-amf-visualizer

  15. Gilberto Says:

    Hi Racsor,

    We are using your plugin we need you help with that because we put it on BIN but we don’t how to use on Jmeter . Can you help me with this?, my email is Gilbertofp16@gmail.com

  16. Thad Says:

    @Gilberto

    When you add his plugin you will see an AMF choice in the dropdown when you add a “View Results Tree”.

  17. vinu p Says:

    sir,

    Is it possible to load test a Desktop application with this way.My software having Audio and Video module so please give a reply to my desktop application

  18. Ken Says:

    In case it helps anyone who happens across this article, there is now a JMeter plugin that lets you record and edit AMF messages for use in load testing. You can even use this tool to test apps that have unique session ids embedded in the AMF.

    https://github.com/steeltomato/jmeter-amf

    Ken (Project Maintainer)

  19. Albulescu Cosmin Says:

    Hi, very nice post. Very usefull

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.