I am trying to use the APM Server Intake API to monitor a high loaded PHP service which runs on many machines
It comes out, that a POST request to APM Server takes from 18ms to 80ms in average, which increases the PHP app response time significantly
Is there any method to send spans data to APM Server via UDP for example?
The last idea I came up with is to make an intermediary service which will listen an UDP port, receive and buffer APM data, and then just proxy it to APM Server via it's standard Intake API
But if there is an opportunity to send APM data via UDP by standard Elastic means it would be great! (maybe use Beats with UDP input like a proxy)
Doing so, all the inter-process communication is handled by the OS and you save all the network cost.
Other than that, you can ensure that the APM Server is not saturated (ie not rejecting requests with a 5XX error code), by sampling requests if you have too many, trying to send more events at once but less frequently, etc.
I hope this can improve latency to an acceptable range for you.
If you try it out, please let us know how it goes!
Actually, I used exactly the same method that you described
But there was a small issue, if APM server queue is saturated, it keeps the connection from agent (PHP) in "connecting" state for 1 second, to allow golang scheduler to do some work (which is too much for us), you can check this PR: https://github.com/elastic/apm-server/pull/156
We had to place NGINX in front of APM server to handle connection timeouts
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.