question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Calls are too slow

See original GitHub issue

Hello, I recently upgraded google-ads-api to version 5.0.3 hoping to overcome all the problems I had with version 4.0.3. The GRPC library used by google-ads-api in version 4.0.3 randomly returned some obscure Stream Removed error, so as soon as I read that the newer version is using a different GRPC library I was keen on upgrading my codebase to the latest version.

Alas, it turned out that this code:

const customer = new Customer(
    clientOptions,
    {
        customer_id: id || process.env.GOOGLE_ADS_CUSTOMER_ID,
        login_customer_id: process.env.GOOGLE_ADS_CUSTOMER_ID,
        refresh_token: process.env.GOOGLE_ADS_REFRESH_TOKEN
    }, 
    {
        onQueryStart({ credentials, query, reportOptions, cancel, editOptions }) {
            console.log("q", query)
        },
        onQueryError({ credentials, query, reportOptions, error }) {
            console.log("err", error);
        }
    }
)

let data = await customer.query('SELECT customer_client.descriptive_name, customer_client.id FROM customer_client')

took about 42 seconds to resolve.

Am I missing something? Why is it so slow?

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
kritzwarecommented, Mar 9, 2021

I’ve taken a further look and there are some issues around the GoogleAdsService being very slow to initialise, as it requires all other protos within it. See my reply here as well.

We’re also going to raise the issue with Google.

4reactions
kritzwarecommented, Mar 9, 2021

Glad to hear you have a temporary solution @flasaracina.

You bring up the interesting point about the REST API being much quicker, and it’s something we’ve thought about before. We’ve been quite pro proto/gRPC as Google recommends it and claim that it’s faster, but this hasn’t been the case always, particularly with the new Gapic auto-generated clients.

It could be interesting to think about using REST behind the scenes instead of gRPC in a future major version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices to avoiding slow API response time
There are a few optimizations that you can do to avoid slow API responses: · Increasing the number of records returned per page...
Read more >
Web API call too slow - Stack Overflow
My client complained that the retrieving of data from the web api is very slow. I wonder what's causing this. Here's a basic...
Read more >
Analyzing the Causes of Slow API Call Performance
For example, is slow Processing Time the primary cause of slow API call performance in general? After all, it was the outlier curl...
Read more >
TechExchange: Strategies for dealing with slow API responses
The time taken by APIs plays a role in the user experience. One of the ways to handle slow API responses is by...
Read more >
8 reasons why your API adoption is so slow - TechBeacon
8 reasons why your API adoption is so slow · 1. Documentation has bad design · 2. API provider didn't consider the developer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found