long2506 / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

php-library calls are much slower than direct calls #318

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have seen today that an API call can take longer than (I would have) expected.
I'm using the official php-library.

For example a call $plus->activities->listActivities() takes around 1-1.5 
seconds.
The same call on client-side 
(https://www.googleapis.com/plus/v1/people/GOOGLE-ID/activities/public?key=KEY) 
gives after around 0.1 seconds a result.

I know that the php-call will have to handle a lot more than just the call for 
this url, but maybe there is a way to get the php-library a bit faster.

I've asked at first in the Google+ Developer Community 
(https://plus.google.com/111487545374003509241/posts/FFjUNCT7QRb) and it looks 
like it's not a problem just in our scripts.

Original issue reported on code.google.com by cmacidis on 11 May 2013 at 9:27

GoogleCodeExporter commented 9 years ago
That is very odd. We will investigate.  Can you try a file_get_contents to that 
URL and see what the timing is for that (to rule out server vs client issues in 
this case)?

Original comment by ianbar...@google.com on 12 May 2013 at 12:29

GoogleCodeExporter commented 9 years ago
Thanks for the quick reply Ian!

I had already done the "client-side" request with curl, but now after I made 
some further tests I have to admit, that the first test wasn't correct. I had 
used a bad KEY in the url, so that the response was so fast, because I got a 
400-result. Sorry for that!

Now with the correct url, there is still a difference in the response time. 

curl: 0.5-0.6 seconds per call
file_get_contents: 0.7-0.8 seconds per call
php-library: 1-1.1 seconds per call

I've tested it this on this page: 
http://www.circlecount.com/test.api.call.speed.php
Where each load is doing 10 times the call via curl, file_get_contents and 
php-library. (working right now, but I will probably disable this script to 
avoid "giving out" api calls)

Now I'm not sure if this difference is still worth to get analyzed.
What do you think?

Original comment by cmacidis on 12 May 2013 at 12:05

GoogleCodeExporter commented 9 years ago
This issue tracker is now closing. Development on the Google PHP client library 
moved to GitHub with the release of the 1.0.0-alpha, and now the 1.0 branch has 
reached beta status there will be no further releases of the 0.6 branch of the 
library. 

Please take a look at the latest version on 
https://github.com/google/google-api-php-client

For information on migrating, please take a look at this guide: 
https://developers.google.com/api-client-library/php/guide/migration

For general library support please ask a question on StackOverflow: 
http://stackoverflow.com/questions/tagged/google-api-php-client

If you are looking for support with a specific API, please contact the team 
working with that API via StackOverflow or their preferred support mechanism. 

If your issue still exists with the new version of the library, please raise a 
bug in the GitHub issue tracker with a minimal code sample. 

Thanks!

Original comment by ianbar...@google.com on 22 Jan 2014 at 4:53