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
Guzzle is super slow comparing to file_get_content #395
Comments
Guzzle isn't slow (I've measured requests with Amazon DynamoDB that take around 4ms to complete), but it's possible that something in your stack is causing it to perform badly.
|
Hi. Thanks for you reply. I am pretty sure guzzle runs slow on my computer. The api website and test website are running on same computer. I tried file_get_content has same speed as browser, and Http_Request2 which replies on curl too doing fast. Only guzzle works bad. |
It sounds like a system tuning issue. Do you have xdebug enabled? Are you using an op code cache? On Aug 6, 2013, at 11:11 PM, scottzhang notifications@github.com wrote:
|
Hi. Here is the test. first is code: try here is the test result for 4 runs #2: #3: #4: The "http://api.weidan.com/categories' is a webpage runs locally does nothing. We just request it and see the response time for benchmark. I don't know what effect "$client->getConfig()->set('curl.options', array(CURLOPT_VERBOSE => true));" brings on. But on our test, nothing happens. Please check. |
That option outputs verbose curl information. Check your apache logs if this is running with mod_php or something. You need to see this information to troubleshoot. Perf tests with Xdebug enabled are worthless. Be sure it's disabled. Also ensure you're using an opcode cache. If the API runs locally, then you might need to disable nagle's algorithm by setting the CURLOPT_TCP_NODELAY option just like how the verbose option was set. What version of Guzzle, PHP, Curl, etc are you using? On Aug 6, 2013, at 11:35 PM, scottzhang notifications@github.com wrote:
|
Hi. We are using Guzzle 3.7, the latest version get by composer. PHP version is 5.4.7. We are using Xampp as develop server. the CURL is integrated with xampp by default, curl version is 7.24.0 . Xampp is 3.1.0 Beta 6. I think from the above tests we can tell, basically the web request time should be nearly same. The problem is guzzle and httprequest add many extra code to wrap the original api. HttpRequest2 runs on curl too. But HttpRequest2's performance is better because it is light weight than Guzzle. Guzzle add many code before really send the request, that's why it runs slower. As all our test runs in same function, they are using same server, curl. I think the version of PHP,curl has no impact for these tests. Regards |
Hi. On Wed, Aug 7, 2013 at 3:46 PM, Ben Davies notifications@github.com wrote:
|
slow guzzle depends, but keep attention to your environment! we had the same issue with a slow guzzle/6.2.1 and the problem was a special curl/7.29 version which caused the super slow performance, update the curl version was the solution |
@nczepa I think I might be having the same problem. To which curl version did you update it to ? Is there a list of specific curl versions that are not recommended to use with specific guzzle versions I can look at somewhere ? |
I get to know guzzle when I integrate an oauthclient which use guzzle by default.
So when I don't use oauthclient, I still keep guzzle for http request from php.
We are using GuzzleClient to request our oauth protected api. Usually when we visit our api url directly from browser, the response/full load time is about 40ms, we measured this by firebug.
But when we get same url from guzzleClient using GET, it always take ~100-120ms. It is really unacceptable. We try to use file_get_content, it needs ~40-50ms.
So we follow the code into GuzzleClient, before jump into its 'group->send' call, I use php microtime() to track, it already consumed ~10-20ms for all these addon wrapper code, and its "$group->send()" take about ~90ms. Still slow.
I know guzzle added many code for some advanced features before a real send but its speed is really slow.
I am trying to test phpcurl or Http_Request2 which only provide a pure send interface to overcome the performance issue.
The text was updated successfully, but these errors were encountered: