Open boynet opened 8 years ago
p.s pretty sure you need to put some warning on the examples withexec('date +%s%N')
it has bad performance.
at least for me in ubuntu 16 this code is taking 1.5158290863037 sec to complete
for($x=0;$x<1000;$x++) {
exec('date +%s%N');
}
Well UDP vs TPC is a very good topic.
UDP is really fast but you have not guarantee about your point, because the protocol have not this kind of check if you are sending CPU point you can not be sure that all your point will be in influxdb. TPC has this check but it's slow.
I have two different strategy. 1) Are you using a agent on your server to collect local data like telegraf? In this case you can send udp data to the agent because between your local network the probability to lose package is low and you will send bulk of point via TPC with the collector, in this way your application will be fast.
2) You are not using an agent. In this case depends, if you can not accept to miss points use TCP.
In this article I spoke about another library but there is a bench UDP vs TPC http://gianarb.it/blog/InfluxDB-and-PHP
@gianarb How to send data to a locally started Telegraf agent?
Hello @akalongman , telegraf has an input plugin called http_listener
https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener_v2
This plugin exposes a compatible API layer with InfluxDB. You can change the client URL to hit the one exposed by the telegraf plugin and everything should just work as before but passing via Telegraf!
@gianarb thank you. Is it possible to use UDP? I do not want to add network overheads on my application
Hello
Yes! Same concept but with a different telegraf input plugin
https://github.com/influxdata/telegraf/blob/master/plugins/inputs/socket_listener/README.md
Il Gio 9 Gen 2020, 10:57 Avtandil Kikabidze notifications@github.com ha scritto:
@gianarb https://github.com/gianarb thank you. Is it possible to use UDP? I do not want to add network overheads on my application
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/influxdata/influxdb-php/issues/47?email_source=notifications&email_token=AAMOAO44JPR3BNENHCDYVK3Q43YG7A5CNFSM4CFR4632YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIPWJ3Y#issuecomment-572482799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOAO6647ZQKWJIZDAFHRLQ43YG7ANCNFSM4CFR463Q .
is there any preferred way? thanks