Summary

In this chapter, we have learned that understanding not just the volume of records, but also how data within them is dispersed can affect the need for indexes to ensure that queries perform without having to resort to expensive table scans or, in the case of Apex Trigger, runtime exceptions. Ensuring that you and your customers understand the best way to apply indexes is critical to both interactive and batch performance.

Asynchronous execution contexts open up extended and flexible control over the governors available in the interactive context, but need to be designed from the beginning with careful consideration for the user experience, such that the user is always aware of what is and is not going on in the background. Messaging is the key when there is no immediate user interface to relay errors and resolve them. Don't depend on the Apex Jobs screen; instead, try to contextualize error information through custom log objects related to key records in your application that drive background processes, allowing related lists to help relay information in context about the state and result of jobs.

Execution of background processes is not scoped to your application but affects the whole subscriber org, so the frequency in which your application submits processes to the background needs to be carefully considered. Understand the difference between application and end user jobs; the latter are more likely to flood an org and cause delays or, worse, result in end users having to retry requests. Consider leveraging Apex Scheduler to implement your own application queue to stage different work items for later processing. Salesforce allows up to Batch Apex 100 jobs to queue, giving the ability for the subscriber to control priority. Queueables offer more flexibility than @future and thus recommended. Queueables support more concurrent jobs and dequeues faster, though are less elastic in terms of variables volumes than Batch Apex.

In the next chapter, we will be moving out of the packaging org as the primary development environment and moving into a place that supports multiple developers and an application development life cycle backed by Source Control and Continuous Integration to ensure that you have a real-time view on test execution and auditability over your application's source code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.163.250