Since Salesforce runs on a multitenant platform which relies heavily on shared computing resources, it is essential to understand the limitations imposed when working with large amounts of data. Salesforce outlines a number of these limits on its governors and limits page.
To further explore the limits of salesforce and gain hands-on insight into how Salesforce applications could fail under conditions of very large data, we completed several experiments using simple Visualforce pages and controllers.
Our test code is available at this Bitbucket repository.
Apex and Visualforce use UTF-8 to represent Strings. This means that each character in a String occupies 1 byte of memory.
To answer this question, we created a Visualforce page with a textarea input, text output, and submit button.
When the user enters text into the text area and clicks the ‘Submit’ button, the server re-renders the text output to display the length of the string. If the server responds with the length of the string, the server has acknowledged it.
For strings larger than 2 MB, the page slows down noticeably. For strings between 16 MB and 32 MB, the output text is not re-rendered, meaning that the hard limit most likely falls within this range.
None. Failure was silent.
We created a Visualforce page with a text input for string length, a text output for string length, and a text output for a string.
When a number is submitted from the textual input, a string is printed to the textarea output and the length of the string is printed to the text output. When the ‘Double Size’ button is clicked, the length of the string is doubled.
Strings longer that 6 million characters, or 6 MB, may not be printed to any individual textarea.
Too many script statements: 200001
The above error arises when a value greater than 200,000 is submitted. This error occurs since (1) the string is created using the naive approach of appending one character at a time in a for loop and (2) every execution of a for loop counts towards the total number of script statements.
String length exceeds maximum: 6000000
This error occurs when the size of the string associated with the text area is greater than 6 million characters.
The Visualforce page consists of a textual input element, a submit button, and a table.
When the user enters a number in the text area input and clicks ‘Submit’, the table is re-rendered to display the specified number of rows.
A hard error is thrown when a table size of 1024 is used. This error indicates a maximum table size of 1000 rows.
Collection size 1,024 exceeds maximum size of 1,000.
–SC
Read more about Salesforce Development