-
Notifications
You must be signed in to change notification settings - Fork 161
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
Handle async requests using Guzzle #2460
Conversation
BenchmarksBenchmark execution time: 2024-01-12 09:15:02 Comparing candidate commit b8db1b0 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 40 metrics, 49 unstable metrics. scenario:PDOBench/benchPDOOverheadWithDBM
|
09a9859
to
b8db1b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, hopefully we now cover everything :-)
Description
Fixes #2444
TL;DR: Set the curl information as soon as possible, and don't overwrite it.
Shortened Explanation
The current implementation fundamentally assumes that
curl_multi_info_read
is called aftercurl_multi_exec
's completion, which is not the case in Guzzle, resulting in either:curl_exec
span by dummy information;curl_exec
span.Explanation
The existing implementation fundamentally assumes a specific execution flow, particularly that
curl_multi_info_read
is invoked after the completion ofcurl_multi_exec
. However, in the context of Guzzle Promises and itstick
method (which repeatedly checks only once for completed requests), this assumption is not valid, leading to unintended consequences.The sequence of operations during a typical execution involves the following flow:
curl_multi_info_read
can initiate the following course of action:Completion and
curl_getinfo
curl_multi_exec
occurs inCurlMultiHandler::tick
under theCurlMultiHandler::execute
loop, a final call toCurlMultiHandler::tick
is triggered, as the queue might not be empty (array_shift left to do).curl_multi_exec
call may complete, but Guzzle can retry handles, hence inducing the creation of an additionalcurl_multi_exec
span. This retry scenario is the root cause of the flakiness observed in the added test.To address these issues, the proposed changes in this pull request aim to set the curl information as soon as possible, avoiding overwriting or putting dummy information during the execution flow outlined above, i.e.:
curl_multi_info_read
orcurl_multi_exec
hook, whichever comes first with the curl informationunparsable-host
), which is theoretically always set when setting the curl attributes.Notes:
Reviewer checklist