LeanData apex code is often run in 2 methods: triggers and apex jobs (Batch and Scheduled). Each method is subjected to different Salesforce limitations and shared resources. The Trigger method is more sensitive and resources are often shared with other third party apps, workflows and process builder flows. As a result, majority of LeanData's processing is done via Batch or the Scheduled method with a 2 minutes delay after trigger time.
LeanData does have some lightweight apex code running in the trigger method. By design, LeanData will only route or tag records that contain relevant updated or inserted data via the configurations provided by the customer. In order to identify these relevant records, these configurations need to be evaluated at trigger time when the records are updated/inserted. Once the records are identified, LeanData captures these changes and required actions into a custom object called CC_Inserted_Object__c (CCIO) which will be picked up and processed later in the Apex Job method.
There are 3 main LeanData jobs that are often visible under Apex Jobs page:
- LeanData CC Scheduler (Scheduled)
- LeanDataContinuousBatch (Batch Apex)
- LeanData Scheduling Monitor (Scheduled)
The LeanDataContinuousBatch is responsible for all the processing and functionalities of LeanData. The other two provide stability and reliability to the software.
LeanData CC Scheduler is scheduled every 2 minutes to query the database for any pending CCIO objects to be processed by the LeanDataContinuousBatch. If there are records to be processed and LeanDataContinuousBatch is not already running then an instance will be started. The Scheduler does not process records and therefore does not consume many resources that count toward the governor limit, its only job is to make sure LeanDataContinuousBatch only runs when necessary.
When the LeanDataContinuousBatch is run, it will pick up 400 records at a time and process 1 CCIO per scope of the execution (This is important for LeanData's Fuzzy Matching algorithm). The LeanDataContinuousBatch will continue processing until there's no more CCIOs in the database. At any point, if the LeanDataContinuousBatch runs into any failure and quits completely, it will be started again by the LeanData CC Scheduler, which allow for minimal down time/ waiting time. This is also the reason why we do not perform heavy logic processing within the LeanData CC Scheduler itself, to minimize risk for failure and provide cross checking functionality.
LeanData Scheduling Monitor is another job that adds to the stability of our LeanData's jobs. The monitor is scheduled to run every 1 hour to check that both the LeanData CC Scheduler and Continuous Clean Batch are running. This schedule ensures that, if either or both are down, the downtime will be limited to 1 hour. The only time that LeanData is not processing records is when all of these 3 jobs are aborted or unable to run.
There is an additional job called LeanData CODA (Check OnDemand Allowed). This job is used by LeanData to communicate between the customer’s instance and our management tool called Beacon. The job is used to sync settings between your instance and ours, once an hour. Syncing will ensure we can apply any relevant settings to your organization. This job uses very few system resources.
Questions? Contact LeanData Support