开发者

Speeding up Facebook Connect

I'm working on enabling facebook connect with my website, and it seems to work pretty good so far. However, loading the facebook api library on every page of my site is bogging it way down. All the other php classes 开发者_运维知识库that I'm using compile in well under 1 second, but I'm seeing serve times ranging from 3 - 20 seconds just to get the facebook api loaded up. Is there anything I can do to speed up facebook connect? Is it just because I'm on a (mt) shared server?


Facebook allows you to cache user data for 24 hours. This can help a lot when you are doing a lot of queries to Facebook for heavier data like friends. This does not help for things like profile pics which are not easy to cache but can save you a lot in some places.

Keep in mind that some of the slow down can be in the cross site javascript which really has nothing to do with your server but can really add up. An application like fiddler will help identifying where the slow down is in these cases.


I'm not sure if I'm just stating the obvious, but do you need to load the API on every page of your site? Is the user interacting with facebook on every page? Is there any way that you could limit the API usage by redirecting to specialized endpoint when you need to communicate with facebook.


@JOEL Save the user data into your database and retrieve it from there when needed. Use Facebook's API only on endpoints where it is needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜