Giter VIP home page Giter VIP logo

mqtt-jmeter's Introduction

mqtt-jmeter Overview

MQTT JMeter Plugin extends your JMeter's capability to test against MQTT protocol, just as easy as ordinary HTTP protocal.

It has been used to benchmark EMQ server performance, and here is the report link.

This plugin is developed and maintained by XMeter. XMeter is a professional performance testing service provider.

Install instruction

The plugin is a standard JMeter plugin. You can download the latest version of mqtt-jmeter from here, and then copy the downloaded JAR files into $JMETER_HOME/lib/ext folder. After restarting the JMeter, you can see "MQTT samplers" provided by this plugin.

To use this plugin, we recommend you to install JMeter 3.2 or above.

Build from source code

If you'd like to build binary by yourself, please clone the project and run 'mvn install'. Maven will download some JMeter dependency binary files, so the build elapsed time will up to your network status.

How to use

The plugin includes 4 samplers:

  • Connect sampler: Initiate MQTT server connection on behalf of a device. In addition to normal connection setup, this sampler can be used to simulate massive "background" connections(no data transimission but regular hearbeat signals) to the designated MQTT server or cluster system.

  • Pub sampler: publish various messages to the target MQTT server.

  • Sub sampler: subscribe message(s) from target MQTT server.

  • DisConnect sampler: Reset the connection to target MQTT server.

If MQTT JMeter plugin is successfully installed, you can find these MQTT samplers under JMeter 'Sampler' context menu.

mqtt_jmeter_plugin

Connect Sampler

conn_sampler

MQTT connection

This section includes basic connection settings.

  • Server name or IP: The MQTT target to be tested. It can be either IP address or server name. The default value is 127.0.0.1. DO NOT add protocol (e.g. tcp:// or ssl://) before server name or IP address!

  • Port number: The port opened by MQTT server. Typically 1883 is for TCP protocol, and 8883 for SSL protocol.

  • MQTT version: The MQTT version, default is 3.1, and another option is 3.1.1. Sometimes we found version 3.1.1 is required to establish connection to Azure IoTHub.

  • Timeout(s): The connection timeout seconds while connecting to MQTT server. The default is 10 seconds.

MQTT Protocol

The sampler supports 4 protocols, TCP, SSL, WS, WSS. For SSL and WSS protocols, it includes normal SSL and dual SSL authentication.

If 'Dual SSL authentication' is checked, please follow 'Certification files for SSL/TLS connections' at end of this doc to set the client SSL configuration properly.

protocol_setting

User authentication

User can configure MQTT server with user name & password authentication, refer to EMQ user name and password authentication guide.

  • User name: If MQTT server is configured with user name, then specify user name here.

  • Password: If MQTT server is configured with password, then specify password here.

Connection options

  • ClientId: Identification of the client, i.e. virtual user or JMeter thread. Default value is 'conn_'. If 'Add random client id suffix' is selected, JMeter plugin will append generated uuid as suffix to represent the client, otherwise, the text of 'ClientId' will be passed as 'clientId' of current connection.
  • Keep alive(s): Ping packet send interval in seconds. Default value is 300, which means each connection sends a ping packet to MQTT server every 5 minutes.
  • Connect attempt max: The maximum number of reconnect attempts before an error is reported back to the client on the first attempt by the client to connect to a server. Set to -1 to use unlimited attempts. Defaults to 0.
  • Reconnect attempt max: The maximum number of reconnect attempts before an error is reported back to the client after a server connection had previously been established. Set to -1 to use unlimited attempts. Defaults to 0.
  • Clean session: If you want to maintain state information between sessions, set it to false; otherwise, set it to true.

Pub Sampler

pub_sampler

Pub sampler reuses previously established connection (by Connect sampler) to publish a message. If connection is not ready at this moment, pub sampler will just fail immediately.

Pub options

  • QoS level: The available QoS value, 0 is AT_MOST_ONCE, 1 is AT_LEAST_ONCE and 2 is EXACTLY_ONCE.
  • Retained messages: Set it to true if the Pub sampler wants the broker to keep the last message on the given topic, so that the client subscribed to that topic receives the retained message immediately after subscription.
  • Topic name: Name of the topic that the message will be sent to.
  • Add timestamp in payload: Add timestamp in the payload or not. If the checkbox is enabled, then timestamp of running pub sampler will be added before real payload. Mostly it's used together with Sub sampler to calculate message latency time.

Payloads

Message type: 3 types of message can be used.

  • String: The normal string that sent to MQTT server. It can also be a JMeter variable.

  • Hex string: The hex string that sent to MQTT server. The chars input must be [0-9] or [A-F] or [a-f]. The hex string will be converted to binary and send to server. It can also be a JMeter variable.

  • Random string with fixed length: Refer to below screenshot. If the option is selected, then it requires user to input 'Length'. The length means the auto generated string length. Default is 1024, which means generated a 1kb size of random string.

payload_setting

Sub Sampler

sub_sampler

Sub sampler reuses previously established connection (by Connect sampler) to subscribe message(s). If connection is not ready at this moment, sub sampler will just fail immediately.

Sub options

  • QoS level: The available QoS value, 0 is AT_MOST_ONCE, 1 is AT_LEAST_ONCE and 2 is EXACTLY_ONCE.

  • Topic name(s): A list of topic names (comma-separated) that will be subscribed to.

  • Payload includes timestamp: If the checkbox is enabled, then it means the payload includes timestamp. It can be used to calcuate the message latency time.

message_latency = timestamp_in_sub_when_receive_msg - timestamp_in_payload (timestamp in pub machine when sending out message)

Please notice, if the machine publish message is not the same as subscriber, then the calculated message latency time is not accurate. 
It's because the time is almost not the same in different machines. So the latency time calculated by sub sampler could be only be a reference.
  • Sample on: It controls how to sample. The default value is 'elapsed with specified time(ms)', which means a sub sampler will occur every specified milli-seconds (default is 1000ms). During the 1000 ms, multiple messages could be received, and result in report is the summarized data during 1000 ms. If the value is set to 2000, then means summarized report during 2000 ms. Another option is 'number of received messages', which means a sub sampler will occur after receiving these specified number of messages (default is 1).

  • Debug response: If checked, the received message will be print in response. It's recommended to enable this option when you debug your script.

DisConnect Sampler

disconn_sampler

This sampler is very simple, it just clear the previous created connection. Therefore, next time you run Connect sampler, it will initiate a new MQTT server connection for you. As you can imagine, Disconnect sample will fail immediately if no connection is detected at this moment.

Example JMeter Scripts

As a reference, you can check out some example scripts in SampleScripts folder.

  1. background_connection.jmx: Simulate massive background MQTT connections to server. You can optionally subscribe to a topic when connecting. (Please modify "xmeter_runtime_vars" UDV to fit your needs.)

  2. pubsub_unidirection.jmx: Demonstrate how sub sampler can get messages from corresponding pub sampler, with two JMeter user groups and delay between opertions.

  3. pubsub_bidirection.jmx: Demonstrate how a set of Devices and Mobiles exchange messages in both directions.

example_scripts

Certification files for SSL/TLS connections

After deploying emqtt server, you get the following OOTB (out of the box) SSL/TLS certification files under ${EMQTTD_HOME}/etc/certs directory:

  1. cacert.pem : the self-signed CA certification

  2. cert.pem : certification for emqtt server

  3. client-cert.pem : certfication for emqtt client in order to connect to server via SSL/TLS connection. In this jmeter plugin case, the client implies jmeter "virtual user"

  4. client-key.pem key.pem : key files to protect client and server certification respectively

[Note:] The above server and client certifications are both issued by the self-signed CA. If you would like to use official certifications for your EMQTT deployment, please check out relevant document to configure it.

We will use the OOTB test certfications (as an example) to show you how to prepare the required certification files for this EMQTT JMeter plugin.

export PATH=$PATH:<YOUR_JDK_HOME>/bin

keytool -import -alias cacert -keystore emqtt.jks -file cacert.pem -storepass <YOUR_PASSWORD> -trustcacerts -noprompt
keytool -import -alias client -keystore emqtt.jks -file client-cert.pem -storepass <YOUR_PASSWORD>
keytool -import -alias server -keystore emqtt.jks -file cert.pem -storepass <YOUR_PASSWORD>

openssl pkcs12 -export -inkey client-key.pem -in client-cert.pem -out client.p12 -password pass:<YOUR_PASSWORD>

Specify key store, client certfication and corresponding pass phrases in plugin sampler:

ssl_conn

mqtt-jmeter's People

Contributors

changingfond avatar chongyuanyin avatar dahoc avatar frankyfish avatar jadeite09 avatar jinfahua avatar mariusstaicu avatar red-asuka avatar rende2005 avatar zielu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mqtt-jmeter's Issues

Unable to load topic on each iteration from csv file

Hi,

I have created a script using MQTT plug in which sends messages to a topic.
I have parameterized payload and passing message from csv file.
Jmeter is able to load new message from csv file on each iteration and publish to the topic which is hard coded.
But when I try to parameterise Topic name and pass it from csv file, topic name is loaded only once when thread is actually started and is unable to update topic name on each iteration which is my requirement.

I cant create connection to my azure IoT Hub

Hi,
I have been trying simulate multiple devices for load testing my IoT hub ,
But iam not able to create a successful connection to IoT hub from jmeter
connecrionsampller

I am getting an error like below
image
Could you please help to fix this issue, i haven't given "ssl://" in the Server name field also there is nothing wrong with my username and Password

ERROR - net.xmeter.samplers.PubSampler: Ping timeout java.net.ProtocolException: Ping timeout

2017/03/17 09:23:00 INFO - jmeter.reporters.Summariser: summary + 150 in 00:00:30 = 5.0/s Avg: 4 Min: 0 Max: 11 Err: 18 (12.00%) Active: 50 Started: 50 Finished: 0
2017/03/17 09:23:00 INFO - jmeter.reporters.Summariser: summary = 228482 in 12:43:33 = 5.0/s Avg: 18 Min: 0 Max: 527934 Err: 15480 (6.78%)
2017/03/17 09:23:01 ERROR - net.xmeter.samplers.PubSampler: Ping timeout java.net.ProtocolException: Ping timeout
at org.fusesource.mqtt.client.CallbackConnection$7$1.run(CallbackConnection.java:467)
at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100)
at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77)

我看到CallbackConnection.java:467

handleSessionFailure(new ProtocolException("Ping timeout").fillInStackTrace());

是不是意味着jmeter和mqtt的连接有问题,pub sample超时了?

CSV data set variables not supported by MQTT PUB sampler

I have "CSV dataset confg" in my test plan. Im sending values like URL, PORT via the csv files.

  • I added the beanshell sampler so that i could print out the value of the variables and the variable values are simply present.
  • It works fine for Subscriber but the PUB SAmpler is not working.

below is the log:
2017/03/22 16:15:17 ERROR - net.xmeter.samplers.PubSampler: Illegal character in authority at index 6: ssl://${url}:${port} java.net.URISyntaxException: Illegal character in authority at index 6: ssl://${url}:${port}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
at org.fusesource.mqtt.client.MQTT.setHost(MQTT.java:307)
at net.xmeter.samplers.PubSampler.threadStarted(PubSampler.java:147)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:659)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:628)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:616)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:245)
at java.lang.Thread.run(Unknown Source)

2017/03/22 16:15:17 ERROR - net.xmeter.samplers.PubSampler: Illegal character in authority at index 6: ssl://${url}:${port} java.net.URISyntaxException: Illegal character in authority at index 6: ssl://${url}:${port}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
at org.fusesource.mqtt.client.MQTT.setHost(MQTT.java:307)
at net.xmeter.samplers.PubSampler.threadStarted(PubSampler.java:147)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:659)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:628)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:616)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:245)
at java.lang.Thread.run(Unknown Source)

2017/03/22 16:15:17 ERROR - net.xmeter.samplers.SubSampler: Illegal character in authority at index 6: ssl://${url}:${port} java.net.URISyntaxException: Illegal character in authority at index 6: ssl://${url}:${port}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
at org.fusesource.mqtt.client.MQTT.setHost(MQTT.java:307)
at net.xmeter.samplers.SubSampler.threadStarted(SubSampler.java:176)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:659)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:628)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:616)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:245)
at java.lang.Thread.run(Unknown Source)

2017/03/22 16:15:17 ERROR - net.xmeter.samplers.PubSampler: Illegal character in authority at index 6: ssl://${url}:${port} java.net.URISyntaxException: Illegal character in authority at index 6: ssl://${url}:${port}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
at org.fusesource.mqtt.client.MQTT.setHost(MQTT.java:307)
at net.xmeter.samplers.PubSampler.threadStarted(PubSampler.java:147)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:659)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:628)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:616)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:245)
at java.lang.Thread.run(Unknown Source)

2017/03/22 16:15:17 ERROR - net.xmeter.samplers.SubSampler: Illegal character in authority at index 6: ssl://${url}:${port} java.net.URISyntaxException: Illegal character in authority at index 6: ssl://${url}:${port}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
at org.fusesource.mqtt.client.MQTT.setHost(MQTT.java:307)
at net.xmeter.samplers.SubSampler.threadStarted(SubSampler.java:176)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:659)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:628)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:616)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:245)
at java.lang.Thread.run(Unknown Source)

2017/03/22 16:15:17 INFO - jmeter.services.FileServer: Stored: C:\AAAdata\MQTTDS1.csv
2017/03/22 16:15:17 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of: ``print "R url =" 112.118.10.118 print "RAUL port =" 8883 . . . ''

[4da70e5] sub时会抛出连接断开异常

简单的一个connection(ssl 用户名和密码),一个sub
当运行到sub的时候就会报如下异常信息,附上jmeter.log
再复用连接去pub就会失败,需重新创建新连接

Oct 10, 2018 6:43:19 PM net.xmeter.samplers.ConnectSampler$1 debug
信息: MQTT Tracer: Fatal connection failure: %s

jmeter.log

Can't send hex string.

I'm trying to send hex string:
08B19ECCDD0542480A1608AB9ECCDD05120205072A06F603D40E182A300238030A1608AB9ECCDD05120200062A06F603D40E182A300338030A1608AB9ECCDD05120200062A06F603D40E182A30053801

But getting the error:

java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
	at net.xmeter.samplers.PubSampler.hexToBinary(PubSampler.java:75) ~[mqtt-xmeter-1.0.1-jar-with-dependencies.jar:?]
	at net.xmeter.samplers.PubSampler.sample(PubSampler.java:100) ~[mqtt-xmeter-1.0.1-jar-with-dependencies.jar:?]
	at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at java.lang.Thread.run(Thread.java:844) [?:?]

Am I doing something wrong?

MQTT Sub sampler "Dual SSL authentication" gets auto-selected unwantedly.

I do not need Dual SSL authentication so In my Test plan, I use SUB sampler, with only Trust Key Store(*.jks) and leave Client Ceritfication empty.
It works fine.
Now if i close the test plan and open it again, it selects the Dual SSL Authentication check box by default and due to this my response never comes and test fails.
(Note:Previous version was not having this issue.) same issue applies to PUB sampler as well.
image

MQTT Pub Sampler -Publish Failed (500) Error

Hi,

I have used MQTT Pub Sampler without Thread Group -Scheduler option and all works fine.When we try to setup Scheduler option for specific duration like 300 Sec and Thread Group Loop Count-Forever,the publish get failed (500 Error)

Error Screenshot

image

Thread Group Scheduler Screenshot

image

The tail bean is full, will create a new bean for it

脚本1:建立一次连接之后,循环100次pub消息,断开连接。
脚本2:建立一次连接之后,循环100次sub消息,断开连接,消费的消息数量还未达到100会报如下信息,并且循环未能停止。

“Oct 24, 2018 5:10:45 PM net.xmeter.samplers.SubSampler handleSubBean
INFO: The tail bean is full, will create a new bean for it.”

请求此问题如何解决?

Connection keep time is not working in Distributed mode

Hello,
I am performing the scalability test for mqtt. So i am using the distributed testing for it in the Connection sampler i given the connection keep time as 60 sec and the threads are connecting and disconnecting they are not waiting for 60 sec. please help me how to solve this issue.

可以把pub sample和sub sample做成一个sample吗?

就做成一个类似http的请求和响应接收,比如我要先pub到mqtt服务器,然后mqtt服务器马上会返回一个响应。
目前是分开的 导致pub后服务器传回来的消息不能迅速被接收到。

WSS Support?

Trying to load test my IOT MQTT , but from what I can tell this plugin doesn't support WSS? Also I have a host name and then a path, should it work just inputting the entire URL into server name?

Thanks for this!

Response Body中正则表达式对Value的提取

我想提取中Sub Sample中Response Data的某个值,如下:
1
我使用了正则表达式,如下:
2
但是提取的值是空的,如下:
3
我尝试了HTTP Sample的正则提取,是没有问题的,所以是不是Sub sample的Response Data没有绑定到Result中去呢?

TimeoutException when connecting to Azure Iothub

Hi,
I've been trying to send a payload data to a device in azure iot hub through this mqtt plugin in jmeter. But it doesn't connect to the hub and there's an exception throwing as below.

ERROR - net.xmeter.samplers.PubSampler:  java.util.concurrent.TimeoutException
	at org.fusesource.mqtt.client.Promise.await(Promise.java:83)
	at net.xmeter.samplers.PubSampler.sample(PubSampler.java:141)
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
	at java.lang.Thread.run(Thread.java:748)

Is there any more configurations need to be done in addition to clientId, Topic name,Username,Password and Server name or IP?
Thank you in advance.

SEVERE: Cannot assign requested address

When ran in AWS ec2, when connections hit 28K we get following error consistently :

net.xmeter.samplers.ConnectionCallback onFailure
SEVERE: Cannot assign requested address

Plugin version : v1.0.1
Jmeter version : 3.1

Are we missing any configuration ?

Change MQTT SDK to Paho

The plugin current is using fusesource MQTT SDK,

  • The fusesource is not active.
  • The MQTT 5.0 version was released at 2018, need support from MQTT SDK.

So we'll investigate the possibility to switch MQTT SDK to Paho

SubSampler: Include also topic in the SampleResult.

Hi,
Mqtt topics to be subscribed can contain wildcards (For example + or #) . When a client subscribes to such a topic, call backs are returned with actual topic name (without any wildcards) and message body. In the mqtt library used here, Listener class has a method onPublish(topic, body, ack). It would be very helpful, if this topic is also available as part of the SampleResult similar to body (which you set as responsemessage). In my opinion, these topics also have valuable information that can be used for tests and post-processing.

Do you see any chance of including this too? It would be great.

Thank you in advance.

Best Regards,
Karthees

Dual SSL authentication - password fields are reversed

Used mqtt-xmeter-jar-with-dependencies.jar.zip in verion 1.0.

And try to connected so ssl mqtt broker by Dual SSL authentication and got errors that password of truststore is wrong.
Note: My Trust Key Store and Client Certificate have different password. After tying hours and suddenly found out that the password fields are reversed. Secret beside Trust Key Store is the secret for the Client Certificate and the secret beside Client Certificate is the password for the Trust Key Store.

Greetings

关于JMeter MQTT插件是否可以连接Azure?

最近有个任务,需要连接Azure ,但是每次都没有成功
报错
java.io.EOFException: Peer disconnected at org.fusesource.hawtdispatch.transport.AbstractProtocolCodec.read(AbstractProtocolCodec.java:331) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.transport.TcpTransport.drainInbound(TcpTransport.java:710) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.transport.SslTransport.drainInbound(SslTransport.java:276) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.transport.TcpTransport$6.run(TcpTransport.java:592) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.internal.NioDispatchSource$3.run(NioDispatchSource.java:209) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77) ~[mqtt-xmeter-jar-with-dependencies.jar:?]

有试过连接Azure IOTHub中心的吗?

using "share conn in thread" - sample doesn't stop in case of a lost connection

Using two mqtt Pub sampler in one thread (sampler A and sampler B) with "share conn in thread" option.
Sampler A build the connection and publish a message.

Sampler B is publishing the message with a delay after sampler A.

During that delay the connection get lost and sampler B is running in a exception:

2018-04-05 15:10:25,124 INFO n.x.s.PubSampler: Use the shared connection: org.fusesource.mqtt.client.CallbackConnection@46877199
2018-04-05 15:10:25,124 ERROR n.x.s.PubCallback: Peer disconnected
java.io.EOFException: Peer disconnected
at org.fusesource.hawtdispatch.transport.AbstractProtocolCodec.read(AbstractProtocolCodec.java:331) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
at org.fusesource.hawtdispatch.transport.TcpTransport.drainInbound(TcpTransport.java:710) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
at org.fusesource.hawtdispatch.transport.SslTransport.drainInbound(SslTransport.java:276) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
at org.fusesource.hawtdispatch.transport.TcpTransport$6.run(TcpTransport.java:592) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
at org.fusesource.hawtdispatch.internal.NioDispatchSource$3.run(NioDispatchSource.java:209) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77) ~[mqtt-xmeter-jar-with-dependencies.jar:?]

But testplan didn't stop, also with a defined timeout of 5 seconds.

NullPointerException during Load Testing.

Currently using JMeter version 3.2 with mqtt-jmeter v0.93.
Doing load testing with JMeter and getting a NullPointerException as shown in logs below.
If anyone has seen a similar issue or has any suggestions it would be appreciated.

2017-07-05 11:13:16,748 INFO o.a.j.t.JMeterThread: Thread is done: Connect Clients 1-12904
2017-07-05 11:13:16,748 INFO o.a.j.t.JMeterThread: Thread finished: Connect Clients 1-12904
2017-07-05 11:13:16,748 INFO o.a.j.t.JMeterThread: Thread started: Connect Clients 1-12912
2017-07-05 11:13:16,753 ERROR o.a.j.JMeter: Uncaught exception: 
java.lang.NullPointerException: null
	at org.fusesource.mqtt.client.CallbackConnection$7.run(CallbackConnection.java:450) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.hawtdispatch.transport.HeartBeatMonitor$3.run(HeartBeatMonitor.java:87) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.hawtdispatch.transport.HeartBeatMonitor$1.run(HeartBeatMonitor.java:65) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100) [mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77) [mqtt-xmeter-jar-with-dependencies.jar:?]
2017-07-05 11:13:16,757 ERROR n.x.s.ConnectionSampler: Too many open files
java.net.SocketException: Too many open files
	at sun.nio.ch.Net.socket0(Native Method) ~[?:1.8.0_131]
	at sun.nio.ch.Net.socket(Net.java:411) ~[?:1.8.0_131]
	at sun.nio.ch.Net.socket(Net.java:404) ~[?:1.8.0_131]
	at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:105) ~[?:1.8.0_131]
	at sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:60) ~[?:1.8.0_131]
	at java.nio.channels.SocketChannel.open(SocketChannel.java:145) ~[?:1.8.0_131]
	at org.fusesource.hawtdispatch.transport.TcpTransport.connecting(TcpTransport.java:424) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.mqtt.client.CallbackConnection.createTransport(CallbackConnection.java:286) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.mqtt.client.CallbackConnection.connect(CallbackConnection.java:139) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.mqtt.client.FutureConnection$2.run(FutureConnection.java:146) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100) ~[mqtt-xmeter-jar-with-dependencies.jar:?]
	at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77) ~[mqtt-xmeter-jar-with-dependencies.jar:?]

同一线程中多个sub针对多个topic的监听 前几个都会返回connection failed

我想在一个线程中 添加多个sub sample,都是对应同一个服务器,但是每个对应不同的topic
比如:

  1. topic: /akResp/2ed384d0-6812-451a-a515-ddc408e33556
  2. topic: /akResp/${SessionId}
  3. topic: /akResp1/#
    在执行过程中,前面2个都会返回connection failed,只有第三个可以返回数据。
    这个是因为监听有冲突吗?
    1
    如果把share connection打钩 那么第一个topic应该收到的信息却被第三个topic收到。。。

how to enable will topic

while the mqtt client connect to server, maybe it needs to add will topic for the connect telegram, and how to enable will topic ??

PubSampler does not re-connect when server returns SERVER_UNAVAILABLE while login

Hi,
the plugin does not re-connect when server returns SERVER_UNAVAILABLE while login even when connect attempts are set to -1. This leads to failing samples on each invocation as PubSampler fails all results when connection is not ready.

The root cause is in underlying MQTT client: https://github.com/fusesource/mqtt-client/blob/1c8a86a9e678b9a71481116e1e294125616482f3/mqtt-client/src/main/java/org/fusesource/mqtt/client/CallbackConnection.java#L360

Do you see any chance to get this fixed within the jmeter plugin as the MQTT client project seems to be dead or do you have any plans to switch or fork the underlying MQTT client?

Many thanks
Daniel

How to send MQTT offline messages

How to send MQTT offline messages?
I need to test a scene,my subscriber received the news from the publisher when he was not online.
Qos Levle:2 can't solve the problem.

Copy paste does not work.

Steps:

  1. Copy a thread and paste it some where in test plan.
  2. Or copy a MQTT PUB sampler and paste it in some other Thread. It shows the error:
    "An Error occured while copying node: java.lang.Object"

host null and port out of range exception

I am trying to use the MQTT Pub Sampler with the below options:
Server name or IP: something(my server hostname)
port number: 8883
protocols: SSL - Dual SSL Authentication( I have the jks and p12 cert's with secret)
user name and password - we dont use username/password we only use cert's
client id prefix - something(my client id)
QoS level - 0
Topic name: something/something
payload: some string

When I try to use the mqtt pub sampler with above parameters I am getting below error.
I am getting below error:
2017/02/23 10:37:53 INFO - jmeter.engine.StandardJMeterEngine: Running the test!
2017/02/23 10:37:53 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2017/02/23 10:37:53 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,local)
2017/02/23 10:37:53 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2017/02/23 10:37:53 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2017/02/23 10:37:53 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error
2017/02/23 10:37:53 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false
2017/02/23 10:37:53 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2017/02/23 10:37:53 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2017/02/23 10:37:53 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
2017/02/23 10:37:53 INFO - net.xmeter.Util: Configured with dual SSL, trying to load key files.
2017/02/23 10:37:53 ERROR - jmeter.JMeter: Uncaught exception: java.lang.IllegalArgumentException: hostname can't be null
at java.net.InetSocketAddress.checkHost(InetSocketAddress.java:149)
at java.net.InetSocketAddress.(InetSocketAddress.java:216)
at org.fusesource.hawtdispatch.transport.TcpTransport$2.run(TcpTransport.java:458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

But when I prefix this with ssl://my host name I get the below exception.
2017/02/23 10:38:29 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2017/02/23 10:38:29 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2017/02/23 10:38:29 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
2017/02/23 10:38:29 INFO - net.xmeter.Util: Configured with dual SSL, trying to load key files.
2017/02/23 10:38:38 ERROR - jmeter.JMeter: Uncaught exception: java.lang.IllegalArgumentException: port out of range:-1
at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
at java.net.InetSocketAddress.(InetSocketAddress.java:224)
at org.fusesource.hawtdispatch.transport.TcpTransport$2.run(TcpTransport.java:458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Could you kindly suggest me what could go wrong here or did I provide in wrong format.

订阅消息后,没有响应内容

我订阅了消息后,但是响应内容那里却没有消息
image

image
image
而我用mqtt.fx工具是可以收到订阅消息的,如下图:
image
有人告诉我,我这个是什么问题吗?

port out of range:-1

i am trying to publish a massage to IOT on port 8883 but detect an exception (in attach the configuration
issue
):

  1. if i use this Server Name: SIT-IOT....... the error is:
    2017/02/23 11:30:11 ERROR - net.xmeter.samplers.PubSampler: Peer disconnected java.io.EOFException: Peer disconnected
    at org.fusesource.hawtdispatch.transport.AbstractProtocolCodec.read(AbstractProtocolCodec.java:331)
    at org.fusesource.hawtdispatch.transport.TcpTransport.drainInbound(TcpTransport.java:657)
    at org.fusesource.hawtdispatch.transport.SslTransport.drainInbound(SslTransport.java:244)
    at org.fusesource.hawtdispatch.transport.TcpTransport$6.run(TcpTransport.java:538)
    at org.fusesource.hawtdispatch.internal.NioDispatchSource$3.run(NioDispatchSource.java:226)
    at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:96)
    at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77)

  2. if i use this Server Name: ssl://SIT-IOT....... the error is:
    2017/02/23 11:37:08 ERROR - jmeter.JMeter: Uncaught exception: java.lang.IllegalArgumentException: port out of range:-1
    at java.net.InetSocketAddress.checkPort(Unknown Source)
    at java.net.InetSocketAddress.(Unknown Source)
    at org.fusesource.hawtdispatch.transport.TcpTransport$2.run(TcpTransport.java:416)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

MQTT Connect Sampler show 500 error

/home/test/桌面/jietu.png
打印消息如下:
2018/04/11 10:01:18 INFO - jmeter.engine.StandardJMeterEngine: Running the test!
2018/04/11 10:01:18 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2018/04/11 10:01:18 INFO - net.xmeter.samplers.ConnectionSampler: *** Keeptime is: 1800
2018/04/11 10:01:18 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,local)
2018/04/11 10:01:18 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : 线程组
2018/04/11 10:01:18 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group 线程组.
2018/04/11 10:01:18 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error
2018/04/11 10:01:18 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false
2018/04/11 10:01:18 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2018/04/11 10:01:18 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2018/04/11 10:01:18 INFO - jmeter.threads.JMeterThread: Thread started: 线程组 1-1
2018/04/11 10:01:18 ERROR - net.xmeter.samplers.ConnectionSampler: String index out of range: -10 java.lang.StringIndexOutOfBoundsException: String index out of range: -10
at java.lang.String.substring(String.java:1911)
at net.xmeter.Util.generateClientId(Util.java:34)
at net.xmeter.samplers.ConnectionSampler.sample(ConnectionSampler.java:62)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
at java.lang.Thread.run(Thread.java:748)

2018/04/11 10:01:18 ERROR - jmeter.samplers.SampleResult: setEndTime must be called after setStartTime java.lang.Throwable: Invalid call sequence
at org.apache.jmeter.samplers.SampleResult.setEndTime(SampleResult.java:1046)
at org.apache.jmeter.samplers.SampleResult.sampleEnd(SampleResult.java:1085)
at net.xmeter.samplers.ConnectionSampler.sample(ConnectionSampler.java:93)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
at java.lang.Thread.run(Thread.java:748)

2018/04/11 10:01:18 INFO - net.xmeter.samplers.ConnectionSampler: Created the sampler results, will sleep current thread for 1800 sceconds
2018/04/11 10:01:18 INFO - net.xmeter.samplers.ConnectionSampler: Connection is null.
2018/04/11 10:01:18 INFO - jmeter.threads.JMeterThread: Thread is done: 线程组 1-1
2018/04/11 10:01:18 INFO - jmeter.threads.JMeterThread: Thread finished: 线程组 1-1
2018/04/11 10:01:18 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
2018/04/11 10:01:18 INFO - net.xmeter.samplers.ConnectionSampler: in testEnded, isNonGUI=false, sleepFlag=false
2018/04/11 10:01:18 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,local)
jietu

sub sample循环如何设置才能保证一次收到一条消息?

我这边目前设置500ms,现在压力不大,但是还是有一次收到多条的情况

grep "Received 2 of message" result.jtl |wc -l 
258

因为我是用Switch Controller根据收到的消息类型来发送pub sample,在sub sample循环的时候,如果刚好收到一条消息,那么从response body提取到是什么类型的消息,然后执行pub sample

循环间隔可以再小点解决问题,但是太小了有大量的循环,会不会影响jmeter执行效率

连接是发布和订阅消息的基础

在现有的插件中, 发布消息或者订阅消息是包含了连接操作, 能否做到先是连接操作,然后才是发布或者订阅消息, 可参考mqttfx客户端。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.