Data taking over 90 seconds to return a value

11 views
Skip to first unread message

Will Clark

unread,
Nov 23, 2009, 6:46:16 PM11/23/09
to google-analytics-api - GA Data Export API
I have a Rails site that pull some google analytics code, and it's
taking over 90 seconds to process. The rest of the site is responding
at normal response times. When I check my logs this is verified:

Completed in 93163ms (View: 6, DB: 1)

Now it's not throwing an error and will return the results I request,
so I presume I haven't hit my quota or anything like that. I'm using
the garb gem to access the data and it's been working quite well the
past two or three months.

Any advice on where to get started?

Nick

unread,
Nov 24, 2009, 2:53:48 PM11/24/09
to google-analytics-api - GA Data Export API
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
Reply all
Reply to author
Forward
0 new messages