Hi,
There are a couple of things to look at. You shouldn't execute API
requests from very tight loops. Also you don't want to send too many
requests from the same IP in parallel to our API. For both of these
there is a fine line of being able to access lots of data quickly and
preventing DOS attacks.
To speed up your query, GA aggregates data on a daily basis. So we
have to go through each row (up to 50k) of data on a daily basis. If
you are looking at data for a quarter (~3 months, 90 days), GA can
easily end up looking through 4.5 million rows of data. So to reduce
latency, a recommendation is to split up your requests into shorter
date ranges.
Good Luck,
-Nick