This project has moved and is read-only. For the latest updates, please go here.

How can I improve performance?

Oct 23, 2013 at 3: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.
Oct 23, 2013 at 8: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: 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.

Oct 24, 2013 at 9: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.
Oct 24, 2013 at 6: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.