Asynchronous Callout Limits

When a continuation is executing, the continuation-specific limits apply. When the continuation returns and the request resumes, a new Apex transaction starts. All Apex and Visualforce limits apply and are reset in the new transaction, including the Apex callout limits.

Continuation-Specific Limits

The following are Apex and Visualforce limits that are specific to a continuation.

Description Limit
Maximum number of parallel Apex callouts in a single continuation 3
Maximum number of chained Apex callouts 3
Maximum timeout for a single continuation1 120 seconds
Maximum Visualforce controller-state size2 80 KB
Maximum HTTP response size 1 MB
Maximum HTTP POST form size—the size of all keys and values in the form3 1 MB
Maximum number of keys in the HTTP POST form3 500

1 The timeout that is specified in the autogenerated Web service stub and in the HttpRequest objects is ignored. Only this timeout limit is enforced for a continuation.

2 When the continuation is executed, the Visualforce controller is serialized. When the continuation is completed, the controller is deserialized and the callback is invoked. Use the Apex transient modifier to designate a variable that is not to be serialized. The framework uses only serialized members when it resumes. The controller-state size limit is separate from the view state limit. See Differences between Continuation Controller State and Visualforce View State.

3 This limit is for HTTP POST forms with the following content type headers: content-type='application/x-www-form-urlencoded' and content-type='multipart/form-data'

Differences between Continuation Controller State and Visualforce View State

Controller state and view state are distinct. Controller state for a continuation consists of the serialization of all controllers that are involved in the request, not only the controller that invokes the continuation. The serialized controllers include controller extensions, and custom and internal component controllers. The controller state size is logged in the debug log as a USER_DEBUG event.

View state holds more data than the controller state and has a higher maximum size (135 KB). The view state contains state and component structure. State is serialization of all controllers and all the attributes of each component on a page, including subpages and subcomponents​.​ Component structure is the parent-child relationship of components that are in the page. You can monitor the view state size in the Developer Console or in the footer of a Visualforce page when development mode is enabled. For more information, see “View State Tab” in the Salesforce Help or refer to the Visualforce Developer’s Guide.

Previous
Next