IntegrationAdvancedlockingconcurrencyupsert
Handle UNABLE_TO_LOCK_ROW in high-concurrency integration upserts
Real World Scenario
Flash sale inventory sync from 10 workers upserting same Product2 external ID causes UNABLE_TO_LOCK_ROW failures and oversell.
Expected Answer
• Partition work by record Id hash single writer per Product
• Exponential backoff retry on UNABLE_TO_LOCK_ROW max 3
• Reduce row lock contention narrow field updates not full record
• Queue-based serial processing per hot Product Id
• Platform Cache inventory reservation before Salesforce upsert
• Monitor lock failure rate per integration job
• Consider dedicated inventory service not Salesforce row for hot SKU
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Direct answer: Partition work by record Id hash single writer per Product Also consider: Exponential backoff retry on UNABLE_TO_LOCK_ROW max 3 In practice: Reduce row lock contention narrow field updates not full record Optimize for scale and operational observability.
Architect Perspective
Hot record contention is architecture signal—serialize writers or move counter off Salesforce row.