Previously, Dennis Chen shared a small talk illustrating how you can execute a loading test with ZK applications using JMeter. Now, in this blog we will introduce how you can use ZK JMeter Plugin to simplify your work. With this JMeter Plugin, you no longer have to set user variables or parameter for each zkau request element.

Version: Applicable to JMeter 2.8+ (3.2+ version is also available)

Prepare a simple IdGenerator

For security reasons, ZK generates ID randomly. However to perform a record & reply test, it is mandatory to fix the IDs of the components. The IdGenerator here is used to create a predictable component id when testing.

public class SimpleIdGenerator implements IdGenerator {

    private static final String PREFIX = "zk_comp_";
    private static final String INDEX_KEY = "Id_Num";

    public String nextComponentUuid(Desktop desktop, Component comp) {
    	int i = Integer.parseInt(desktop.getAttribute(INDEX_KEY).toString());
        i++;// Start from 1
        desktop.setAttribute(INDEX_KEY, String.valueOf(i));

        return PREFIX + i;

    public String nextComponentUuid(Desktop desktop, Component comp,
            ComponentInfo info) {
        return nextComponentUuid(desktop, comp);

    public String nextDesktopId(Desktop desktop) {
    	System.out.println("new Desktop");
        if (desktop.getAttribute(INDEX_KEY) == null) {
            desktop.setAttribute(INDEX_KEY, "0");
        return null;

    public String nextPageUuid(Page page) {
        return null;

To use this generator, we have to add a configuration to zk.xml


Install ZK JMeter Plugin

Download zk-jmeter-plugin-0.8.0.jar, then place the jar file in the following folder: JMETER_HOME\lib\ext.

Prepare a Test Plan

  1. Create a Thread Group in Test Group.
  2. Add HTTP Cookie Manager in Thread Group
  3. Add HTTP Request Defaults in Thread Group.
  4. Add Transaction Controller in Thread Group.
  5. Edit HTTP Request Defaults, set the Server Name and Port Number.
  6. Create a ZK HTTP Proxy Server (Add > Non-Test Elements) in WorkBench, and edit it as follows
    • Set Target Controller to Test Plan > Thread Group > Transaction Controller
  7. Start the ZK HTTP Proxy Server


Start to Record Testing Scripts

Now, you are ready to record the request of the browser to a test case. Please switch the proxy of your browser to host:port (in this case, proxy is localhost:9999), and link it to the application ( in this case, it is http://localhost:8080/product-app/index.zul) . I did some selection, textbox typing, and button clicking , you will see not only the first zul request was recorded, but also zkau too. After this has been done, switch the proxy off.

and we need to tick off a checklist of the record:

  • Check that the uuid of zkau is created by SimpleIdGenerator (it will have prefix zk_comp_)
  • Check that there is no rmDesktop command in the zkau record, if you have one, please remove it. ( It is for removing previous tasks when we recorded the testcase, we don’t need it anymore)
  • Make sure Server Name and Port Number are recorded in zkau since we already set them in HTTP Request Defaults.

ZK JMeter Plugin now comes in and will replace dtid parameter value as ${dtid} automatically, we can then use this script to test ZK application immediately without any further tuning. You no longer need to set user variables or parameter for each zkau request manually.

Monitor Server Memory

This JMeter Plugin can also help you in monitoring Server Memory easily.

  1. Add the following JVM arguments to the server start command, then restart the server.
  2. Add JMX Visualizer (Add > Listener) in Thread Group.


In this case,  we set JMX remote port as 1010, then we can start to run the JMeter script, after running the JMeter script, the memory usage chart will be plotted.


ZK JMeter Plugin can help you to perform stress tests on your ZK applications with JMeter easily; automating the process of replacing parameter values with user variables. It also provides a JMX Visualizer which can help users to monitor server memory usage during the test.


  • Download ZK JMeter Plugin here.
  • Latest version(s) on github
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

17 Responses to “ZK JMeter Plugin”

  1. Juan Vicente says:

    Hello , I’m trying to download the plugin with my user , but link always redirects to user/pass screen , despite user and pass are correct (“login succesfully in default screen”), is there any another register?


  2. Jimmy says:

    You should be able to download the file after logging into the website with your ZK forum account. To double check if you have successfully logged in, you can go to zk home page:, then check the upper right corner and see if your user name is there: see

  3. Bob says:

    What’s the difference between JMeter’s default Proxy server and ZK Proxy server? It records Ajax or only XHR? I read about runing Selenium in JMeter so ZK JMeter plugin will replace all this stuff?

  4. Bilal says:

    Hi Jimmy,

    I tested my simple database application through the steps identified in this blog. I able to create the script and run it. But it is not creating the database record in db, that it is suppose to do through the script.

    Not sure what I am missing.


  5. vincent lee says:

    SimpleIdGenerator is of for simple page,but,if the page is created dynamicly as a tabpanel,the components ids are not predictable!!!!!

  6. vincent lee says:

    disable “Redirect Automatically” and “Follow Redirects for ZK Proxy Server

  7. kumar says:

    Hi guys,

    Can u please tell me the where can place this below code..?

    i mean that server start command mean..?

    Monitor Server Memory

    This JMeter Plugin can also help you in monitoring Server Memory easily.

    Add the following JVM arguments to the server start command, then restart the server.

  8. Ramzi says:

    I’m not sure if this is working, I’m running into the same issue. here is the response I get from the server for zkau

    {“rs”:[[“cfmClose”,[“”]],[“obsolete”,[“z_zyg”,”The resource you request is no longer available: z_zyg.\nThis is normally caused by timeout, or opening too many Web pages.\nYou have to reload the page and try again.”]]]}


  9. Robert says:

    @kumar: it depends on the application server where and how to add the JVM arguments in the startup scripts. e.g. here the documentation how to do it in Apache Tomcat

    @Ramzi: the error means the desktop with ID “z_zyg” is not/no longer available on the server. this ID changes from testcase to testcase, please make sure it is not hard coded in your JMeter script, and resolved dynamically using the variable ${dtid}, also make sure the “rmDesktop” command has not been called for this desktop before it is used.

  10. Rainer says:

    The download link for the jmeter Plugin seems not to work at the time

  11. Ro says:

    I have added the following JVM arguments to the JBoss EAP 6.4 server start command, then restart the server.

    However, when I start to run the JMeter, there is no result in JMX Visualizer. Please help.

  12. giri says:

    I installed the jmeter jar and placed it in the jmeter/lib/ext folder. After that i want to record a test script, but the problem is, when i placed the jar in the respective folder, my jmeter got crashed and showing an error as: Uncaught Exception java.lang.NoClassDefFoundError: could not initialize class org.apache.jmeter.gui.util.MenuFactory. see log file for details.

    Please help me with this issue

    Thank you

  13. Robert says:

    the plugin does not work with the latest version of JMeter 3.2+, versions up to 3.1.x still work.


  14. Hemant says:

    Any idea how we use Jmeter to run on zk framework application

    Is this Jmeter Plugin working

  15. Robert says:

    Version 3.2.0 has been released compatible with JMeter 3.2+ (tested up to 5.0)



  16. Devan says:

    I am trying to create a performance test script using Jmeter and this ZK plugin(The WEB site which I was testing is created using ZK AJAX framework). I am able to generate desktop Id(dtid) and component IDs. For some requests, I am getting the same response as a browser.
    But for some requests, I am getting a blank response( {“rs”:[],”rid”:126} ). The script is sending same paramnets as browser. In failed requests some co-orinates like parameters are sending.( data_1 = {“top”:242,”left”:0} ). Is the test failing because of this co-ordinates?

    Please help me with this issue
    Thank you

  17. Robert says:

    Unless the server side event listener depends on the mouse coordinatest they don’t matter.

Leave a Reply