1

Is there a limit on how many times LWC can call an @AuraEnabled action and Apex controller? (Provided we do not get into the long-running Apex issues).

2

Both lightning components and apex are in-house platforms although the connection between them is asynchronous and so you have the scope to directly import apex method definitions. So this will not hamper the performance of other orgs sharing resources and so no limits are enforced. If it was an external system there would have been limits as it would have hampered ability of other orgs sharing resources.

TESTING:
Created below apex method:

@AuraEnabled
public static string getSample(String st){
    return 'sample '+st;
}

And implement below in JS:

i = 0;
connectedCallback() {
    setInterval(() => {
        this.i++;
        console.log('sending ', this.i);
        getSample({ st: 'int' + this.i }).then((resp) => console.log(resp)).catch((err) => console.error(err));
    }, 0);
}

This has successfully run for more than 100,000 times in few minutes (However you can test for more number of times). I thinks its practically impossible to have more than 10,000 apex calls per user in a day considering many invocations on keyup.

  • Hmmm but i can get my users to press buttons calling my apex millions of times from LWC? So if i stay within governor limits on allocations, and performance, the users can use a lot Apex capacity? – zaitsman Jul 22 at 3:03
  • adding the info in answer above – salesforce-sas Jul 22 at 3:55
  • @zaitsman There is caching and boxcar effects that prevent a large number of transactions from occurring at once. You would have to intentionally craft a component that defeats these mechanisms in order to even have a chance of being denied access to resources. Any normal amount of user activity would be allowed. – sfdcfox Jul 22 at 3:57
  • @sfdcfox By using above I observed that only about few 10s of calls are boxcarred every few ms and the results have been returned in same way. Can you pls suggest any improvement in testing methodology? – salesforce-sas Jul 22 at 4:03
  • 1
    @zaitsman A Selenium script to load a million records might even still be fair use, or you could even write an import wizard using VF, Aura, or LWC, and it would probably sail by just fine. – sfdcfox Jul 24 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.