I have a device network where each device has different sensors (temperature, humidity, etc..). Each device uploads raw measured weather data every 10 seconds to a apache/php/mysql REST API. There are a few 100 devices sending data and this will become more over time. Currently the data is added to a mysql table without any processing.
The string format of the device message is something like:
&01AA*020122#
Which means that sensor 01
measured AA
and sensor 02
measured 0122
.
I want to put the decimal converted hex values in a table so they can be processed further. What I do now is run a script every minute to see what new strings were added to the database. I will then convert these strings to decimal values and put them in a table.
Performance wise I have the feeling that polling new data every minute is pretty silly.
What would be the best way to do this?
have the rest api split the string and convert the hex values to decimal values and insert this immediately into the database
poll the database for new inserted strings and convert the hex values
use a mysql insert trigger to process the string by the database
any other ideas.