Q: InfluxDB has Kapacitor as its data processor which is operated through writing tick
scripts comparing it to writing a simple NodeJS application, doing the calculation there and writing the results back to influxdb
. Which is better?
A: Depends.
It all boils down to how complicated the calculation is expected to be, how much data and are you adventurous enough to learn tick
script.
In short, Kapacitor is definitely the way to go as it is designed to handle complicated calculation, with scale. Its downside is that;
tick
script has steep learning curve
- it is still a relatively new technology, if your calculation involves something fancy which Kapacitor don't support then you will have to build your own
UDF
.
- higher chance of hitting unknown bugs
When you use Kapacitor
you are basically making use of its pipeline style framework for data processing. What is this "pipeline" style thingy? I won't go too deeply into it but in short, each node
you define in your tick
script is join-up as a sequential chain of data processing nodes. During execution, data will simultaneously flow through individual station in a non-stopping fashion (for most nodes) to get stuff done.
This framework is also the reason why kapacitor
is so fast.
NodeJS
on the other hand. If you are already familiar with it then basically zero time investment into learning it. Javascript
is pretty easy. Plenty of references unlike Tick
script.
The most disadvantageous about NodeJS
is that Javascript
is Single threaded. That is, at one time only one data point or 1 data bucket can be processed. If your calculation involves some expensive computational procedure then NodeJS
is not recommended.
However, if the calculation is a straight-forward single step kind E.g. if X is True then: write back to influxdb as Y
then you should be fine.
NodeJS or not. I think for a start if your calculation is expected to be simple then a quick and dirty Javascript
should do it. Also save your time from having tick
script headaches. But mind you, if you are intending to do some crazy calculation in the later stage, your NodeJS
application may not scale well. You might end up going back to Kapacitor
.