views:

78

answers:

2

So, I am running a facebook application and I have to call FQL quite frequently. e.g. calling

$fbObj->api_client->users_getStandardInfo() with the old facebookapi_php5_restlib

However, I found it VERY VERY VERY SLOW to get the response back. I know that call actually use CURL connect to Facebook.

So, is the CURL call slow in response? or FQL? of course, how to improve it?

In addition, any one how good the new facebook api is? i heard it is even worse in terms of performance...

A: 

In my experience, the Facebook Platform overall is just slow. Can't really blame them though. Scaling an API to service a user base of 500+ million cannot be a simple undertaking :)

Something I did notice though, with the new api-read.facebook.com domain, the DNS for that domain has been kinda messed up for a couple of months now. Changing from api-read.facebook.com to api.facebook.com seems to speed requests up alot. Also, in some regions, calls to api-read.facebook.com literally take 15+ seconds, due again to the bizarre DNS setup going on.

Also, if you're using SSL, try switching it off. Not all API calls require SSL connections, and standard HTTP requests to Facebook are alot faster.

Hope this helps :)

Sam Day
A: 

You need to either decrease number of queries, or use caching.

If you need to get info for 100 users, running 100 queries would take probably several minutes. But if you combine them into one query:

select name from user where uid in (1,2,3,4,...100)

it would take just a couple of seconds.

If you want to go in caching direction, then you can subscribe to facebook realtime updates to be notified when a user changes their data.

serg