function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SumitkSumitk 

Maximum simultaneous ajax requests in Visualforce page

I need to make a lot of Ajax request in my VFPage so I made Ajax request in a for loop. But in network tab in chrome it looks like only 4 Ajax requests can be made at a time and rest of the request are queued. How can I increase that or is there another way to achieve the same.
AbhishekAbhishek (Salesforce Developers) 
The AJAX Toolkit uses SOAP API calls. SOAP calls always have a maximum limit of 50MB. However, it is also XML-based, which restricts the available characters you can use, so the file has to be Base-64 encoded. This puts the final limit at around 37 MB of binary data, as you've observed. The SOAP protocol itself consumes some bytes, so the actual limit is going to depend on several factors, like any extra headers you might use, but should be somewhere around 37,440,000 bytes, as you've observed.


Use the REST API to upload up to 2GB. You can read more about it in Insert or Update Blob Data (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm), found in the REST API documentation. Depending on what you're uploading, there are different parameters/headers/etc you may need. The examples are kind of lengthy, so I'm not including them here, but it should be pretty self-explanatory if you look at the documentation.


For further reference, you can check this blog too,

https://trungk18.com/experience/limit-the-number-of-simultaneous-ajax-requests/

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.