Performance issues




I’m using the Ads api to get statistics about campaigns. Sometimes it times only a few seconds to get the response, but other times, it gets more than 6 minutes for the same request! Is there a configuration I should do in my account?


Thanks for the question, @camillagm. Processing times depend on and are affected by many factors. Some of these are related to the request itself, such as the amount of data being requested, and others relate to load. In this case, since you mention that the delay is for the exact request, it’s likely an issue with the latter.


The problem occurs when I run the very same request many times during a amount of time.

For instance:
twurl -X POST -H “/1/stats/jobs/accounts/18ce53upsbd?entity_ids=5m4c4&entity=CAMPAIGN&start_time=2016-08-01T03:00:00Z&end_time=2016-09-01T03:00:00Z&granularity=TOTAL&placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT,BILLING,VIDEO,MEDIA,WEB_CONVERSION,MOBILE_CONVERSION”

Sometimes this job takes less than 1 minute to finish, and other times it takes more than 10 minutes.

So I wonder if it’s because there are some rate limits, although I receive no error of API limits.


The processing queue for async jobs is most likely simply backed up during those time periods, and doesn’t have to do with how you are calling it. However, I would recommend having exponential backoff as a strategy for when you do get errors, and secondly you should be careful to not repeatedly request for the same exact information when it does not return quickly (the jobs are generally processed FIFO so the newly queued jobs will simply take even longer to return as well as sort of wasting processing bandwidth).