NJITwaterSMART / SensorFog

Barebones implementation of a distributed sensor network. Scales out to be a grid of sensory clouds
GNU General Public License v3.0
1 stars 0 forks source link

Draft API Gateway Definitions of Azure IoT Hub #2

Open Sun-Wukong opened 7 years ago

Sun-Wukong commented 7 years ago

Hey, to get the Sensor fog talking with the major public cloud of Azure IoT Hub:

Sun-Wukong commented 7 years ago

Relevant Resources


bdavis721 commented 7 years ago

I set up the website using an LAMP server, whats the benefits of using azure?

Sun-Wukong commented 7 years ago

Azure serves as a data hub to stream data to your webserver, without worrying about how to parse the data coming in. Given you're constantly streaming sensor data, it's important to have tools and platforms that can organize data streams from multiple devices. Azure removes that responsibility from a locally rolled web server, while providing enough storage for constantly updating data streams. Your typical LAMP server also doesn't support most of the messaging protocols needed to handle the incoming data.

bdavis721 commented 7 years ago

We aren't constantly streaming the data coming in, it will be at timed intervals and since I set up the site and the database on the lamp server already I don't know if it would be beneficial to change everything over now. Although it may be easier to connect to but idk if it is worth the change, what do you think?

Sun-Wukong commented 7 years ago

I did an interval check. You're doing a 120 millisecond sleep cycle, for an hourly update from an API endpoint( according to the URI endpoint in your code ). Divide and hour's worth of milliseconds into your sleep interval, and that's the worse case scenario for flooding an API. 

Python has a lock on processor resources, so that's the only thing helping you. You can do either a webhook, or a cron job to be more efficient. Either way, I went through your code; and you really don't have to flood in that many requests. If you'd like some input on how to carry that out, ask.

bdavis721 commented 7 years ago

Thats not the complete code, the 2 mins was just to test the code and see if it was working correctly. The final code will check every 30 mins using crontab.