Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpClient] makeHttpClient::create() return anAmpHttpClient whenamphp/http-client is found but curl is not or too old#35924

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromnicolas-grekas:hc-amp-default
Mar 16, 2020

Conversation

nicolas-grekas
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

Follows#35115

Let's useamphp/http-client by default, aftercurl and beforefopen().

tristanbes and mfdj reacted with thumbs up emoji
stof
stof previously requested changesMar 2, 2020
@nicolas-grekasnicolas-grekas changed the title[HttpClient] makeHttpClient::create() return anAmpHttpClient whenamphp/http-client is found but curl is not[HttpClient] makeHttpClient::create() return anAmpHttpClient whenamphp/http-client is found but curl is not or too oldMar 2, 2020
@tristanbes
Copy link
Contributor

Aweomse, since majority of PaaS outhere have a bad habit of using a really outdated curl version. 🎉

OskarStark reacted with thumbs up emoji

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMar 3, 2020
edited
Loading

@kelunik the test suite of the Messenger component is failing when usingAmpHttpClient, with:

Idle timeout reached for "http://0.0.0.0:9494/messages".

The reproducer is:

docker pull feathj/fake-sqsdocker run -d -p 9494:9494 --name sqs feathj/fake-sqsexport MESSENGER_SQS_DSN=sqs://localhost:9494/messages?sslmode=disable./phpunit src/Symfony/Component/Messenger/ -v --filter Sqs

At first, I thought the reason was the0.0.0.0 in the URL, but actually when I force127.0.0.1 instead, the timeout persists.

The test passes when using the curl or the native client.

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMar 3, 2020
edited
Loading

The test passes when I use anUnlimitedConnectionPool instead ofConnectionLimitingPool.

@trowski
Copy link
Contributor

@nicolas-grekas Do you still have your benchmarking script handy? I was wondering how the Amp client compares to curl, particularly for a single request and many requests to the same host, both HTTP/1.1 and HTTP/2.

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMar 3, 2020
edited
Loading

Sure, here it is.
On h2, AMP is comparable to Curl.
On h1.1, AMP looks slower, dunno why.

<?phprequire__DIR__.'/vendor/autoload.php';$client =newSymfony\Component\HttpClient\AmpHttpClient(['http_version' =>1.1]);for ($i =0;$i <379; ++$i) {$uri ="https://http2.akamai.com/demo/tile-$i.png";$responses[] =$client->request('GET',$uri);}foreach ($client->stream($responses)as$response =>$chunk) {if ($chunk->isLast()) {// a $response completedecho'.';    }else {// a $response's got network activity or timeout    }}echo"\n";

@nicolas-grekasnicolas-grekasforce-pushed thehc-amp-default branch 4 times, most recently from0eb451f to87c5be9CompareMarch 12, 2020 17:22
…en `amphp/http-client` is found but curl is not or too old
@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMar 13, 2020
edited
Loading

Green.

Status: needs review

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@trowski
Copy link
Contributor

@nicolas-grekas Thanks for the script again. I see the same results: About the same for HTTP/2, slower for HTTP/1.x. Will have to investigate what's slowing down HTTP/1.x.

I was fishing for a reason to have Amp's client be the default client, but I don't really have a compelling reason for that other than installation consistency and portability. 😝

Is there a way to suggest using Amp if the client falls back to usingNativeHttpClient?

@nicolas-grekasnicolas-grekas deleted the hc-amp-default branchMarch 16, 2020 20:11
@nicolas-grekas
Copy link
MemberAuthor

Is there a way to suggest using Amp if the client falls back to using NativeHttpClient?

We already have an@trigger_error() inHttpClient::create() when curl is missing. Please submit a PR to add a similar one whenNativeHttpClient is used now :)

trowski and kelunik reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@kelunikkelunikkelunik left review comments

@fabpotfabpotfabpot approved these changes

@OskarStarkOskarStarkOskarStark approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

8 participants
@nicolas-grekas@tristanbes@trowski@fabpot@stof@OskarStark@kelunik@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp