apm-agent-php icon indicating copy to clipboard operation
apm-agent-php copied to clipboard

Don't send each segment in an isolated request

Open julien-maurel opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. When transactions have a lot of spans, cpu usage (on apm agent) and network connections (on website and on agent) increase enormously due to number of http request

Describe the solution you'd like After checking code of tracer, everything is done to be able to send multiple segments in a single http request, but today each segment is sent on ending Have on option to be able to send data of a transaction in a single request limit consumption of cpu/network

Additional context I tested a quick and dirty solution (add spans/errors on a property of tracer and send content of this property when a transaction is send). It's not a good implementation but like this I can check difference

Data :

  • before 14h00 : no spans
  • between 14h and 14h10 : around 120 spans by request on website, sent to apm in isolated requests
  • after 14h10 : around 120 spans by request on website, sent to apm in grouped requests

CPU usage of apm agent : image I don't have graph about network, but I can see impact on external service calls, there was a lot of timeout / increase latency during test between 14h and 14h10

julien-maurel avatar Jun 09 '23 12:06 julien-maurel

@julien-maurel Thank for opening this issue. Could you please clarify which version of the agent do you use? The reason I am asking is because in 1.8.1 an improvement to communication was implemented (after the improvement agent does not close the connection after each request with data sent to APM Server). In case you use a version before 1.8.1 could you please try the latest version (which is 1.8.4 at the moment)?

SergeyKleyman avatar Jun 13 '23 13:06 SergeyKleyman

@SergeyKleyman i'm using last version (1.8.4)

julien-maurel avatar Jun 13 '23 14:06 julien-maurel