Book Image Enterprise Architecture

By : Andrew Fawcett
Book Image Enterprise Architecture

By: Andrew Fawcett

Overview of this book

Table of Contents (20 chapters) Enterprise Architecture
About the Author
About the Reviewers

Execution contexts

An execution context on the platform has a beginning and an end; it starts with a user or system action or event, such as a button click or part of a scheduled background job, and is typically short lived; seconds or minutes instead of hours before it ends. It is especially important in multitenant architecture because each context receives its own set of limits around queries, database operations, logs, and duration of the execution.

In the case of background jobs (Batch Apex), instead of having one execution context for the whole job, the platform splits the information being processed and hands it back through several execution contexts in a serial fashion. For example, if a job was asked by the user to process 1000 records and the batch size (or scope size in Batch Apex terms) was 200 (which is the default), this would result in five distinct execution contexts one after another. This is done so that the platform can throttle up or down the execution of jobs or if needed...