Завантаження великих обсягів
Також доступно 19 мовами
English · Español · 日本語 · Português (Brasil) · Français · Deutsch · Italiano · 한국어 · 简体中文 · Português (Portugal) · 繁體中文 · Bahasa Indonesia · Türkçe · Polski · Tiếng Việt · ไทย · Español (México) · Français (Canada) · Deutsch (Schweiz)

Модуль 2 з 5 розділу Міграція і синхронізація, розділ 10 курсу Data Architect. Кожен модуль самостійний. Попередній: Міграція — насамперед проєкт якості · Наступний: Автоматизація під час завантаження
Питання, на яке відповідає цей модуль: Як «кількість нулів» змінює спосіб, у який ви завантажуєте дані в Salesforce?
Десять записів? Я майже можу їх надрукувати вручну. Тисяча? Тепер мені потрібен інструмент. Мільйон? Це архітектурна задача. Операція не змінилася (створити чи оновити записи), але «кількість нулів» змінює те, як я це роблю. Ми бачили це в моделюванні, запитах, спільному доступі й інтеграціях, і міграція не виняток. На великих обсягах мене цікавить, як я переміщую дані, як розбиваю їх на роботу, у якому порядку вони рухаються, що ще робить Salesforce, поки я завантажую, як я відновлююся, коли щось ламається, і чи можу я прогнати все ще раз.
Start With the Picture
Section titled “Start With the Picture”Same landscape, same amber arrow as module 1: RouteDesk’s open work coming into Salesforce the weekend RouteDesk retires. ⟲
Module 1 decided what moves on this arrow. This module is about how it moves. ⟲
Module 1 decided what comes in: the deliveries not yet made and the ones still inside the 60-day claim window, about 196,400 deliveries. Each one becomes a Work Order, with its line items (about 1.6 per delivery, so about 314,000) and its Service Appointment (about 196,400 more). That’s roughly 707,000 records, prepared in the preparation data store and ready to go. Not millions, but well past anything I’d send one record at a time. So, how do they get in? ⟲
Вантажна рампа за банком
Section titled “Вантажна рампа за банком ”Коли я викладаю Bulk API, я використовую банк. Ви заходите зі стосом депозитів, касир бере 200 і відправляє вас у кінець черги. З мільйоном записів це 5 000 проходів через чергу, 5 000 викликів API. Тим часом до бічних дверей банку під’їжджає вантажівка, розвантажує величезну кількість депозитів і за двадцять хвилин від’їжджає, поки ви ще стоїте в черзі. Це вантажна рампа, і її ім’я — Bulk API.
The 200 is still real. A REST sObject Collections request takes “up to 200 records” (Create Records Using sObject Collections (відкривається в новій вкладці), REST API Developer Guide), and a SOAP create() call the same: “If a create request exceeds 200 records, then the entire operation fails” (create() (відкривається в новій вкладці), SOAP API Developer Guide; both checked 2026-10-27). Every 200 more records is another call. RouteDesk’s 707,000 records would be over 3,500 trips to the teller. ⟲
Same records, different door. ⟲
Вантажна рампа має п’ять кроків:
- Відкрити завдання. Натисніть червону кнопку дзвінка й отримайте квиток: ID завдання.
- Завантажити. Рампа відчиняється, і ви вантажите свої CSV-файли під цей квиток, один файл чи сотню.
- Закрити завдання. Salesforce не знає, що ви закінчили, доки ви не натиснете велику синю кнопку: завантаження завершено. Тепер починається обробка.
- «Ми вже приїхали?» Як мої діти на задньому сидінні: ви питаєте зі своїм ID завдання, чи готово. Готово? Готово?
- Отримати результати. Завантажте успішні записи (з їхніми новими ID Salesforce) або невдалі (з їхніми помилками).
Submit, wait, collect. ⟲
Мільйон записів коштує жменю викликів замість тисяч. Але зверніть увагу, що змінилося: робота асинхронна. Ви не отримуєте відповіді на кожен запис; ви надсилаєте, чекаєте й забираєте. Тож тому, хто викликає, треба знати, що надіслано, що ще обробляється, що завершено, що не вдалося і що повернулося. Це не деталь API. Це контроль міграції.
Дві вантажні рампи: Bulk API 2.0 і Bulk API
Section titled “Дві вантажні рампи: Bulk API 2.0 і Bulk API ”Є дві версії, і важливо, якою ви користуєтеся.
- Bulk API 2.0 is the one to start with. You upload the data for a job and Salesforce splits it into batches for you, retries for you and runs them in parallel. A job can take 150 MB, measured after Salesforce encodes it, so Salesforce advises uploading no more than 100 MB of CSV per job. ⟲
- Bulk API (1.0) makes you create the batches yourself, up to 10,000 records each. It’s older, but it still has two levers 2.0 doesn’t give you: serial mode for loads, and PK chunking for very large exports (module 5). ⟲
Both share a rolling 24-hour allowance of 15,000 batches, and either can load up to 150 million records in 24 hours. Job results are kept for seven days after the job completes (Bulk API and Bulk API 2.0 Limits and Allocations (відкривається в новій вкладці), checked 2026-10-27). Salesforce’s line between the doors: “Any data operation that includes more than 2,000 records is a good candidate for Bulk API 2.0”; below that, “bulkified” synchronous calls are fine (Loading Data from the API (відкривається в новій вкладці), Best Practices for Deployments with Large Data Volumes, Winter ‘27, checked 2026-10-27). Those are today’s numbers: check them before you plan around them. ⟲
Поодинці, наборами й масово — так я думаю про форму роботи: одне оновлення від дії користувача, кілька сотень пов’язаних записів від бізнес-процесу, мільйони історичних записів у міграції. Це не назви продуктів. Спитайте, яка форма в роботи, перш ніж обирати інструмент.
Test knowledge. Know when the Bulk API is the answer: more than about 2,000 records, asynchronous, a job you submit and collect. Know the two versions apart: Bulk API 2.0 splits the batches for you and runs them in parallel; Bulk API (1.0) has you build batches of up to 10,000 records, and only it offers serial mode and PK chunking. Both share 15,000 batches in a rolling 24 hours. ⟲
Інструмент не скасовує архітектури
Section titled “Інструмент не скасовує архітектури ”«Ми використаємо Bulk API». Добре. Це не каже мені, які об’єкти завантажуються першими, insert чи upsert, який зовнішній ключ, як відновлюються зв’язки, що буває, коли частина записів не вдається, чи можуть завдання йти паралельно, чи паралельна робота боротиметься за ті самі батьківські записи, яка автоматизація спрацює і як ми звірятимемо й перезапускатимемо. Bulk API розв’язує задачу транспортування. Міграцію вона не розв’язує.
The order comes from the model, and module 1 drew it for RouteDesk: reference data first, then the Work Orders, then their line items and appointments, then the claim Cases that point at them (Preserve the Source Identity, and Load by Keys). Each wave is its own job, and the next one doesn’t start until the last one’s results are in. Junction objects depend on two parents, self-referencing hierarchies may need several passes, and circular relationships may need records first and relationships second. Don’t discover these on cutover weekend. ⟲
Іноді ви завантажуєте запис, а потім зв’язок. Материнська компанія, дочірня і регіональна дочірня створюються під час міграції. Замість того щоб розв’язувати кожен зв’язок за один прохід, завантажте акаунти з їхніми стабільними ключами джерела, а потім запустіть другий прохід, що встановлює ієрархію. Та сама ідея допомагає з самопосиланнями lookup і циклічними залежностями. Мета — не один прохід. Мета — детермінований, повторюваний результат.
Insert, update чи upsert
Section titled “Insert, update чи upsert ”Insert says create this as new. Update says I already know the Salesforce record I’m changing. Upsert says use this key to find out whether the record exists; update it if it does, create it if it doesn’t. With stable External IDs, upsert makes rehearsals far easier: load, find a transformation problem, fix it, rerun, without the run assuming everything is a first-time insert. Keys are architecture, not just integration plumbing. RouteDesk’s Work Orders upsert on the partner key, the same field the integration uses, so a manifest Redrock resends on cutover weekend updates the migrated record instead of duplicating it. ⟲
Upsert has a price, though. Salesforce’s own Large Data Volumes guide ranks the operations: “insert() is fastest, update() is next, and upsert() is next after that. If possible, also break upsert() into two operations: create() and update()” (Loading Data from the API (відкривається в новій вкладці), checked 2026-10-27). How do you know which records are new and which already exist? The preparation data store knows, because it pulled down what Salesforce already has and keeps the IDs that came back (module 1). So the 190,000 delivered Work Orders that nothing in Salesforce has touched can go in as a plain insert, and only the open ones the integration may already have created need the upsert. ⟲
Two more lines from the same guide. Load clean data: “Errors in batches trigger single-row processing for that batch, and that processing heavily impacts performance.” That’s module 1 paying off at the loading dock. And when you update, “send only fields that have changed.” A reload that resends every field of 196,400 Work Orders does work nobody asked for. ⟲
Але upsert — не магія. Якщо стратегія ключів хибна, операція хибна. Два записи джерела для того самого клієнта з різними ключами для Salesforce — два записи; ключ джерела, що може ідентифікувати кілька цілей, означає, що ми неправильно зрозуміли кардинальність. Робота з якості з модуля 1 досі важлива; функція API її не замінює.
Test knowledge. Insert is the fastest operation, then update, then upsert; Salesforce suggests splitting an upsert into creates and updates where you can. Upsert needs an External ID, and it’s what makes reruns safe. Load clean data, because errors in a Bulk API batch push that batch into slow single-row processing, and send only the fields that changed. ⟲
Паралельно швидше, доки ні
Section titled “Паралельно швидше, доки ні ”Паралельна обробка підвищує пропускну здатність. Але якщо багато записів у завантаженні вказують на той самий батьківський запис, транзакції змагаються за блокування цього батьківського, і те, що ми зробили заради швидкості, створює конкуренцію за блокування, помилки й повтори. Це знову гарячі точки з розділу 7: якщо мільйон дочірніх записів сходиться на кількох батьківських, форма даних важить для завантаження. Коли два пакети чекають на блокування, яке тримає інший, виникає взаємне блокування (deadlock): дві машини застрягли на перехресті.
RouteDesk is exactly that shape. Almost 196,400 Work Orders, and nearly every one points at one of three Retail Partner Accounts. Load them in parallel in the order RouteDesk exported them, and every batch holds Work Orders for all three partners. ⟲
In export order, every batch needs every parent. One locks, the others wait. ⟲
Two levers. First, sort the files by parent, so the children of one parent travel together in the same batch instead of being spread across batches that collide. Salesforce gives the same advice: “When changing child records, group them by parent—group records by the field ParentId in the same batch to minimize locking conflicts” (Loading Data from the API (відкривається в новій вкладці), checked 2026-10-27). ⟲
Sorted by partner, each batch works on its own parent. ⟲
Second, on Bulk API 1.0, serial mode processes one batch at a time: slower, but it removes the contention. I reach for serial mode when the data is complex and we’re running into collisions and timeouts. Salesforce’s own guide is more cautious: serial mode “is used only when previously submitted asynchronous jobs have accidentally produced contention because of locks. Use only when advised by Salesforce” (Limits (відкривається в новій вкладці), Bulk API 2.0 and Bulk API Developer Guide, checked 2026-10-27). So sort first, and treat serial as the fallback. And it’s only on the older dock: Bulk API 2.0’s job reference says “Currently only parallel mode is supported,” and if other modes ever arrive, “the mode will be chosen automatically by the API and will not be user configurable” (Create a Job (відкривається в новій вкладці), Bulk API 2.0, checked 2026-10-27). A load that needs serial processing is a reason to use Bulk API 1.0. ⟲
Serial mode is a setting on the job, chosen when you create it. On Bulk API 1.0, RouteDesk’s Work Orders would be: ⟲
POST /services/async/68.0/job{ "operation": "upsert", "object": "WorkOrder", "externalIdFieldName": "Partner_Delivery_Key__c", "contentType": "CSV", "concurrencyMode": "Serial"}Leave concurrencyMode out and you get Parallel, the default. Salesforce’s job reference says when to change it: “If parallel mode results in too many failed records or failed jobs, submit the job with Serial concurrency mode,” and adds that it “can significantly increase the processing time” (JobInfo (відкривається в новій вкладці), Bulk API 2.0 and Bulk API Developer Guide, checked 2026-10-31). ⟲
And if three parents are too few for any sorting to help, look at the model. Checkpoint 1 already offered a way to spread them: link Work Orders to a child Account per distribution center, so nine parents share the load instead of three. That’s a design decision, made before the migration, not a loader setting. ⟲
Я не починаю з «завжди паралельно» чи «завжди послідовно». Я дивлюся на форму зв’язків, гарячі батьківські записи, автоматизацію, що спрацьовує, що ще блокується і що сталося на репетиції. Потім обираю. Спершу правильно, потім швидко.
Test knowledge. Parallel loads lock parent records. When many children share a few parents, expect “unable to lock row” errors: sort the load file by parent so each batch touches as few parents as possible. Serial mode (Bulk API 1.0 only) removes the contention at the cost of speed; Salesforce reserves it for lock contention the sorting didn’t solve. ⟲
Розмір пакета — рішення про налаштування
Section titled “Розмір пакета — рішення про налаштування ”Люди хочуть чарівного числа. У мене його немає. Правильний розмір залежить від об’єкта, складності запису, автоматизації, зв’язків, блокувань, payload і механізму. Завеликий — і збої стають дорогими, а транзакції роблять забагато роботи; замалий — і домінують накладні витрати, а прогін триває значно довше, ніж мав би (а в 1.0 ще й з’їдає ліміт пакетів). Почніть у межах лімітів, які підтримує інструмент, а потім вимірюйте на репрезентативних даних.
And the rehearsal data needs the same shape as production. Twenty million records in production, ten thousand in the test, and everything flies: what did we prove? Not much about scale. The test doesn’t need every record, but it must expose the architecture: heavy concentration on a few parents, millions of children, large text fields, complex relationships, historical skew, automation triggered by particular values. The Number of Zeros matters, and so does the shape behind the zeros. For RouteDesk that means a rehearsal set where a third of the Work Orders still point at Redrock. ⟲
Користувач для завантаження і хто володіє записами
Section titled “Користувач для завантаження і хто володіє записами ”For a substantial migration I want a dedicated migration identity, not someone’s personal admin account: for traceability, controlled permissions, automation decisions (module 3), monitoring and troubleshooting. A million records created by the migration user during cutover tells me something. A million created by Daniel Reyes because Daniel ran Data Loader on Saturday night mixes human identity with system activity. Give it the permissions the job needs, and don’t let it become a permanent mystery superuser nobody dares disable. ⟲
Then don’t confuse who loaded a record with who should own it. Created By is provenance; Owner is architecture, with sharing and business consequences. Set business ownership deliberately. Sometimes there’s no good answer in the source: the record’s owner left years ago, or never existed. It can be hard to assign records to active users, and I’ve created a dedicated “data load” user to own them. That’s sound practice with one condition from chapter 7: a user who owns more than 10,000 records of an object is ownership skew, so that owner should have no role, or a role of its own at the top of the hierarchy (Ownership Data Skew (відкривається в новій вкладці)), and the records should have a path to real owners. Who owns the records, and where that owner sits in the role hierarchy, is an important decision the team makes for any bulk import, not something the loader defaults. For RouteDesk’s Work Orders, chapter 7’s question decides it: does ownership drive who sees a delivery? At Steve Trucking it doesn’t (partners see their own deliveries through the partner on the record), so one owner with no role is fine. ⟲
Інструменти: обирайте заради повторюваності
Section titled “Інструменти: обирайте заради повторюваності ”There are many ways to load data, and the tool matters less than how you use it. Salesforce’s Data Loader has been tried and true, but it’s aged: a desktop tool that works CSV by CSV. Its command-line version can be scripted and pointed at your preparation data store, which is how I’ve run repeated loads. Some tools connect a SQL database straight to Salesforce, copying data down and sending changes back with SQL. ETL and integration platforms do the same job at enterprise scale. And with the APIs you can drive the Bulk API directly: the Salesforce CLI’s sf data upsert bulk loads a CSV through Bulk API 2.0 with an External ID from one command (data upsert bulk (відкривається в новій вкладці), Salesforce CLI Command Reference, checked 2026-10-27). You can even have AI write the small scripts that run each complex step. ⟲
Хоч яким буде інструмент, ось моя найсильніша вимога: я не хочу, щоб міграція в production була першим разом, коли ми виконуємо міграцію, і не хочу, щоб кожна репетиція була пригодою ручної роботи. Якщо крок 17 каже «відкрий цей CSV, відсортуй за колонкою G, видали порожні рядки, протягни цю формулу вниз, потім запусти Data Loader із такими налаштуваннями», я нервую. Кожен ручний крок — шанс на не той файл, пропущений рядок, застарілу версію, погане сортування, забутий фільтр, налаштування, що відрізняється від репетиції. Деяких, можливо, не уникнути: задокументуйте й протестуйте їх. Але мета — повторюваність, тож вивантаження, перетворення, перевірка, завантаження, збирання результатів і звірка мають щоразу проходити однаково.
Якщо ви плануєте завантаження за розкладом, не ставте їх частіше, ніж вони встигають завершитися. Щогодинне завдання, яке іноді триває дев’яносто хвилин, запуститься поверх самого себе; перевіряйте, що попередній запуск завершився, перш ніж починати наступний.
Keep Every Result, and Bring the Keys Back
Section titled “Keep Every Result, and Bring the Keys Back”Для кожного завантаження зберігайте версію вхідних даних, перетворений файл завантаження, ID завдання, результати успіхів і збоїв з їхніми помилками, час, кількості записів і результати звірки. Після великої міграції хтось спитає «що сталося з цим записом?», і я хочу доказів, а не «здається, це було в третьому CSV у суботу вранці». Масові результати зберігаються лише сім днів, тож завантажуйте їх одразу. Дайте цим артефактам життєвий цикл пізніше; не викидайте їх, поки вам ще треба доводити переміщення.
Then bring the keys back. The success results carry each record’s new Salesforce ID next to the key you sent. Write them back into the preparation data store, on the row that produced the record: that’s the last frame of module 1’s three sets of keys. On the Zendesk migration I described in module 1, that’s what made everything else possible. With the Salesforce IDs back on every row, I could load in phases (accounts and contacts first, then the cases, then the comments and files that hang off them), and each phase found its parents by the IDs the last one returned. I could do a partial load: just the rows that failed, or just one group. And I could reload: fix a transformation, regenerate the affected rows, and send only those, knowing exactly which Salesforce records they’d update. Without the keys back, every rerun is a guess. ⟲
Розмір збоїв — теж питання «кількості нулів». Двадцять збоїв зі 100 — погано; двадцять із 20 мільйонів усе одно треба розслідувати, але це інший сигнал. Стежте за частками, а не лише за кількостями, і класифікуйте збої: перевірка, відсутній батьківський запис, дубльований ключ, блокування, тип даних, автоматизація, дозволи. Класифіковані, вони показують вам архітектурні проблеми замість гігантського файлу помилок.
І продуктивність — це більше, ніж записи за секунду. «Ми подвоїли пропускну здатність». Що змінилося? Чи зросли блокування, збої чи повтори? Чи відстала автоматизація далі за ланцюжком, чи накопичився перерахунок спільного доступу, чи захлинулася інша інтеграція? Чи справді скоротився загальний час перемикання? Міграція не працює у вакуумі.
Test knowledge. The Bulk API’s success results return each record’s new Salesforce ID with the data you sent, and its failure results return each error; both are kept for seven days. Capture them, write the IDs back to the source or staging data, and you can load in phases, retry only the failures, and reconcile what landed. ⟲
Тестуйте весь прогін
Section titled “Тестуйте весь прогін ”Завантажити акаунти, потім контакти, потім замовлення, кожне протестувавши окремо, — це не протестована міграція. Я хочу повну репетицію від початку до кінця, з тією самою послідовністю, перетвореннями, ідентичностями, стратегією автоматизації і звіркою, на репрезентативному обсязі. Між кроками з’являються залежності: десятихвилинна затримка запускає наступне завантаження не в той час, несподівана частка збоїв коштує годин виправлень, перерахунок спільного доступу зсуває графік. Повний прогін каже вам, чи працює міграція, а не лише кожна команда.
If the rehearsal includes a performance or scale test, put Salesforce’s lead time in the plan. “All tests must be pre-approved. Unapproved testing is subject to throttling or blocking,” and for tests at 120 requests a second or below, the request goes in “at least one week before the testing date” (Salesforce Performance and Scale Test FAQs (відкривається в новій вкладці), Salesforce Help, checked 2026-10-27). A rehearsal that gets throttled proves nothing about cutover weekend. ⟲
ШІ може написати скрипт. За прогін відповідаєте ви.
Section titled “ШІ може написати скрипт. За прогін відповідаєте ви. ”AI is very good at generating transformation scripts, load orchestration, error parsers, reconciliation queries and retry logic. Use it. But generated code can be wrong at enormous speed: a wrong transformation on ten records is ten fixes; on ten million, the Number of Zeros applies to the mistake too. The way I use it is step by step: clean, transform and migrate steps, with every generated command and action tracked. That’s deterministic, auditable automation, not unattended judgment. Test it at realistic scale before you trust it with production data. ⟲
За межами іспиту: що змінює ШІ. ШІ знижує зусилля на створення інструментів міграції й полегшує швидку генерацію та запуск масових операцій. Що більша операція, то сильніша потреба в детермінованих перетвореннях, відстежуваних кроках, репетиціях, контролях і звірці.
Що тут вирішує архітектор
Section titled “Що тут вирішує архітектор ”- Який механізм завантаження й версія API пасують до обсягу й форми роботи, замість того щоб ставитися до міграції як до транзакційного трафіку.
- Послідовність об’єктів і зв’язків за залежностями, зокрема коли записи й зв’язки потребують окремих проходів.
- Which operation each set of records gets (insert, update or upsert), based on what the preparation data store knows already exists. ⟲
- Where parallel processing is safe, and where concentration, locking or automation justify sorting by parent, a model change, or serial processing. ⟲
- Які стабільні ключі, міграційна ідентичність, власність записів і повторювані інструменти роблять репетиції й завантаження в production детермінованими.
- How results and new IDs come back, so loads can run in phases, retry only failures, and reload safely. ⟲
- Які докази, класифікація збоїв і репетиція повного прогону потрібні, перш ніж довіряти процесу в масштабі production.
Вантажній рампі все одно потрібен план
Section titled “Вантажній рампі все одно потрібен план ”The loading dock moves enormous amounts of data. It doesn’t decide which truck unloads first, where the pallets go, which shipment belongs to which customer, what happens to a damaged pallet, whether two forklifts are using the same aisle, or whether everything that should have arrived did. That’s architecture. Know the Number of Zeros and the shape behind them. Load in dependency order, use stable keys, control concurrency, bring the keys back, make the process repeatable, keep the evidence, and rehearse the whole thing. Then use the loading dock as fast as the architecture safely allows. ⟲
Додаткові матеріали
Section titled “Додаткові матеріали ”- Salesforce, Bulk API and Bulk API 2.0 Limits and Allocations (відкривається в новій вкладці), Developer Limits and Allocations Quick Reference, checked 2026-11-01. ⟲
- Salesforce, General Guidelines for Data Loads (відкривається в новій вкладці) and Limits (відкривається в новій вкладці), Bulk API 2.0 and Bulk API Developer Guide, checked 2026-11-01. ⟲
- Salesforce, Best Practices for Deployments with Large Data Volumes, Loading Data from the API (відкривається в новій вкладці), Winter ‘27, checked 2026-11-01. ⟲
- Salesforce, REST API Developer Guide, Create Records Using sObject Collections (відкривається в новій вкладці), checked 2026-11-01. ⟲
- Salesforce, SOAP API Developer Guide, create() (відкривається в новій вкладці), and Bulk API 2.0, Create a Job (відкривається в новій вкладці), checked 2026-11-01. ⟲
- Salesforce, Bulk API 2.0 and Bulk API Developer Guide, JobInfo (відкривається в новій вкладці) (the Bulk API 1.0 job fields,
concurrencyMode), API version 68.0 (Winter ‘27), checked 2026-11-01. ⟲ - Salesforce Help, Salesforce Performance and Scale Test FAQs (відкривається в новій вкладці), checked 2026-11-01. ⟲
- Курс Integration Architect: у розділі Bulk (coming soon) Bulk API розібрано поглиблено.
- У цьому курсі: Проєктування для масштабу (гарячі точки й перекіс власності).
- Salesforce Developers, Designing Record Access for Enterprise Scale, Ownership Data Skew (відкривається в новій вкладці), checked 2026-11-01. ⟲
- Salesforce Developers, Salesforce CLI Command Reference, data upsert bulk (відкривається в новій вкладці), checked 2026-11-01. ⟲
