Custom App takes almost 2 minutes to start on bootup of conduit.

Home Forums Conduit: AEP Model Custom App takes almost 2 minutes to start on bootup of conduit.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #19028
    Ajay K
    Participant

    The custom app we have built is a simple nodejs based application and is scheduled to start just after mosquitto service and before the lorawan service. It listens for uplink packets as node-red takes way too long to come up on a conduit bootup and lot of uplink packets are lost in this process. The custom app uses the mqtt node module to subscribe to uplink packets and winston node module for logging purposes. So I am assuming there is no overhead for the customapp to take 2 minutes to start.

    I have modified the custom app start priority after a conduit reboot such that it starts before the lorawan-service is up and running, so that the custom app can receive all packets that are received by the lorawan server service and not lose packets.

    However inspite of the boot logs indicating that the custom app was started nearly 25-30 seconds before the lorawan-server was started, the custom app actually isn’t up and running 2 minutes from when the app-manager started the custom app. In this process I end up losing packet with sequence 0 when just one node is connected, and this could only get worse if there are more nodes attached.

    So my question is why would it take 2 minutes for the custom-app to begin running and secondly when i stop and start the custom-app via the Admin UI/Apps section it starts in sub-seconds, so the application itself is not slow to start up. However I do use the /sbin/angel to launch my custom app or is encapsulated in it, does this cause any delays during boot up?

    Thanks,
    Ajay

    #19051
    Jeff Hatch
    Keymaster

    Ajay,

    Is the lorawan server you are referring to the lora server that comes with the Conduit? If so, that application is a compiled C/C++ application. The Node environment requires interpretation of the code and then including every dependency that needs to be read up from the filesystem. The reading of the flash and the fact that a lot of other processing is going on at the same time your app is starting up will max the CPU and cause a lot of stuff to run slowly. These reasons are probably the same reasons that the Node-RED application was slow and not performing.

    Jeff

    #19119
    Ajay K
    Participant

    Thanks Jeff. Although that makes sense, but 2 minutes is quite a lot. Can you point me to any samples of code that can talk to the mqtt using c++. Sorry for the ask, I am just trying not to re-invent the wheel if there is existing code that has already been written, like the lorawan service that comes with the conduit, which handles both uplink and downlink of packets?

    Thanks,
    Ajay.

    #19137
    Ajay K
    Participant

    Any pointers?

    #19138
    Jason Reiss
    Keymaster
    #19141
    Bryan Tran
    Moderator

    I wrote this mqtt client echoing program in C++ and Python year ago. Hope this sample will save you sometimes.

    https://github.com/trong63/mqtt_sample

    #19142
    Ajay K
    Participant

    Thanks Jason, I will review the link you sent. Just curious does python based custom applications have the same amount of latency in terms of startup as the nodejs applications?

    Also what is the best way to build c++ applications for the conduit, I mean in terms of compiling etc and also if I want do socket programming what is the best way to do that using the c++? I am new to the whole linux os and since the nodejs had built in objects, the turn around to write a custom application was fast enough, but not sure how I would achieve that with c++ applications?

    Thanks,
    Ajay

    #19144
    Jeff Hatch
    Keymaster

    Ajay,

    Python applications have some latency when they first start (more than C++ but far far less than node), but after that they work pretty well. The python coding I have done with on AEP Conduit, it seems to be a few seconds, or thereabouts, and the app is up and running. With Python there are far fewer interdependencies than in node. The latency also seems a lot more predictable with Python.

    Jeff

    #19213
    Ajay K
    Participant

    Thanks Jason for your timely response. What version of python is supported on the conduit? Also like the nodejs mqtt client support, does python have any support for mqtt without me having to import or install any dependencies on the conduit?

    Thanks,
    Yogesh

    #19221
    Jeff Hatch
    Keymaster

    Python will be at 2.7.3 for the next release of AEP Conduit. You will have to install the mqtt module(s). There is a bitbake recipe for the paho-mqtt python library here:

    https://layers.openembedded.org/layerindex/recipe/33329/

    Jeff

    #19224
    Ajay K
    Participant

    Thanks Jeff for confirming as well. I did find this eclipse’s paho-mqtt library yesterday. But I have no idea as to how to install it in the conduit. Do you have any suggestions as to how best I can install this on the conduit? Unlike node modules, which I could just copy it to the nodes folder under my application this one I am not sure how I could copy this library and install it?

    Thanks,
    Ajay

    #19226
    Peter Ferland
    Blocked

    Using the bitbake recipe you can build an ipk and install using opkg; assuming you have a bitbake mlinux environment available.

    Otherwise, you could follow the build from source instructions: http://www.eclipse.org/paho/clients/python/
    As git is not on the conduit you would have to clone to your desktop and then transfer to the conduit or download the latest copy on github as a tarball/zip ( https://github.com/eclipse/paho.mqtt.python/archive/master.zip ). Then you can cd into the directory and run ‘python setup.py install’

    #19227
    Ajay K
    Participant

    Thanks Peter, I don’t have a linux environment available. However I can try the steps you have mentioned on my windows box and finally run the setup on the paho-mqtt library on the conduit and see if that helps.

    Thanks,
    Ajay

    #19313
    Ajay K
    Participant

    Hi Peter,

    When attempting to install the paho-mqtt library on the conduit, I just run into dependency issues and every time I resolve one, another one props up. Let me know if you have any luck installing this library?

    Thanks,
    Ajay

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.