Skip to content

[HttpClient] Improve memory consumption #60241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Apr 18, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? no
Deprecations? no
Issues Partially #60037
License MIT

On the CLI, even if the profiler is not enabled by default, the underlying infrastructure is still in place.
In this PR, I'm targeting TraceableHttpClient, which collects requests and responses for nothing.
To fix this, I'm adding an "enabled" flag on TraceableHttpClient, so that we can enable the tracing only when the profiler is enabled.

In addition, I'm augmenting option extra.trace_content so that when disabled, we don't collect request's bodies, which can be huge when uploading.

And last but not least, I'm fixing the implementation of curl's debug info collection, which currently relies on allocating new strings all the time instead of reusing the already created zval when debug info didn't change.

@94noni
Copy link
Contributor

94noni commented Apr 18, 2025

hello @nicolas-grekas 👋🏻
does this PR can be linked to #60037 in some way ?
as well, can it be replicated to other symfony part as per #60037 (comment) ?

@nicolas-grekas
Copy link
Member Author

It's related yes: the same approach could be taken for all traceable decorators. Help wanted for the others /cc @lyrixx et al.

@nicolas-grekas nicolas-grekas force-pushed the hc-trace branch 2 times, most recently from 08fe94b to d2bcf96 Compare April 18, 2025 15:18
@nicolas-grekas nicolas-grekas force-pushed the hc-trace branch 2 times, most recently from 6a518ff to b102057 Compare April 18, 2025 16:35
) {
$this->tracedRequests = new \ArrayObject();
}

public function enabled(?bool $enabled = null): bool
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the class is final already)

@nicolas-grekas nicolas-grekas merged commit 29da4f5 into symfony:7.3 Apr 22, 2025
5 of 11 checks passed
@nicolas-grekas nicolas-grekas deleted the hc-trace branch May 19, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants