elastic / elastic/apm-agent-php

Don't send each segment in an isolated request

Open
#991 2 comments 0 reactions 0 assignees View on GitHub
agent-php enhancement priority: low triage: pass 1
Dominant language
PHP
Stars
268
Forks
86
PR merge metrics
No merged PRs in 30d

Description

**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](https://github.com/elastic/apm-agent-php/assets/2444807/ca265c75-0bc5-4613-a72a-83982d83b9a4)
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.