Is Boxcaring Removed from LWC Components?

Question:
I have been working with LWC implementations and noticed a behavior change. In my testing, when using imperative Apex method calls in a Lightning Web Component (LWC), there is no “boxcaring” happening, and both imperative and wired Apex calls are invoked in parallel without any background action. This is surprising because I was testing it in a Developer Org on the Winter ’20 release, which still had the boxcaring behavior for Apex calls.
Does this indicate that Salesforce has released an update that removes boxcaring from LWC components? I couldn’t find any official documentation that mentions this change, so I’m wondering if this is a new behavior introduced in a more recent release, or if there’s something else causing this change.
Answer:
Major design changes rolled out in Winter ’20 affected how server calls are made in Salesforce. In Lightning Web Components (LWC), server calls are executed as separate parallel requests at the Lightning Data Service (LDS) layer. However, the boxcarring effect occurs at the Aura Data Service (ADS) layer, which serves as an intermediary between LDS and the server. This happens when all available parallel XMLHttpRequests (XHRs) from the browser to the server are in use.
Most modern browsers support up to six parallel XHRs. When ADS has already initiated five concurrent XHRs, the sixth request triggers boxcarring, which combines all queued server calls from LDS and sends them in a single invocation. While you may observe only six XHRs in the browser’s network tab, individual Apex logs are generated for each request in the Salesforce Developer Console.
This behavior is not officially documented because Salesforce continues to enhance server calls via LDS, and this implementation is not final. Over the past several months, no notable changes to boxcarring have been observed. The intricate mechanics of how Lightning Experience (LEX) and LWC operate remain largely unexplained, which can influence the behavior users encounter.
When a page containing a large number of components with various wire or imperative calls is loaded, LEX and LWC infrastructure behaves as follows:
- Up to five wire or imperative calls initiated simultaneously are processed in parallel. Reports indicate that six or more calls might be processed concurrently, although this depends on specific scenarios and may have changed over time.
- Additional calls made “at or around the same time” are boxcarred, combining them into a single server invocation.
For example, in a grid component populated with visual representations of SObjects, each cell component performs its own imperative call to fetch data. During the initial rendering, only five calls execute simultaneously, rendering their respective cells. The remaining cells wait until one of the ongoing calls completes, at which point the queued calls are collected and sent to the server in a single batch. This illustrates boxcarring in action.

The browser’s implementation of parallel AJAX calls to the same host further influences this behavior. For instance, Chrome allows six parallel calls, which can lead to variations in behavior across different browsers.
However, when the grid is first being rendered in the LEX Object Record Page, we see:

To avoid boxcarring, keep the number of simultaneous server calls to five or fewer. This strategy has been successfully applied in components where imperative calls are deliberately orchestrated to execute in small batches. Any remaining requests are delayed and initiated only when an existing request finishes.
If you look at the network traffic you see the following:

You can see that the first 5 wire/imperative calls are allowed to run in parallel. Once one of these has finished (so there is an available “thread” from the LEX perspective) you then see that almost all the other requests get collected together and run as a single invocation to the server – this is the boxcarring in action.
Transform Your Career with Salesforce Training in Bangalore
Unlock the doors to a successful career with our industry-driven Salesforce online training . Our program is designed to help you become an expert in the Salesforce ecosystem, offering specialized tracks in Admin, Developer, and AI. With expert guidance for certification and thorough interview preparation, we ensure you’re well-equipped to advance in your career.
Our hands-on learning approach provides practical skills to tackle real-world challenges, setting you apart in the job market. Salesforce training in Bangalore With comprehensive class materials, personalized mentorship, and a focus on practical learning, we provide everything you need to excel.
Take the first step towards transforming your career—join our free demo class today and experience the difference!!!
Related Posts: 61 LWC Lightning Web Component Interview Questions and Answers
What are Lightning Web Components?