Google Merchant API Concurrent Requests & gRPC Channel Pool Guide: Replacing custombatch, Configuring gRPC Channel Pools & Dynamic Quota Governance
Google Merchant API Concurrent Requests & gRPC Channel Pool Guide: Replacing custombatch, Configuring gRPC Channel Pools & Dynamic Quota Governance
Migration Focus: Refactoring for gRPC Concurrency After
custombatchRetirementWhen migrating from Content API for Shopping to Merchant API,
products.custombatch,productstatuses.custombatch, andinventory.custombatchhave all been removed.You do not need to fall back to sequential single-item calls. Built on HTTP/2 multiplexing and binary Protobuf serialization, Merchant API natively supports asynchronous gRPC concurrency with higher throughput and tighter tail latency than legacy JSON
custombatch. However, there is one hard transport ceiling: each single gRPC connection allows at most100concurrent streams by default. Without configuring a client-side Channel Pool, excess async coroutines queue locally and stall.
Google Merchant API Migration Series Navigation
- Part 1 (Architecture & Sunset Timeline): Google Merchant API Architecture Guide: Replacing Content API for Shopping, 2026 Sunset Timeline & Modular Upgrade Plan
- Part 2 (Migration Order & Read/Write Split): Google Merchant API Start Your Migration SOP: Sub-API Priority Order, ProductInput Write/Read Split & Preventing "Offer Stealing"
- Part 3 (Authentication & GCP Architecture): Google Merchant API Authentication & GCP Project Guide: IAM Key Setup, registerGcp Registration & Zero-Downtime Cutover
- Part 4 (Current — High Concurrency & Quota Governance): Google Merchant API Concurrent Requests & gRPC Channel Pool Guide: Replacing custombatch, Configuring gRPC Channel Pools & Dynamic Quota Governance
Chapter 1: Why custombatch Was Retired & the 100-Stream-per-Channel Limit
1.1 Three Engineering Flaws of Legacy custombatch
Under HTTP/1.1, Content API introduced the application-level custombatch endpoint to amortize per-request TCP and TLS handshakes by packing up to 500 JSON product operations into a single multi-megabyte request body. In high-volume production systems, that model created three chronic bottlenecks:
- Head-of-Line Blocking: If SKU #499 in a batch triggers slower backend validation, the 498 SKUs that already finished processing must wait for the entire HTTP response to complete.
- Complex Partial-Failure Retries: When 480 items succeed, 15 hit
429rate limits, and 5 fail schema validation, client code must parse nestedbatchIdarrays, isolate only the 15 throttled entries, re-assemble a new batch payload, and schedule backoff. - Heavy JSON Serialization Overhead: Parsing multi-megabyte JSON request and response envelopes consumes excessive client heap memory and gateway CPU.
1.2 gRPC Multiplexing & the 100 Concurrent Streams Ceiling
Merchant API natively supports gRPC running over HTTP/2. Over HTTP/2, many asynchronous requests (Streams) share one persistent connection bidirectionally in parallel: each successful call resolves immediately, and each failed call runs independent exponential backoff.
When designing high-throughput clients, keep Google Front End's (GFE) connection limit in mind:
Connection Ceiling: A single underlying HTTP/2 (gRPC Channel) connection carries at most
100in-flight concurrent streams at the same time (Max 100 Concurrent Streams per Connection).
If a flash-sale repricing job needs 1,500 concurrent in-flight requests, but your service initializes a default singleton client (backed by just 1 gRPC Channel), requests #101 through #1,500 queue in client memory and throughput collapses.
Chapter 2: Channel Pool Capacity Sizing & the poolSize = 30 Derivation
To saturate available concurrency while preserving headroom for network jitter, Google's Refactor code for concurrent requests specification defines a sizing formula targeting 50% channel pool utilization:
- Compute target requests per second (RPS):
RPS = target updates per minute / 60 - Apply Little's Law to estimate peak concurrent in-flight streams:
in-flight streams = RPS * average round-trip latency (seconds) - Compute the minimum channels required at 100% capacity:
min channels = in-flight streams / 100 - Scale to 50% target utilization for the recommended
poolSize:recommended poolSize = ceil(min channels / 0.50)
Walking through the official benchmark example:
- Target throughput is
60,000SKU updates per minute, which equals1,000 RPS. - Measured average end-to-end latency for
productInputs:insertis1.5 seconds. - Concurrent in-flight streams equal
1,000 * 1.5 = 1,500 streams. - At 100 streams per channel, full saturation requires
1,500 / 100 = 15 channels. - Applying the recommended
50%utilization headroom:15 / 0.50 = 30, yieldingpoolSize = 30.
Use the gRPC Channel Pool & 2x Dynamic Quota Calculator below to input your catalog size, peak updates per minute, and measured latency, calculate your exact poolSize, and copy production-ready Node.js, Python, Java, or HTTP Multipart code:
Chapter 3: Async Concurrency Code Patterns Across Backend Languages
Whether your commerce backend runs on Java, Node.js, Python, or PHP, Google recommends using the official Google Cloud Merchant API client libraries (which default to gRPC), explicitly configuring a channel pool, and bounding in-flight concurrency with semaphores or async queues.
3.1 Java: Configuring setPoolSize(30) with InstantiatingGrpcChannelProvider
The official Java client library supports multi-channel pooling natively. By configuring poolSize on InstantiatingGrpcChannelProvider, you can fan out thousands of non-blocking ApiFuture calls in parallel:
| 1 | import com.google.api.core.ApiFuture; |
| 2 | import com.google.api.core.ApiFutures; |
| 3 | import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
| 4 | import com.google.shopping.merchant.products.v1.InsertProductInputRequest; |
| 5 | import com.google.shopping.merchant.products.v1.ProductInput; |
| 6 | import com.google.shopping.merchant.products.v1.ProductInputsServiceClient; |
| 7 | import com.google.shopping.merchant.products.v1.ProductInputsServiceSettings; |
| 8 | import java.util.ArrayList; |
| 9 | import java.util.List; |
| 10 | |
| 11 | public class MerchantHighThroughputSync { |
| 12 | public static List<ProductInput> syncBatchConcurrently( |
| 13 | List<InsertProductInputRequest> requests, int poolSize) throws Exception { |
| 14 | // 1. Configure gRPC Channel Pool at 50% target utilization (e.g., 30 for 60,000 updates/min) |
| 15 | InstantiatingGrpcChannelProvider channelProvider = |
| 16 | ProductInputsServiceSettings.defaultGrpcTransportProviderBuilder() |
| 17 | .setPoolSize(poolSize) |
| 18 | .build(); |
| 19 | |
| 20 | ProductInputsServiceSettings settings = |
| 21 | ProductInputsServiceSettings.newBuilder() |
| 22 | .setTransportChannelProvider(channelProvider) |
| 23 | .build(); |
| 24 | |
| 25 | // 2. Reuse a long-lived Client instance (never recreate Client inside a loop) |
| 26 | try (ProductInputsServiceClient client = ProductInputsServiceClient.create(settings)) { |
| 27 | List<ApiFuture<ProductInput>> futures = new ArrayList<>(requests.size()); |
| 28 | for (InsertProductInputRequest req : requests) { |
| 29 | futures.add(client.insertProductInputCallable().futureCall(req)); |
| 30 | } |
| 31 | // 3. Aggregate all async responses non-blockingly |
| 32 | return ApiFutures.allAsList(futures).get(); |
| 33 | } |
| 34 | } |
| 35 | } |
3.2 Python: Concurrency Control with ProductInputsServiceAsyncClient & asyncio.Semaphore
In Python, use the AsyncClient class (backed by grpc.aio), shard requests across a pool of client instances to bypass the 100-stream ceiling per channel, and cap client-side in-flight coroutines using asyncio.Semaphore:
| 1 | import asyncio |
| 2 | from google.shopping.merchant_products_v1 import ( |
| 3 | InsertProductInputRequest, |
| 4 | ProductInput, |
| 5 | ProductInputsServiceAsyncClient, |
| 6 | ) |
| 7 | |
| 8 | async def sync_products_async( |
| 9 | account_id: str, |
| 10 | datasource_id: str, |
| 11 | items: list[ProductInput], |
| 12 | pool_size: int = 8, |
| 13 | max_in_flight: int = 400, |
| 14 | ): |
| 15 | # Build a multi-channel client pool to bypass the 100-stream limit per channel |
| 16 | clients = [ProductInputsServiceAsyncClient() for _ in range(pool_size)] |
| 17 | semaphore = asyncio.Semaphore(max_in_flight) |
| 18 | parent = f"accounts/{account_id}" |
| 19 | data_source = f"accounts/{account_id}/dataSources/{datasource_id}" |
| 20 | |
| 21 | async def _push_one(idx: int, product_input: ProductInput): |
| 22 | client = clients[idx % pool_size] |
| 23 | async with semaphore: |
| 24 | req = InsertProductInputRequest( |
| 25 | parent=parent, |
| 26 | data_source=data_source, |
| 27 | product_input=product_input, |
| 28 | ) |
| 29 | return await client.insert_product_input(request=req) |
| 30 | |
| 31 | try: |
| 32 | tasks = [_push_one(i, item) for i, item in enumerate(items)] |
| 33 | return await asyncio.gather(*tasks, return_exceptions=True) |
| 34 | finally: |
| 35 | await asyncio.gather(*(c.transport.close() for c in clients), return_exceptions=True) |
3.3 PHP & SDK-Free Runtimes: GuzzleHttp\Promise & HTTP multipart/mixed Batching
- PHP Async Concurrency: Use the async methods on the official
google/shopping-merchant-productsclient together withGuzzleHttp\Promise\Utils::settle($promises)->wait()to dispatch requests concurrently. - Clientless REST Environments (HTTP Batching): If lightweight serverless edge functions cannot bundle gRPC dependencies, Merchant API still supports standard Google Cloud HTTP
multipart/mixedbatch endpoints (POST https://merchantapi.googleapis.com/batch/{SUB_API}/{VERSION}, with an outer headerContent-Type: multipart/mixed; boundary=batch_evaooandContent-Type: application/httpon each inner part). - Quota Billing Caveat: HTTP
multipart/mixedreduces outer TCP round trips only—it does not save API quota. A single HTTP batch envelope containing 50productInputs:insertsub-requests still deducts 50 quota units on the server.
Chapter 4: Quota API Dynamic Limits, Automatic 2x Scaling & 429 Backoff
Before load-testing your channel pool, review Google's Quotas and limits specification to align with quota accounting and rate-limit enforcement:
| Quota Item | Official Mechanism & Reset Window | Engineering Best Practice |
|---|---|---|
Daily Total Quota (quotaLimit) | Tracked independently per method group (QuotaGroup, such as the productInputs write group or products read group); resets daily at 12:00 PM UTC (20:00 Beijing Time). | Schedule full catalog reconciliation jobs after 12:00 PM UTC (20:15 Beijing Time) and send incremental diff updates for price/inventory changes during peak hours. Compare legacy and new schemas with the Side-by-Side Document & API Schema Diff Workbench. |
Per-Minute Burst Cap (quotaMinuteLimit) | Enforced in real time over a rolling 60-second window rather than resetting on fixed minute boundaries. | Avoid exhausting an entire minute's allowance at second 0; smooth consumer traffic in your message queue using a Token Bucket rate limiter. |
Automatic 2x Daily Offer Quota Scaling | For product and inventory writes, the system dynamically scales daily capacity based on the account's approved, active Published Offers—granting up to roughly 2x your active offer count per day. | Important: Only approved, live offers contribute to 2x capacity scaling. Repeatedly pushing incomplete or disapproved SKUs does not raise quota and harms account health. |
| Dedicated Batch Method Billing Exceptions | Standard HTTP multipart/mixed charges 1 quota unit per inner sub-request; dedicated native batch endpoints (such as regions:batchCreate, regions:batchUpdate, and regions:batchDelete) count as only 1 quota call per invocation. | When maintaining multi-ZIP regional delivery zones (Regions), prefer native :batch* endpoints to conserve quota. |
| MCA Parent / Sub-Account Quota Isolation | Standalone accounts maintain independent quota pools; under an MCA hierarchy, calls targeting a sub-account draw from that sub-account's quota, inspectable in real time via GET .../quota/v1/accounts/{ID}/quotas. | Have distributed workers poll quotas.list before starting. When quotaUsage / quotaLimit > 85%, automatically shed low-priority audit jobs to protect inventory de-listing and repricing queues. |
4.1 Exponential Backoff Strategy for 429 RESOURCE_EXHAUSTED
When burst traffic hits quotaMinuteLimit and returns HTTP 429 (with error detail QUOTA_REQUEST_RATE_TOO_HIGH), never retry in a tight unthrottled loop. Implement Exponential Backoff with Full Jitter:
- Wait duration on retry attempt
n:sleep_ms = random(0, min(60000, 1000 * 2^n)). - Attach clean ValueTrack tracking parameters to landing page URLs synced to GMC (generated via our Google Ads & PMax Dynamic Macro UTM Builder) so high-frequency catalog updates preserve accurate attribution across Google Ads and GA4.
6-Step Pre-Sunset Checklist Before August 18, 2026
Before cutting over to production, engineering and acquisition teams should verify all 6 steps below:
- Enable API & Register GCP: Enable
merchantapi.googleapis.comin the Google Cloud Console, rundeveloperRegistration:registerGcponce, and verify the human alert email invitation (see Part 3). - Audit DataSources to Prevent Stealing: Call
datasources/v1to list all existing Primary and Supplemental data sources and backfillofferId -> dataSourcemappings into your local database to avoid Offer Stealing (see Part 2). - Upgrade Key Encoding & Micros: Update composite product key builders to use
~delimiters (with unpaddedbase64urlencoding across the full key when reserved characters appear) and convert prices toamountMicros(see Part 1). - Switch to CQRS & Load-Test Channel Pools: Route catalog writes to
productInputs, move disapproval monitoring to embeddedProduct.productStatusandnotificationspush events, and size gRPCpoolSizeat 50% target utilization. - Migrate MCQL Report Views: Rewrite queries to prefix-free
snake_caseviews and adoptucp_agentic_performance_viewwhere needed to monitor AI shopping agent traffic. - Drain Legacy Endpoint Traffic: Monitor GCP API metrics and drive
shoppingcontent.googleapis.comrequest volume to zero before August 18, 2026.
Further Reading: Explore additional Google Ads and product feed engineering playbooks in the Evaoo Digital Marketing · Google Hub.
Found this actionable? Copy standard citation & summary
Formatted with canonical attribution link and executive summary—ready for Slack, Notion, or LLM context.
Put Into Practice: Companion Browser Workbenches
UTM Builder Pro Matrix Workspace
Reverse URL parser, GA4 channel group diagnostics, and dynamic ad macro batch CSV export.
Shopify GTM & GA4 Web Pixel Generator
Generate production-ready Shopify Customer Events Web Pixel code for GA4, Meta, and TikTok.