I own an experience where we display a specific twitter account’s tweet timeline using the following API: GET statuses/user_timeline | Docs | Twitter Developer Platform

Initially, I was seeing the API latency of around < .5 seconds. However, I’ve seen the latency gradually creep up and is currently at around 2.5 - 3 seconds. I do see a small dip that happened on 8/25 - 8/26 but then it continued to increase again.

Below is a screenshot of the latency graph for the API call to the get user timeline API:

  • Graph starts on 8/11 where latency is around .5 seconds
  • You can see the gradual increase and graph ends at today (9/07)
  • You can see the small dip around the middle of the graph that happened on 8/25 - 8/26

Does this API get throttled for specific project/apps under my developer account after a certain number of tweets are queried? Is there some explanation behind the gradual increase in the API latency that we’re observing?

1 Like

Some questions here:

  • How exactly do you know this is API latency and not a variation of your own connection quality? Do you have a corresponding graph of latency for your connection to say, Google?
  • Is this querying one user or random users? If you’re querying one user and the timeline is growing in size from a small start, it could account for the server taking longer to retrieve the information.

There is no throttling that I know of, outside of the rate limits.

2 Likes

Thanks for the response @antsstyle! To answer your questions:

  • I have several API calls that are being made using the same http client but to different dependencies (twitter, twitch, etc.). When I compare the latency being reported between these: the twitter api is showing the gradual increase in latency whereas the latency metrics being reported from the other dependency APIs are much lower and stable.
  • The querying happens from 1 user. The experience is essentially to expose my twitter account timeline in the website.

Would any of the following impact latency:

  1. The user’s tweet timeline grows so it takes longer to get the timeline tweets. (though the growth in latency doesn’t make sense since it’s not like the timeline is growing that quickly)
  2. Fetching paginated tweets that are further in the past (also not sure how the latency graph would consistently increase).

I suppose it would depend on if the calls you’re making to other sites (twitch etc) are comparable, i.e. if they’re checking the same user with equivalent content levels, etc.

There are still many other possible factors at work here:

  • If you’re fetching small timelines, i.e. less than 100 tweets at a time, an increase in result size (e.g. fetching a timeline that has 10 tweets vs 30 tweets) might be a cause
  • There could simply be increased latency anywhere in the connection between yourself and Twitter. You could try using the tracert command to see if an intermediary server is causing the latency increase, as it might be specific to your connection to Twitter’s servers and not other servers (without being Twitter itself).
1 Like

Thanks! I’ll try to dive into the code a little bit more to see if I can get some more info

1 Like

Slightly embarrassed to report that the latency metric itself that was being reported was invalid. I make several calls to the same API in each request on my website and the latency was being summed in the metrics.

Once I divided the latency metric by the count of calls being made, the latency graph looks very stable since we started recording metrics. I was able to also explain the upward trend in total latency as well so nothing else to investigate here.

Thanks for all the help!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.