2

I am trying to build a push notification service using MQTT protocol (V3.1) and IBM MQ (8.0.0.0) broker running on suse linux, however, I faced with a problem. I wrote a simple java program to test concurrent connections number in IBM MQ. It simply starts to instantiate MqttClient and connect each of them to the remote IBM MQ broker.

public MyConsumer(String topic) throws MqttException{
             this.client = new MqttClient(SERVER_ADDRESS, MqttClient.generateClientId(), new MemoryPersistence());
             client.setCallback(new MyCallback());

             MqttConnectOptions connectOptions = new MqttConnectOptions();
             connectOptions.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1);
             connectOptions.setCleanSession(false);

             try
             {
                 if (!this.client.isConnected())
                 {
                     this.client.connect(connectOptions);
                     this.client.subscribe(topic);
                 }
             }
             catch (Exception e)
             {
                 System.out.println("****** error ******");
                 e.printStackTrace();
             }
         }

The strange thing is that I got "Connection lost (32109) - java.io. EOFException" exception after around 870 clients had successfully connected to the broker:

Connection lost (32109) - java.io.EOFException
     at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146)
     at java.lang.Thread.run(Thread.java:745)
 Caused by: java.io.EOFException
     at java.io.DataInputStream.readByte(DataInputStream.java:267)
     at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65)
     at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107)
     ... 1 more

I ran the test program in two different computers simultaneously to be sure that the problem is not related the testing computer. Also, I defined two telemetry channels in a queue manager, each deploy on different port, but the total clients connected to the broker was still around 870! Finally, I created two queue managers and under this circumstance the client connections doubled in number. I checked the mqxr log, but there was no error log. Can anybody give me any clue that why each queue manger only accepts this number connection.

P.S: might be helpful to mention that I test this sample with emqtt broker (another mqtt broker) and it works perfectly (with more than 5k connections)

khesam109
  • 510
  • 9
  • 16
  • There are many hard restrictions within IBM WebSpereMQ. Almost any of them are configurable at some place. Most likely the number of concurrent connections or something like that are exhausted. But is it really intended to have 5k concurrent *applications* connected concurrently? Usually an application services several queues within a single connection. Note that the number of /sessions/ is not equal to the number of connections. – Marcel Jul 21 '18 at 12:14
  • @Marcel As you might know, MQTT protocol relays on TCP/IP, which means it is state-full. By this test, I want to know the max number of connections in which each IBM queue can handle. Obviously, each connection creates a session on IBM MQ, and i see that IBM MQ maintains all the sessions. The problem is that a new client will not connect to the client, if the broker connected to 870 clients. – khesam109 Jul 21 '18 at 13:28

1 Answers1

0

push notification service using MQTT protocol (V3.1) and IBM MQ (8.0.0.0) broker

First off, why aren't you using MQTT protocol v3.1.1?

Secondly, stop using version '0' of the product. Upgrade immediately to MQ v8.0.0.10 or better MQ v9.0.0.4.

Finally, how many client applications (processes) are you running to create the 870 connections?

Roger
  • 7,062
  • 13
  • 20
  • The reason I am using Mqtt V3.1 is that IBM MQ 8.0.0.0 does not support Mqtt V3.1.1 and throw a MqttInvalidVersionException. About upgrading the IBM MQ, I will do, but it seems strange that the problem is related to it. For the last question, it doesn't affect to the result. The results are same when I run a single client application or more (As I mentioned above, I ran 2 client applications in two different physical computer but the total Mqtt connections wouldn't change!) – khesam109 Jul 23 '18 at 13:06