high latency when execute the search_stream method

76 views
Skip to first unread message

Jing CHEN

unread,
Jul 4, 2022, 10:42:29 AMJul 4
to Google Ads API and AdWords API Forum
Need help! I'm using python multithreading to execute the search_stream method for each of my ids, everything was working fine before, but recently I've been experiencing high latency sometimes, is this because there's something wrong with the way I'm using the api? Maybe I shouldn't use multithreading? Can someone help me check what the problem is? It seems that high latency only happens to me in this forum.
Thanks a lot!

Google Ads API Forum Advisor

unread,
Jul 4, 2022, 11:51:56 AMJul 4
to lakaen...@gmail.com, adwor...@googlegroups.com

Hi Jing,

Thanks for reaching out to the Google Ads API Forum.

Could you elaborate more when you say that you are using python multithreading to execute the search_stream method?

Since you’re experiencing high latency sometimes, could you provide us with the complete request and response logs, with the request-id for the API requests where we can see the high latency, so that our team can investigate further? You can enable logging, which you may do so by navigating to the Client libraries > Your client library (select Python) > Logging documentation, which you can access from this link. Kindly send the requested details via reply privately to author option.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cFyij:ref

Jing CHEN

unread,
Jul 4, 2022, 12:38:43 PMJul 4
to Google Ads API and AdWords API Forum
The core code is as follows.More details such as full request and response logs, and request-id for high latency API requests will be provided to you as soon as possible.
Regards
_______________________________________________________________________
def adwords_data_device_cost_new(site, customer_id, ga_service):
    ...
    query = "..."
    response = ga_service.search_stream(
            customer_id=customer_id, query=query)
    ....
    return data

def thread_func(site, customer_id):
    customer_data = adwords_data_device_cost_new(site,
                                                 customer_id, ga_service)
    customer_data = pd.DataFrame(customer_data)
    return customer_data

L1 = []

with ThreadPoolExecutor(10) as pool:
        for customer_id in campaign_dict.keys():
            all_task.append(pool.submit(thread_func, site=site, customer_id=customer_id))
    for future in as_completed(all_task):
        customer_data = future.result()
        if not customer_data.empty:
            L1.append(customer_data)

Google Ads API Forum Advisor

unread,
Jul 4, 2022, 1:39:29 PMJul 4
to lakaen...@gmail.com, adwor...@googlegroups.com

Hi Jing,

Thank you for getting back to us.

This email from you has been received and acknowledged. Once we receive the full and complete request and response logs, with the request-id for the API requests we will provide specific recommendations on the issue.


Best,

Google Logo
Anthony Cyril
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cFyij:ref
Reply all
Reply to author
Forward
0 new messages