What architectural considerations ensure high availability and performance during end-of-quarter sales spikes?
Answer
Basics: At quarter-end many reps update the same opportunities, accounts and forecasts at once. Salesforce is multitenant, so governor limits and row locking, not raw server power, are what hurt you. High availability here means no user-visible errors, slow pages or failed integrations during the busiest days.
How it works:
- Inventory every automation on Opportunity, Account, Quote and Forecast objects: triggers, record-triggered Flows, validation rules, roll-ups, sharing rules.
- Measure with Event Monitoring, Apex Log analysis, Flow debug and Optimizer to find slow transactions.
- Fix hot spots: one trigger per object, bulkified queries, no callouts in the synchronous save path.
- Move non-critical work to Queueable, Platform Events, or scheduled Flow paths.
- Rehearse with realistic volume in a Full sandbox.
Advanced / deep dive: Main failure modes:
- Row locks: UNABLE_TO_LOCK_ROW appears when many transactions update children of the same parent (roll-up summaries lock the parent). Fix by sorting records by parent in batch loads, using serial Bulk API mode, or replacing roll-ups with asynchronous aggregation.
- Data skew: an account with more than about 10,000 child records, or one owner with more than about 10,000 records, makes sharing recalculation and locks slow. Spread ownership and use integration-user round-robin owners.
- Concurrent request limit: long-running synchronous requests (over about 5 seconds) are capped per org (verify the current number); slow integrations can block everyone.
- Callout stacking: synchronous callouts hold a thread, so use async patterns.
- API consumption: ERP and BI jobs compete with users for daily API allocation; throttle and schedule them.
- Sharing rule or hierarchy changes during the quarter-end window trigger heavy recalculations; freeze them. Use deferred sharing calculation for bulk loads. Also plan a change freeze, runbooks, and Trust (status.salesforce.com) monitoring.
Code / config example: Keep the save path light and push slow work async:
apex
trigger OpportunityTrigger on Opportunity (after update) {
List<Id> closedWon = new List<Id>();
for (Opportunity o : Trigger.new) {
if (o.IsWon && !Trigger.oldMap.get(o.Id).IsWon) closedWon.add(o.Id);
}
if (!closedWon.isEmpty()) {
System.enqueueJob(new ErpPushJob(closedWon)); // callout runs outside the user's save
}
}
Hidden gotchas & must-remember points:
- Synchronous limits: 100 SOQL, 150 DML statements, 10,000 ms CPU; async gets 200 SOQL and 60,000 ms CPU.
- Full sandbox load testing needs Salesforce support approval/notice (verify the process).
- Flows and triggers share one transaction budget; adding a Flow can break an old trigger.
- Lock errors are intermittent, so they escape normal testing.
- Scheduled jobs at 00:00 and top-of-hour cause queue contention; stagger them.
Best practice: Treat quarter-end as a performance test: freeze changes, load-test, and have async fallbacks and monitoring ready.
Sales CloudEnterprise ArchitecturePerformance Tuning