cropped-SlicedBread_icon_inversed.png

4.2. Performance Optimization (‘How can I improve performance?’)

If your recipes are running slowly, timing out, or hitting Salesforce org limits, you can adjust the execution mode and batch size.

Understanding Execution Modes #

Sliced Bread offers three distinct execution modes to provide fine-grained control over performance and resource consumption.

  • Parallel (Default): This is the fastest mode. It processes multiple slices at once in parallel asynchronous jobs. This is ideal for most large data loads.
  • Serial: This mode processes one slice at a time, in order. Each slice gets its own, separate transaction.
    • When to use Serial: Use this mode if your records are interdependent (e.g., you must create Parent A before Child B in the same file) or if you are running into “Apex CPU Time Limit” errors caused by complex triggers in your org.
  • Immediate: This mode attempts to run the job immediately in the current transaction, bypassing the Salesforce async queue entirely.
    • When to use Immediate: This mode is a critical tool for managing the 250,000 daily async Apex execution limit. It is designed for small, frequent jobs (e.g., a Flow-triggered recipe that processes only one record). By running immediately, these small jobs do not consume one of your valuable async executions. (ref: 1.155)

Understanding Batch Sizes #

You can configure the batch size (how many slices are in each job) for both the “Transform” and “Load” phases.

  • The 250k Limit: Salesforce enforces an org-wide limit of 250,000 asynchronous executions (including batch jobs) per 24-hour period.
  • Tuning Batch Size:
    • Parallel: The minimum batch size is 4.
    • Serial: The minimum batch size is 1.
    • If you have a large file (e.g., 500,000 rows) and are hitting the org limit, increase your batch size. A larger batch size (e.g., 200) will use fewer batch jobs than a small one (e.g., 10).
    • If you are hitting “Apex CPU Time Limit” errors, decrease your batch size. A smaller batch size (e.g., 25) will give each job less work to do, making it more likely to succeed.

Copyright © 2024 all rights reserved, powered by Sliced Bread Software B.V.