Scalability of the Visualforce page

Scalability & data limits of the Visualforce page

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.

1. Buffer Size

What is the largest amount of data that can be sent to Apex code from a Visualforce page?

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.

Associated errors

None. Failure was silent.

2. Displayed Text

What is the largest amount of plain text data that can be sent to the screen in a single text area?

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.

Associated errors

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.

3. Table Size

What is the largest table that can be rendered on a Visualforce Page?

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.

Associated Errors

Collection size 1,024 exceeds maximum size of 1,000.

So, in summary:

  • Practically speaking, the largest amount of text that can be sent to Salesforce from a textarea element is around 2 million characters.
  • The largest amount of text that can be displayed in one textarea element is 6 million characters.
  • A Visualforce-rendered table can have at most 1000 rows.


Read more about Salesforce Development

Want to see a demo? We can help you with that.

Let us know below what you would like to see and we'll coordinate with you to schedule up a demo.