RabbitMq with Mqqt with ubuntu & windows

25 views
Skip to first unread message

Lotiya Hardik

unread,
Dec 1, 2016, 11:50:02 PM12/1/16
to MQTT
I'm using RabbitMq 3.6.6 with paho.mqttv3 protocol my simple code like

int max_connections =10000;
String broker = "tcp://xxx.xxx.x.xx:1883";
String clientId = "Publisher";
String content="Hii";
int qos=1;
String topic="Cluster";


MemoryPersistence persistence = new MemoryPersistence();
MqttClient sampleClient[] = new MqttClient[max_connections];

Thread t[] = new Thread[max_connections];
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true);

for (int i = 0; i < max_connections; i++) {
    try {
        sampleClient[i] = new MqttClient(broker, clientId + "" + i, persistence);
        sampleClient[i].connect(connOpts);
    } catch (MqttException ex) {
        ex.printStackTrace();
        return;
    } 
}


I'm using RabbitMq 3.6.6 with paho.mqttv3 protocol my simple code like

int max_connections =400000;
String broker = "tcp://xxx.xxx.x.xx:1883";
String clientId = "Publisher";
String content="Hii";
int qos=1;
String topic="Cluster";


MemoryPersistence persistence = new MemoryPersistence();
MqttClient sampleClient[] = new MqttClient[max_connections];

Thread t[] = new Thread[max_connections];
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true);

for (int i = 0; i < max_connections; i++) {
    try {
        sampleClient[i] = new MqttClient(broker, clientId + "" + i, persistence);
        sampleClient[i].connect(connOpts);
    } catch (MqttException ex) {
        ex.printStackTrace();
        return;
    } 
}


I'm Getting Exception Like :

Exception in thread "MQTT Con: Publisher2919" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:714) at org.eclipse.paho.client.mqttv3.internal.CommsSender.start(CommsSender.java:60) at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:654) at java.lang.Thread.run(Thread.java:745)


My system RAM is 8 GB with Corei5 Processor.
I did also try in Windows PC in that same Error but Its Upto 7k Connection
so any OS level Configuration in Ubuntu to make more Connection?




Reply all
Reply to author
Forward
0 new messages