简体   繁体   中英

Only limited mqtt clients connect to IBM MQ broker

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.

PS: 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)

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM