Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Bergantung pada inventaris Anda, sharding (atau membagi feed menjadi beberapa
file) mungkin diperlukan.
Kapan harus menggunakan sharding
Feed melebihi 200 MB untuk 1 file (setelah kompresi gzip).
Contoh: Feed ketersediaan yang dihasilkan adalah 1 GB. File ini harus di-shard ke 5 file terpisah (atau shard).
Inventaris partner didistribusikan di seluruh sistem dan/atau region
sehingga menyulitkan rekonsiliasi inventaris.
Contoh: Partner memiliki inventaris AS dan Uni Eropa yang berada di sistem
terpisah. Feed dapat dibuat dengan 2 file (atau shard), 1 untuk AS,
dan 1 untuk Uni Eropa dengan nonce dan
generation_timestamp yang sama.
Peraturan umum
Setiap shard tidak boleh melebihi 200 MB untuk 1 file (setelah kompresi gzip).
Sebaiknya jangan gunakan lebih dari 20 shard per feed. Jika Anda memiliki justifikasi bisnis yang memerlukan lebih dari jumlah tersebut, hubungi dukungan untuk mendapatkan petunjuk lebih lanjut.
Setiap kumpulan data (misalnya, satu objek Merchant) harus dikirim dalam satu shard,
dan tidak dapat dibagi di beberapa shard. Namun, iklan ini tidak harus dikirim dalam shard dengan shard_number yang sama untuk feed mendatang.
Untuk mendapatkan performa yang lebih baik, data Anda harus dibagi secara merata di antara shard sehingga semua file yang di-sharding memiliki ukuran yang serupa.
Cara melakukan sharding feed
Untuk setiap file (atau shard), tetapkan FeedMetadata ke
hal berikut:
processing_instruction ditetapkan ke
PROCESS_AS_COMPLETE.
shard_number ditetapkan ke shard feed saat ini
(mulai dari 0 hingga total_shards - 1 tanpa diskontinuitas)
total_shards ditetapkan ke jumlah total shard untuk
feed (mulai dari 1).
nonce ditetapkan ke ID unik yang sama
di semua shard feed yang sama, tetapi berbeda dengan nilai
feed lain. nonce harus berupa int positif (uint64).
generation_timestamp adalah stempel waktu dalam format UNIX dan EPOCH. Nilai ini harus sama di semua shard feed.
Direkomendasikan: Untuk setiap file (atau shard), tetapkan nama file untuk menunjukkan
jenis feed, stempel waktu, nomor shard, dan jumlah total
shard. Ukuran shard harus kira-kira sama dan diproses setelah semua
shard diupload.
Menggunakan sharding untuk inventaris yang didistribusikan partner
Partner mungkin kesulitan untuk menggabungkan inventaris yang didistribusikan
di beberapa sistem dan atau wilayah ke dalam satu feed. Sharding dapat
digunakan untuk menyelesaikan tantangan rekonsiliasi dengan menetapkan setiap shard agar cocok dengan setiap
set inventaris sistem terdistribusi.
Misalnya, inventaris partner dipisahkan menjadi 2 wilayah (inventaris Amerika Serikat dan
Uni Eropa), yang berada di 2 sistem terpisah.
Partner dapat membagi setiap feed menjadi 2 file (atau shard):
Feed penjual: 1 shard untuk AS, 1 shard untuk Uni Eropa
Feed layanan: 1 shard untuk AS, 1 shard untuk Uni Eropa
Feed ketersediaan: 1 shard untuk AS, 1 shard untuk Uni Eropa
Ikuti langkah-langkah di bawah ini untuk memastikan feed diproses dengan benar:
Tentukan jadwal upload, dan konfigurasikan setiap instance inventaris untuk mengikuti jadwal.
Tetapkan nomor shard unik untuk setiap instance (misalnya, AS = N, Uni Eropa = N + 1).
Tetapkan total_shards ke jumlah total shard.
Pada setiap waktu upload terjadwal, tentukan generation_timestamp dan nonce. Di
FeedMetadata, tetapkan semua instance untuk menyimpan nilai yang sama untuk
kedua kolom ini.
generation_timestamp harus saat ini atau baru-baru ini
(idealnya, stempel waktu database baca-di partner)
Setelah semua shard diupload, Google mengelompokkan shard melalui
generation_timestamp dan nonce.
Google akan memproses feed sebagai satu meskipun setiap shard mewakili
wilayah inventaris partner yang berbeda dan dapat diupload pada
waktu yang berbeda selama generation_timestamp
sama di semua shard.
Contoh feed Ketersediaan yang di-shard menurut wilayah
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003eSharding, or splitting feeds into multiple files, is recommended when a single feed file exceeds 200 MB after gzip compression or when inventory is distributed across various systems.\u003c/p\u003e\n"],["\u003cp\u003eEach shard should be under 200 MB after gzip compression, with a recommended maximum of 20 shards per feed.\u003c/p\u003e\n"],["\u003cp\u003eIndividual records must be contained within a single shard, and for better performance, data should be evenly distributed across shards.\u003c/p\u003e\n"],["\u003cp\u003eWhen sharding, include \u003ccode\u003eFeedMetadata\u003c/code\u003e in each file with information like \u003ccode\u003eshard_number\u003c/code\u003e, \u003ccode\u003etotal_shards\u003c/code\u003e, \u003ccode\u003enonce\u003c/code\u003e, and \u003ccode\u003egeneration_timestamp\u003c/code\u003e for proper processing.\u003c/p\u003e\n"],["\u003cp\u003ePartners with distributed inventory can utilize sharding to reconcile data from multiple systems by assigning a shard to each system's inventory and ensuring consistent \u003ccode\u003egeneration_timestamp\u003c/code\u003e and \u003ccode\u003enonce\u003c/code\u003e values across all shards.\u003c/p\u003e\n"]]],["Sharding, or breaking up feeds into multiple files, is used when a feed exceeds 200 MB post-compression or when inventory is spread across systems/regions. Each shard must be under 200 MB, with up to 20 shards per feed. Key actions include setting `FeedMetadata` with `processing_instruction`, unique `shard_number`, `total_shards`, shared `nonce`, and `generation_timestamp`. Distribute data evenly among shards, and avoid splitting individual records. Once all shards are uploaded, Google processes them as a complete feed.\n"],null,["# Shard feed files\n\nDepending on your inventory, sharding (or breaking up feeds into multiple\nfiles) may be necessary.\n| **Note:** Sharding might only be applicable to some of the feeds you submit and is dependent on the type of inventory submitted. Please reach out to your Google contact if you are unsure of the best approach.\n\nWhen to use sharding\n--------------------\n\n- Feed exceeds 200 MB for 1 file (after gzip compression).\n\n - **Example:** Generated availability feed is 1 GB. This should be sharded to 5+ separate files (or shards).\n- Partner inventory is distributed across systems and/or regions\n resulting in difficulty reconciling the inventory.\n\n - **Example:** Partner has US and EU inventory that live in separate systems. The feed may be generated with 2 files (or shards), 1 for US, and 1 for EU with the same `nonce` and `generation_timestamp`.\n\n| **Note:** Before using sharding, make sure you are [compressing your feed uploads with gzip](/actions-center/verticals/reservations/waitlists/reference/tutorials/compression). Using gzip can reduce feed size by 10x or more, and may allow you to skip or defer sharding your feed.\n\nGeneral rules\n-------------\n\n- Each shard cannot exceed 200 MB for 1 file (after gzip compression).\n- We recommend no more than 20 shards per feed. If you have a business justification that requires more than that amount, please contact support for further instruction.\n- Individual records (one `Merchant` object for example) must be sent in one shard, they cannot be split across multiple shards. However, they don't have to be sent in the shard with the same `shard_number` for future feeds.\n- For better performance, your data should be split evenly among the shards so that all sharded files are similar in size.\n\n| **Note:** Google processes feed files as soon as they're uploaded to the SFTP server. If the feed is sharded into multiple files, the process begins after you upload the last file. If your feed contains errors, you receive an email with the [feed error codes](/actions-center/verticals/reservations/waitlists/reference/feeds/feed-errors).\n\nHow to shard feeds\n------------------\n\nFor each file (or shard), set the `FeedMetadata` to the\nfollowing:\n\n- `processing_instruction`set to `PROCESS_AS_COMPLETE`.\n- `shard_number` set to to the current shard of the feed (starting from 0 to `total_shards` - 1 without discontinuities)\n- `total_shards` set to the total number of shards for the feed (starting from 1).\n- `nonce` set to a unique identifier that is **the same** across all shards of **the same** feed but different from the value of other feeds. `nonce` must be a positive int (`uint64`).\n- `generation_timestamp` is the timestamp in unix and EPOCH format. This should be **the same** across all shards of the feed.\n\n*Recommended:* For each file (or shard), set the filename to indicate\nthe feed type, the timestamp, the shard number, and the total number of\nshards. Shards should be roughly equal in size and are processed once all\nshards are uploaded.\n\n- `Example:` \"availability_feed_1574117613_001_of_002.json.gz\"\n\n**Sharded Availability feed example** \n\n### Shard 0\n\n```scdoc\n{\n \"metadata\": {\n \"processing_instruction\": \"PROCESS_AS_COMPLETE\",\n \"shard_number\": 0,\n \"total_shards\": 3,\n \"nonce\": 111111,\n \"generation_timestamp\": 1524606581\n },\n \"service_availability\": [\n {\n \"availability\": [\n {\n \"spots_total\": 1,\n \"spots_open\": 1,\n \"duration_sec\": 3600,\n \"service_id\": \"1000\",\n \"start_sec\": 1577275200,\n \"merchant_id\": \"merchant1\",\n \"confirmation_mode\": \"CONFIRMATION_MODE_SYNCHRONOUS\"\n }\n ]\n }\n ]\n}\n```\n\n### Shard 1\n\n```scdoc\n{\n \"metadata\": {\n \"processing_instruction\": \"PROCESS_AS_COMPLETE\",\n \"shard_number\": 1,\n \"total_shards\": 3,\n \"nonce\": 111111,\n \"generation_timestamp\": 1524606581\n },\n \"service_availability\": [\n {\n \"availability\": [\n {\n \"spots_total\": 1,\n \"spots_open\": 1,\n \"duration_sec\": 3600,\n \"service_id\": \"1000\",\n \"start_sec\": 1577620800,\n \"merchant_id\": \"merchant2\",\n \"confirmation_mode\": \"CONFIRMATION_MODE_SYNCHRONOUS\"\n }\n ]\n }\n ]\n}\n```\n\n### Shard 2\n\n```scdoc\n{\n \"metadata\": {\n \"processing_instruction\": \"PROCESS_AS_COMPLETE\",\n \"shard_number\": 2,\n \"total_shards\": 3,\n \"nonce\": 111111,\n \"generation_timestamp\": 1524606581\n },\n \"service_availability\": [\n {\n \"availability\": [\n {\n \"spots_total\": 1,\n \"spots_open\": 1,\n \"duration_sec\": 3600,\n \"service_id\": \"1000\",\n \"start_sec\": 1576670400,\n \"merchant_id\": \"merchant3\",\n \"confirmation_mode\": \"CONFIRMATION_MODE_SYNCHRONOUS\"\n }\n ]\n }\n ]\n}\n```\n\nUsing sharding for partner distributed inventory\n------------------------------------------------\n\nIt can be challenging for partners to consolidate inventory distributed\nacross multiple systems and or regions into a single feed. Sharding can be\nused to resolve reconciliation challenges by setting each shard to match each\ndistributed system's inventory set.\n\nFor example, say a partner's inventory is separated into 2 regions (US and EU\ninventory), which live in 2 separate systems.\n\nThe partner can break each feed into 2 files (or shards):\n\n- Merchants feed: 1 shard for US, 1 shard for EU\n- Services feed: 1 shard for US, 1 shard for EU\n- Availability feed: 1 shard for US, 1 shard for EU\n\nFollow the steps below to ensure the feeds are properly processed:\n\n1. Decide on an upload schedule, and configure each instance of inventory to follow the schedule.\n2. Assign unique shard numbers for each instance (e.g. US = N, EU = N + 1). Set `total_shards` to the total number of shards.\n3. At each scheduled upload time, decide on a `generation_timestamp` and `nonce`. In the `FeedMetadata`, set all instances to hold the same values for these two fields.\n - `generation_timestamp` should be current or recent past (ideally, the partner's read-at database timestamp)\n4. After all shards are uploaded, Google groups the shards via `generation_timestamp` and `nonce`.\n\n| **Note:** Feeds/shards arriving separately at different times is supported, but coordinated schedules is best. Feed processing occurs only when all shards in a feed set are uploaded.\n\nGoogle will process the feed as one even though each shard represents a\ndifferent region of the partner's inventory and could be uploaded at a\ndifferent time of the day as long as the `generation_timestamp`\nis the same across all shards.\n\n**Sharded Availability feed example by region** \n\n### Shard 0 - US Inventory\n\n```scdoc\n{\n \"metadata\": {\n \"processing_instruction\": \"PROCESS_AS_COMPLETE\",\n \"shard_number\": 0,\n \"total_shards\": 2,\n \"nonce\": 111111,\n \"generation_timestamp\": 1524606581\n },\n \"service_availability\": [\n {\n \"availability\": [\n {\n \"spots_total\": 1,\n \"spots_open\": 1,\n \"duration_sec\": 3600,\n \"service_id\": \"1000\",\n \"start_sec\": 1577275200,\n \"merchant_id\": \"US_merchant_1\",\n \"confirmation_mode\": \"CONFIRMATION_MODE_SYNCHRONOUS\"\n }\n ]\n }\n ]\n}\n```\n\n### Shard 1 - EU Inventory\n\n```scdoc\n{\n \"metadata\": {\n \"processing_instruction\": \"PROCESS_AS_COMPLETE\",\n \"shard_number\": 1,\n \"total_shards\": 2,\n \"nonce\": 111111,\n \"generation_timestamp\": 1524606581\n },\n \"service_availability\": [\n {\n \"availability\": [\n {\n \"spots_total\": 1,\n \"spots_open\": 1,\n \"duration_sec\": 3600,\n \"service_id\": \"1000\",\n \"start_sec\": 1577620800,\n \"merchant_id\": \"EU_merchant_1\",\n \"confirmation_mode\": \"CONFIRMATION_MODE_SYNCHRONOUS\"\n }\n ]\n }\n ]\n}\n```"]]