Which faster when wirte some metric message to file or influxDB?

I want to save some metric message with influxDB. So i can display it with grafana. I use ngx.timer.at send metric in kong plugin log phase.

  1. wirite it to influxDB directly.
    2.write it to file with plugin file-log, then Writing points from a file.
    which is less effectly to kong?

as mentioned in the file-log plugin docs, that plugin should not be used in production since it writes to a file, which uses blocking io.

So the solution should be to use a socket connection to write to InfluxDB.

thanks for you reply