How can I improve performance?

Oct 23, 2013 at 2:16 PM
I am working on a project which gets the most favorited statuses of a user. I have to get all tweets first and then order them because of this count limit of one api call (200). I am using SinceId and MaxId properties to get all the data.

But whole operation seems to take a lot of time which is bad for a web application since I am making a lot of api calls for some users.

Is there any method I can follow to increase performance? I thought of using multiple asynchronous api calls but since I am using SinceId and MaxId, I couldn't figure out how to implement this.

Thanks for any response.
Coordinator
Oct 23, 2013 at 7:00 PM
Here are a few ideas:
  1. Bump up your count to max so that it brings in as many tweets as possible in one query. This will reduce the number of queries.
  2. Since you're working with Favorites - there's a query for that: https://linqtotwitter.codeplex.com/wikipage?title=Getting%20a%20List%20of%20Favorites&referringTitle=Querying%20Favorites. Just in case you were using something else, this might be more efficient.
  3. You're paging with SinceID/MaxID, which means you're doing that part properly. Just keep track of the SinceID so that future queries don't duplicate requests.
  4. Make sure you've set UseCompression to true to reduce payload size, which makes queries more efficient.
There might be other optimizations, based on the design of your application, but these are general things that are very likely to help.

@JoeMayo
Oct 24, 2013 at 8:18 AM
Thanks for the answer Joe.

I was already implementing first 3 steps in my application. I added the UseCompression too and it got a little faster but the search process is still slow enough to make a user say "Why is it so damn slow?" :)

I think you are working on asynchronous calls right now. I wonder if I can use this feature to improve performance in the future.

Also any other ways to improve performance are welcome.

Thanks in advance.
Coordinator
Oct 24, 2013 at 5:43 PM
I'm making pretty good progress on the new async code. It's checked in if you want to try it out, but I wouldn't rely on it yet because it's guaranteed to change.

From a performance perspective, async can make your app more scalable because your code isn't blocking on multiple threads. However, the UX doesn't really change because of natural latency in network communication when making queries across the Internet.

Another thought is that if the queries aren't dependent on user input, you might be able to start pre-caching as soon as they log on.

@JoeMayo