简体   繁体   中英

Spring social super slow, any ideas why?

I'm using Spring social to get informations via Facebook or LinkedIn. It works perfectly and I get what I want but I'm having a problem : it's super slow.

For instance, accessing my connections full profiles with linkedin takes me about one second per contact. The same can be said with facebook.

So, do you know if this slowness is normal with Spring social, or if there is a way to fasten this all ?

I'll admit that I've not done a lot of thorough performance testing with Spring Social's API bindings (there's so much to cover...it'd be quite an undertaking to cover it all). But, I just now did some very basic speed tests against FriendOperations.getFriendProfiles(), requesting my list of Facebook friends (160 friends). I found the following:

  • On average, the request was taking 2.6 seconds to complete. I did have one attempt that took over 7 seconds, but I threw it out as a network hiccup...all of the other were around 2.6 seconds.
  • For those same requests, the average time for Spring Social to make the network call via RestTemplate to fetch the data was around 2.4 seconds.
  • That leaves approximately 0.2 seconds (on average) that Spring Social spends deserializing the data it receives.

So yes, 2.6 seconds is less than ideal, but 2.4 seconds of that is spent in network calls, outside of Spring Social's control. I even took Spring out of the equation and ran the same query through the curl command line tool and found that the call was taking (on average) 3.0 seconds. (This doesn't mean that Spring is faster than curl...just that my unscientific sample was a bit more lucky and probably too small to say anything definitive.)

And, as one more data point, I performed the same query through Facebook's Graph API Explorer and it came back (on average) in about 2.7 seconds.

Every network's different, so your mileage may vary.

In short, Spring Social may have room for improvement when it comes to performance, but in the case of fetching the full profile for a user's friends, it's going to be slow just because fetching that much data across the network is slow.

Finally, although I didn't perform tests against Spring Social LinkedIn, I imagine that it would perform about the same, given that you'd be asking for about the same amount of data across the wire.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM