I was hoping to be able to fire off multiple JavaScript Visualforce remoting calls in parallel and have the execute simultaneously, and for me to deal with the responses asynchronously.
Whilst in practice I can fire these off and get the reponses back (in a random order, as expected) I notice that the execution time of the responses increases for each request that is returned. So much so, in fact, that it is not much quicker to force sequential running of the individual calls.
This graphic shows 3 tests;
- Running 3 calls in parallel with the "buffer" param set to true (so VF remote calls are batched in one HTTP request)
- Running 3 calls in parallel with the "buffer" param set to false (so VF remote calls are sent in parallel as separate requests)
- Running 3 calls in sequence using JavaScript promises.
As you can see with (2) the second call that returns takes 2x as long as the 1st, and the 3rd call takes 3x as much... which leads me to think that although I'm firing the calls in at the same time they are actually being queued and run in sequence.
Does anyone know if this behaviour (in (2)) is to be expected or if there's a way to make the calls run more simultaneously?