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.
Tagged: Conduit Aep, Custom App, Startup delays.
- This topic has 13 replies, 5 voices, and was last updated 7 years, 6 months ago by Ajay K.
-
AuthorPosts
-
May 12, 2017 at 4:44 pm #19028Ajay KParticipant
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,
AjayMay 15, 2017 at 10:36 am #19051Jeff HatchKeymasterAjay,
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
May 16, 2017 at 4:06 pm #19119Ajay KParticipantThanks 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.May 17, 2017 at 11:59 am #19137Ajay KParticipantAny pointers?
May 17, 2017 at 12:07 pm #19138Jason ReissKeymasterhttps://www.google.com/search?q=mqtt+c%2B%2B
We use libmosquittopp
May 17, 2017 at 1:58 pm #19141Bryan TranModeratorI wrote this mqtt client echoing program in C++ and Python year ago. Hope this sample will save you sometimes.
May 17, 2017 at 2:17 pm #19142Ajay KParticipantThanks 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,
AjayMay 17, 2017 at 2:22 pm #19144Jeff HatchKeymasterAjay,
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
May 18, 2017 at 7:05 pm #19213Ajay KParticipantThanks 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,
YogeshMay 19, 2017 at 8:01 am #19221Jeff HatchKeymasterPython 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
May 19, 2017 at 9:44 am #19224Ajay KParticipantThanks 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,
AjayMay 19, 2017 at 11:47 am #19226Peter FerlandBlockedUsing 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’May 19, 2017 at 2:08 pm #19227Ajay KParticipantThanks 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,
AjayMay 25, 2017 at 11:25 am #19313Ajay KParticipantHi 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 -
AuthorPosts
- You must be logged in to reply to this topic.