RSS Feed for This PostCurrent Article

Use JMeter to Load Test RMI (Remote Method Invocation) Server


Apache JMeter is a great tool for load testing. However, recently I need to load test a RMI application, and I could not find a JMeter Sampler to test the RMI application.

After some Googling, I gave up and ended up writing my own Sampler using the Java Request Sampler.

Below is the sample screen of the Java Request Sampler that I have written. I can specify the RMI server IP, port, binding name, and also the RMI connection pool size.

jmeter.jpg

You can download the code here.

JMeter RMI Sampler

In order to compile the code, you need the libraries in <JMeter Directory>\lib\ext folder.

After compiling the Java source files, package them into a Jar file, and put it under <JMeter Directory>\lib\ext folder, you can view the new sampler from the Java Request Sampler screen.


Trackback URL


RSS Feed for This Post11 Comment(s)

  1. tamil vengan | Nov 14, 2007 | Reply

    Hi,

    Awesome. Great job. Lot of useful tips and tools.
    Keep it up.

    Thanks,
    Tamil

  2. jigar | Jan 25, 2008 | Reply

    n order to compile the code, you need the libraries in \lib\ext folder.

    ( Which library you are taking about)

    After compiling the Java source files, package them into a Jar file, and put it under \lib\ext folder, you can view the new sampler from the Java Request Sampler screen.

  3. nbedoui | Jun 24, 2008 | Reply

    Bonjour,

    Can you explain how exactly? because I can not make it work.

    Thanks.

  4. beto | Oct 8, 2008 | Reply

    Hi! great sampler, but I can’t make it work, I can compile it and generate the .class files, but jmeter doesn’t seem to ‘read’ the sampler. I’ve tried what you say “After compiling the Java source files, package them into a Jar file, and put it under \lib\ext folder, you can view the new sampler from the Java Request Sampler screen.” and it didn’t worked… I tried changing jmeter’s classpath (on jmeter.properties) and nothing, neither adding the total path to the search paths (also on jmeter.properties), the problem actually isn’t your code, the problem is that jmeter can’t find the classes…. please help!!

    jigar: what I did was to add the following jars to java’s classpath
    ApacheJMeter_core.jar
    ApacheJMeter_java.jar
    it does work, in the sense that it compiles, but as I said before, the sampler doesn’t appear on the control panel of the java request sampler, good luck

  5. beto | Oct 9, 2008 | Reply

    ok, i’ve managed to made the sampler to show on the menu of possible classes on the java request control panel, I haven’t tried it (and I don’t think I’m gonna do it today), but at least it does appears, this is what I did:

    First I ‘unzip’ the ApacheJMeter_java.jar file, this file has the 2 default test classes of Jmeter: SleepTest and JavaTest. This file is located on lib/ext of the jmeter folder

    Then, on the org folder (appears when jar is ‘unzipped’), navigate to test folder (org\apache\jmeter\protocol\java\test), and copied the source code of the 4 classes of the RMISampler

    Then add the code line package org.apache.jmeter.protocol.java.test; before any import on the 4 .java files

    Then compile all of them. I had problems here, the error said something about a wrong class or something like that, so I put the \lib\ext folder (of Jmeter of course) on java’s classpath (this in adition to the other jar’s that I mentioned before), then compile again

    Finally, on cmd, while being on the \lib\ext folder of jmeter, I build the jar file again, using both folders, org and META-INF

    Done!, if everything went well, the next time you run Jmeter, the RMISampler should appear on the Java request Control Panel

    Note: this is probably the worst way of doing it, but at least is a way, if somebody knows another way please post it

  6. alok ranjan | Feb 27, 2009 | Reply

    I am trying to add the ExampleSampler(which comes with jmeter source codes)to jmeter2.3.2.
    I am able to compile and jar the class and put it in lib\ext folder.But the sampler is not shown in the jmeter GUI.
    i even tried to give path of jar in jmeter properties file(added to “search_path=” line).But the sampler does not show up.The other thing i tried was puting a ExampleSampler.properties file in the package with data displayNmae=Example sampler.

    I am using the same source as here(http://www.devdaily.com/java/jwarehouse/jakarta-jmeter-2.0.1/src/examples/org/apache/jmeter/examples/sampler/gui/ExampleSamplerGui.shtml)

    Please anybody help.

  7. Abdul-Rahman | Feb 28, 2009 | Reply

    Hi,
    I have also managed to compile the Java RMI sampler to Jmeter. Now i want to load test the RMI server via JMeter. Because i am a new programmer of java, what i did is that i downloaded the rmi sample application in which client calls a function of server and server returns the “hello world” string. It runs on default port 1099. when i run the client from command line by “java client” it returns me the hello world string. Now i need to load test the server by applying JMeters automated testing. Please help me. I do not know how can i automatically invoke RMI server from Jmeter in such a way that it returns me the hello string by calling its hello() function.

    Furthermore, to test this application i need to know what values should i enter in the following feilds:
    1) response code
    2) response message
    3) sample data
    4) result data and
    5) binding name (is binding name is same as interface of server? )

    Regards,
    Abdul-Rahman

  8. Abdul-Rahman | Feb 28, 2009 | Reply

    please follow the instructions that “beto” has mentioned. I used netbeans IDE and followed the instructions and it worked for me. if you don’t add the code line “package org.apache.jmeter.protocol.java.test;” before any import on the 4 .java files, it wont appear in jmeter. i was also doing the same mistake.

  9. Patrik | Jun 6, 2009 | Reply

    Hi

    Nice work, helped a lot.

    I reworked your solution a bit to a single class without the pooling logic.

    If you want to have a look and/or add it to your post just mail me

    regards
    Patrik

  10. friend | Aug 6, 2009 | Reply

    Hi

    I solved this problem by setting source and target version to 1.4 in compilation phase.

    Regards

  11. ysharath | Feb 9, 2010 | Reply

    Really beauty.I was trying lot but i found some thing here.Thanks a lot for posting this kind of stuff.

1 Trackback(s)

  1. From Custom Plugins for Jmeter « | Feb 24, 2009

Sorry, comments for this entry are closed at this time.