I am logging cell voltages of battery modules. Each module consists of lets say 10 cells. Every module sends its data every 500ms. I store the 10 voltages as fields and the module id as a tag.
So far so good Now one interesting value to observe is the cell spread per module, meaning the difference between the highest and the lowest cell voltage in a battery module. This difference may be normally low and can get high for short periods of time in between. So best would be to calculate the spread for every point in time and to observe the maximum of these spread values in aggregate windows to be able to analyze development over longer periods of time (months and years perhaps).
But - how do I do that as performant as possible?
Option 1: By calculating the spread for every point in time via flux and aggregating the results as desired. Technically works but crashes my server quite quickly Very inefficient for longer periods of observation and a database filling up with loads of modules.
Option 2: By pre-calculating the spread and storing it redundantly. Working on that with aggregateWindow and “max()” should be ok.
How to calculate and store the redundant information?
Option 2a: The clients can already do that and add it to the data that is uploaded to influx. I do not like that approach too much as it adds redundant data to the communication between clients and the server.
Option 2b: Influx could do the calculation on receiving the data (similar to triggers in SQL databases). Is that possible?
Option 2c: Influx could do the calculation periodically asynchronously (e.g. every hour for the past hour) and add the redundant information to the raw data (or already pre-aggregated into a dedicated “statistics” measurement). Can that be configured in influx?
I hope my problem is understandable…
What do you think would be a good approach? Are you aware of any alternative option? Perhaps even one that solves this problem without the need of storing redundant information?
Thanks in advance, any comment is appreciated!