Atlas 3: Atlas batch calls are not always faster

Atlas provides you batch
call feature
which combines multiple web service calls into one
call. It works transparently, you won’t notice anything nor do you
need not write any special code. Once you turn on the Batch
feature, all web service calls made within a duration gets batched
into one call. Thus saves roundtrip time and total response
time.

The actual response time might be reduced but the perceived
delay is higher. If 3 web service calls are batched, the 1st call
does not finish first. All 3 calls finish at the same time. If you
are doing some UI updates upon completion of each WS calls, it does
not happen one by one. All of the calls complete in one shot and
then the UI gets updated in one shot. As a result, you do not see
incremental updates on the UI, instead a long delay before the UI
updates. If any of the call, say the 3rd call downloads a lot of
data, user sees nothing happening until all 3 calls complete. So,
the duration of the 1st call becomes nearly the duration of the sum
of all 3 calls. Although actual total duration is reduced, but the
perceived duration is higher. Batch calls are handy when each call
is transmitting small amount of data. Thus 3 small calls gets
executed in one roundtrip.

Let’s work on a scenario where 3 calls are made one by one.
Here’s how the calls actually get executed.

The second call takes a bit time to reach the server because
first call is eating up bandwidth. The same reason it takes longer
to download. Browsers open 2 simultaneous connections to the
server. So at a time, only 2 calls are made. Once the second/first
call completes, the third call is made.

When these 3 calls are batched into one:

Here the total download time is reduced (if IIS compression
enabled) and there’s only one network latency overhead. All 3 calls
get executed on the server in one shot and the combined response is
downloaded in one call. But to the user, the perceived speed is
slower because all the UI update happens after the entire batch
call completes. The total duration the batch call will take to
complete will always be higher than 2 calls. Moreover, if you do a
lot of UI update one after another, Internet Explorer freezes for a
while giving user a bad impression. Sometimes expensive update on
the UI makes the browser screen go blank and white. But Firefox and
Opera does not have this problem.

Batch call has some advantages too. Total download time is less
than downloading individual call responses because if you use gzip
compression in IIS, the total result is compressed instead of
individually compressing each result. So, generally batch call is
better for small calls. But if a call is going to send a large
amount of data or is going to return say 20KB of response, then
it’s better not to use batch. Another problem with batch call is,
say 2 calls are very small but the 3rd call is quite big. If these
3 call gets batched, the smaller calls are going to suffer from
long delay due to the 3rd larger call.

6 thoughts on “Atlas 3: Atlas batch calls are not always faster”

  1. Omar bhai

    all your article are WOW!!! It's true ATLAS is making developers life easier but still there is a bad effect!! I tried a lot to find some tutorials to customize my own ajax fuctionalities within asp.net starting from httmrequest to everything but i failed. By the way you are not comming to AIUB these days.

Leave a Reply