MQTT Single Client vs Multiple Client












0














Right now, we are designing and MQTT based application which deals with iot devices.



We have the main device which connect with all other IOT devices. and any message publishes from the main device will receive by MQTT client app.
We have multiple main devices,



my question is do I need to create multiple MQTT clients each per the main device of a single client for all main devices.



if I go with a single client then if it fails, it will reconnect but facing a loss of data.



suppose if I go with multiple clients, then if it fails it only affect on one main device but I am afraid that multiple client may consume lots of memory. when a number of main devices growing will take a lot of memory. also, need to maintained (prevent) client from being garbage collected.



any recommendations and any advice on this.










share|improve this question






















  • Where does the MQTT server reside?
    – uhs
    Nov 23 at 8:46










  • Can you explain in more detail where these clients will be running. It sounds like you are planning on running a client for each device on the backend?
    – hardillb
    Nov 23 at 9:17










  • @Uhs MQTT Broker will be a separate server which takes and give a message to other clients, java MQTT client will connect with microservice and put data in to database
    – Himesh goswami
    Nov 23 at 9:42










  • @hardillb basically it will be one microservice which create java mqtt client per user.
    – Himesh goswami
    Nov 23 at 9:44
















0














Right now, we are designing and MQTT based application which deals with iot devices.



We have the main device which connect with all other IOT devices. and any message publishes from the main device will receive by MQTT client app.
We have multiple main devices,



my question is do I need to create multiple MQTT clients each per the main device of a single client for all main devices.



if I go with a single client then if it fails, it will reconnect but facing a loss of data.



suppose if I go with multiple clients, then if it fails it only affect on one main device but I am afraid that multiple client may consume lots of memory. when a number of main devices growing will take a lot of memory. also, need to maintained (prevent) client from being garbage collected.



any recommendations and any advice on this.










share|improve this question






















  • Where does the MQTT server reside?
    – uhs
    Nov 23 at 8:46










  • Can you explain in more detail where these clients will be running. It sounds like you are planning on running a client for each device on the backend?
    – hardillb
    Nov 23 at 9:17










  • @Uhs MQTT Broker will be a separate server which takes and give a message to other clients, java MQTT client will connect with microservice and put data in to database
    – Himesh goswami
    Nov 23 at 9:42










  • @hardillb basically it will be one microservice which create java mqtt client per user.
    – Himesh goswami
    Nov 23 at 9:44














0












0








0







Right now, we are designing and MQTT based application which deals with iot devices.



We have the main device which connect with all other IOT devices. and any message publishes from the main device will receive by MQTT client app.
We have multiple main devices,



my question is do I need to create multiple MQTT clients each per the main device of a single client for all main devices.



if I go with a single client then if it fails, it will reconnect but facing a loss of data.



suppose if I go with multiple clients, then if it fails it only affect on one main device but I am afraid that multiple client may consume lots of memory. when a number of main devices growing will take a lot of memory. also, need to maintained (prevent) client from being garbage collected.



any recommendations and any advice on this.










share|improve this question













Right now, we are designing and MQTT based application which deals with iot devices.



We have the main device which connect with all other IOT devices. and any message publishes from the main device will receive by MQTT client app.
We have multiple main devices,



my question is do I need to create multiple MQTT clients each per the main device of a single client for all main devices.



if I go with a single client then if it fails, it will reconnect but facing a loss of data.



suppose if I go with multiple clients, then if it fails it only affect on one main device but I am afraid that multiple client may consume lots of memory. when a number of main devices growing will take a lot of memory. also, need to maintained (prevent) client from being garbage collected.



any recommendations and any advice on this.







java mqtt iot mosquitto paho






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 at 8:41









Himesh goswami

638315




638315












  • Where does the MQTT server reside?
    – uhs
    Nov 23 at 8:46










  • Can you explain in more detail where these clients will be running. It sounds like you are planning on running a client for each device on the backend?
    – hardillb
    Nov 23 at 9:17










  • @Uhs MQTT Broker will be a separate server which takes and give a message to other clients, java MQTT client will connect with microservice and put data in to database
    – Himesh goswami
    Nov 23 at 9:42










  • @hardillb basically it will be one microservice which create java mqtt client per user.
    – Himesh goswami
    Nov 23 at 9:44


















  • Where does the MQTT server reside?
    – uhs
    Nov 23 at 8:46










  • Can you explain in more detail where these clients will be running. It sounds like you are planning on running a client for each device on the backend?
    – hardillb
    Nov 23 at 9:17










  • @Uhs MQTT Broker will be a separate server which takes and give a message to other clients, java MQTT client will connect with microservice and put data in to database
    – Himesh goswami
    Nov 23 at 9:42










  • @hardillb basically it will be one microservice which create java mqtt client per user.
    – Himesh goswami
    Nov 23 at 9:44
















Where does the MQTT server reside?
– uhs
Nov 23 at 8:46




Where does the MQTT server reside?
– uhs
Nov 23 at 8:46












Can you explain in more detail where these clients will be running. It sounds like you are planning on running a client for each device on the backend?
– hardillb
Nov 23 at 9:17




Can you explain in more detail where these clients will be running. It sounds like you are planning on running a client for each device on the backend?
– hardillb
Nov 23 at 9:17












@Uhs MQTT Broker will be a separate server which takes and give a message to other clients, java MQTT client will connect with microservice and put data in to database
– Himesh goswami
Nov 23 at 9:42




@Uhs MQTT Broker will be a separate server which takes and give a message to other clients, java MQTT client will connect with microservice and put data in to database
– Himesh goswami
Nov 23 at 9:42












@hardillb basically it will be one microservice which create java mqtt client per user.
– Himesh goswami
Nov 23 at 9:44




@hardillb basically it will be one microservice which create java mqtt client per user.
– Himesh goswami
Nov 23 at 9:44

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443192%2fmqtt-single-client-vs-multiple-client%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443192%2fmqtt-single-client-vs-multiple-client%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks