GoogleAdsService를 사용하여 스트리밍 보고
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Google Ads API 항목 및 보고 데이터를 가져오려면 다음 방법 중 하나를 사용하세요.
두 방법의 대략적인 차이점은 다음과 같습니다.
SearchStream
및 Search
비교
Search
는 전체 보고서를 다운로드하기 위해 페이지로 나눈 요청을 여러 개 보낼 수 있지만 SearchStream
는 단일 요청을 보내고 보고서 크기와 관계없이 Google Ads API와의 지속적인 연결을 시작합니다.
SearchStream
의 경우 데이터 패킷이 즉시 다운로드되기 시작하며 전체 결과가 데이터 버퍼에 캐시됩니다. 전체 스트림이 완료될 때까지 기다리지 않고도 코드가 버퍼링된 데이터를 읽기 시작할 수 있습니다.
앱에 따라 Search
응답의 각 개별 페이지를 요청하는 데 필요한 왕복 네트워크 시간을 없애면 SearchStream
는 특히 더 큰 보고서의 경우 페이징보다 성능을 향상시킬 수 있습니다.
예
이 예에서는 100,000
행으로 구성된 보고서를 살펴봅니다. 다음 표에서는 두 방법 간의 회계 차이점을 보여줍니다.
|
SearchStream |
검색 |
페이지 크기 |
해당 없음 |
페이지당 10,000개 행 |
API 요청 수 |
요청 1개 |
요청 10개 |
API 응답 수 |
1개의 연속 스트림 |
10개의 응답 |
대부분의 사용 사례에서는 다음과 같은 이유로 Search
보다 SearchStream
를 사용하는 것이 좋습니다.
단일 페이지 보고서 (10,000행 미만): 두 방법 간에 실적 차이가 크지 않습니다.
여러 페이지 보고서의 경우 일반적으로 여러 왕복이 방지되고 디스크 캐시에서 읽거나 쓰는 것이 덜 중요하므로 SearchStream
이 더 빠릅니다.
비율 제한
두 방법의 일일 한도는 개발자 토큰의 표준 한도와 액세스 수준을 따릅니다. 결과가 페이지로 나뉘거나 스트리밍되는지와 관계없이 단일 쿼리 또는 보고서는 하나의 작업으로 계산됩니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-27(UTC)
[null,null,["최종 업데이트: 2025-08-27(UTC)"],[[["\u003cp\u003eThe Google Ads API offers two primary methods for retrieving data: \u003ccode\u003eSearchStream\u003c/code\u003e and \u003ccode\u003eSearch\u003c/code\u003e, both suitable for production environments and fetching objects and reports.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSearchStream\u003c/code\u003e delivers results as a continuous stream, ideal for large reports, while \u003ccode\u003eSearch\u003c/code\u003e provides paginated responses.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSearchStream\u003c/code\u003e often offers performance advantages by reducing network round trips, especially for reports exceeding 10,000 rows.\u003c/p\u003e\n"],["\u003cp\u003eBoth methods are subject to the same daily limits and access levels, with a single query or report counting as one operation regardless of the method.\u003c/p\u003e\n"],["\u003cp\u003eGoogle recommends using \u003ccode\u003eSearchStream\u003c/code\u003e for most use cases due to its performance benefits for larger reports.\u003c/p\u003e\n"]]],[],null,["# Report streaming using GoogleAdsService\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nTo retrieve Google Ads API entities and reporting data, use one of these methods:\n\n- [`GoogleAdsService.SearchStream`](/google-ads/api/reference/rpc/v21/GoogleAdsService/SearchStream)\n- [`GoogleAdsService.Search`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Search)\n\nHere are the high-level distinctions for the two methods:\n\n| | GoogleAdsService.SearchStream | GoogleAdsService.Search |\n| Suitable for production code | **Yes** | **Yes** |\n| Service | [`GoogleAdsService`](/google-ads/api/reference/rpc/v21/GoogleAdsService) | [`GoogleAdsService`](/google-ads/api/reference/rpc/v21/GoogleAdsService) |\n| Scenario | Fetching objects and reports | Fetching objects and reports |\n| Response | **Stream** of [`GoogleAdsRow`](/google-ads/api/reference/rpc/v21/GoogleAdsRow) objects | Pages of [`GoogleAdsRow`](/google-ads/api/reference/rpc/v21/GoogleAdsRow) objects |\n| Response's fields | Only those specified in the query | Only those specified in the query |\n| Daily limits | Daily limits based on [access levels](/google-ads/api/docs/access-levels) | Daily limits based on [access levels](/google-ads/api/docs/access-levels) |\n|------------------------------|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|\n\n`SearchStream` versus `Search`\n------------------------------\n\nWhile [`Search`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Search) can send multiple\npaginated requests to download the entire report, [`SearchStream`](/google-ads/api/reference/rpc/v21/GoogleAdsService/SearchStream) sends a single request and\ninitiates a persistent connection with the Google Ads API regardless of report size.\n\nFor `SearchStream`, data packets start to download immediately with the entire\nresult cached in a data buffer. Your code can start reading the buffered data\nwithout having to wait for the entire stream to finish.\n\nBy eliminating the round-trip network time required to request each individual\npage of a `Search` response, depending on your app, `SearchStream` can offer\nimproved performance over paging, especially for bigger reports.\n\n### Example\n\nThis example looks at a report that consists of `100,000` rows. The following\ntable breaks down the accounting differences between the two methods.\n\n| | SearchStream | Search |\n| Page size | Not Applicable | 10,000 rows per page |\n| Number of API requests | 1 request | 10 requests |\n| Number of API responses | 1 continuous stream | 10 responses |\n|-------------------------|---------------------|----------------------|\n\n### Performance factors\n\nFor most use cases, we recommend `SearchStream` over `Search` for the following\nreasons:\n\n- For single page reports (under 10,000 rows): No significant performance\n differences between the two methods.\n\n- For multiple page reports: `SearchStream` is typically faster since multiple\n round trips are avoided, and reading or writing from disk cache is less of a\n factor.\n\n### Rate limits\n\nDaily limits for both methods adhere to the standard limits and [access\nlevels](/google-ads/api/docs/access-levels) of your developer token. A single query or report\nis counted as one operation regardless of the result being paged or streamed."]]