AdaptiveBatchSizer
- Namespace:
PPDS.Dataverse.BulkOperations - Assembly:
PPDS.Dataverse - Kind: Class
Summary
Dynamically adjusts DML batch size based on observed execution times. Targets a configurable time per batch (default 10 seconds) to balance throughput and timeout prevention.
Members
Constructors
AdaptiveBatchSizer(int initialSize, double targetSeconds, int minSize, int maxSize)
AdaptiveBatchSizer(int initialSize, double targetSeconds, int minSize, int maxSize)
Initializes a new instance of the PPDS.Dataverse.BulkOperations.AdaptiveBatchSizer class.
-
Param
initialSize: The starting batch size. Default: 100. -
Param
targetSeconds: The target execution time per batch in seconds. Default: 10.0. -
Param
minSize: The minimum allowed batch size. Default: 1. -
Param
maxSize: The maximum allowed batch size. Default: 1000.
Methods
RecordBatchResult
void RecordBatchResult(int batchSize, TimeSpan elapsed)
Records the result of a batch execution and adjusts the batch size.
-
Param
batchSize: The number of records in the completed batch. -
Param
elapsed: The wall-clock time the batch took to execute.
Properties
CurrentBatchSize
int CurrentBatchSize { get; set; }
Gets the current recommended batch size.