2
votes

I want to use JMeter with the Plugin maciejzaleski/JMeter-WebSocketSampler to make some websocket tests.

At the server side I have running a tomcat with a java websocket endpoint. So I'm using the websocket library from the tomcat 8.0.

In my test I send with the jmeter sampler a request message with a number to the server. If the OnMessage event is fired, I use the number to read a number of datasets out of a mongodb. After reading the datasets I want to send them back to jmeter. It works like a echo server.

 @OnMessage
public void echo(int message, Session session) throws IOException{

    System.out.println("Client message: " + message);

    int limit=0;
    limit = message;



    //connect to mongoDB

    //MongoClient client = new MongoClient("localhost",27017);
    mongo = new MongoAccess(client);

    //start time reading data
    long timeOne = System.currentTimeMillis();
    System.out.println("Time One:" + timeOne + "ms");

    //read data from mongoDB
    String data= mongo.readNumberOfDocuments(limit).toString();

    //end time reading data
    long timeTwo = System.currentTimeMillis();
    System.out.println("Time Two:" + timeTwo + "ms");
    System.out.println("Read Time Mongo: " + (timeTwo-timeOne) + "ms");



    //send data to client
    session.getBasicRemote().sendText("DB Time:" + (timeTwo-timeOne)+"ms "+data);


    //close connection to mongoDB
    client.close(); 

    //Logging read times from mongo db
    logReadTime(timeOne,timeTwo,"OnMessage");




}

JMeter Testplan

If I send the number 100 for 100 datasets and use the loop one time it works fine. But if I want more datasets like 1000 or use in the loop 100 it doesn't work. My tomcat throws exceptions like this.

Tomcat Exception

And the server can send only 113 datasets instead of 1000 because the connection is closed bevor the datasets can arrive.

My goal is to send different numbers of datasets over the websocket connection and change the number of loops. For example I want to send 100 times a request and receive 1000 datasets to jmeter. Additionally I want to simulate different numbers of users. So I want to analyse the different response times.

I think the problem is on the jmeter side because with a simple websocket client in my browser I have no problems....

Any ideas what I did wrong? How can I test something like that with Jmeter?

2

2 Answers

3
votes

As of september 2017, the most up to date, maintained and powerful websocket plugin is this one:

It can be easily installed through jmeter-plugins Plugin Manager:

As per the issue you opened, there is no support yet in the plugin for frames of type 0 but developer is working on it. See also:

0
votes

The websocket plugin has some issues and although proposed fixes are sometimes merged by the maintainer, there are some improved forks for this plugin (I created one myself). So I would check those and see if there is one that solves your particular problem. I think I remember that some 'high volume' issues were addressed by some of the forks. See here: https://github.com/maciejzaleski/JMeter-WebSocketSampler/network

Hope it helps.