SalesforceWizard

Asynchronous Apex interview questions

The classic question is "which async option would you use here, and why?" These answers compare future methods, Queueable, Batch and Scheduled Apex the way an interviewer expects.

0 of 10 reviewed
On this page (6 sections)Interview questionsCommon MistakesRelated Async Apex Interview QuestionsFrequently Asked Questions about Async Apex InterviewsRelated CertificationsRelated Resources

'Walk me through async Apex' is one of the most common opening questions in PD2 interviews. The answer is more than naming four patterns: interviewers want to hear when each one is correct, what fails in production, and how you monitor them. Below are the questions and the practical answers I'd give.

01

What are the four async Apex patterns and when to use each?

Future (legacy, primitives only), Queueable (modern default, supports complex types and chaining), Batch (large data volumes 50K+), Scheduled (time-based execution). Real rule of thumb: Queueable for most things, Batch for volume, Scheduled for cron jobs, Future only for legacy.

02

Why do we need async Apex at all?

Three reasons: callouts from triggers (only allowed async), heavy processing without blocking the user, and getting fresh governor limits in a new transaction. Without async, every long-running operation would freeze the UI.

03

Mixed DML: how does it relate to async?

Updating a setup object (User, Group) and a non-setup object in the same transaction throws Mixed DML. The fix is to move one DML to a future method, Queueable, or System.runAs in tests. Async runs in a separate transaction so the rule doesn't apply across them.

04

How do you monitor async jobs?

Query AsyncApexJob: JobType, Status, ExtendedStatus, ApexClass.Name, NumberOfErrors, JobItemsProcessed, TotalJobItems. Most ops dashboards build an LWC on top of this for real-time visibility.

05

What is the daily async Apex limit?

250K async executions per 24-hour rolling window, per org per license tier. Counts include Future, Queueable, Batch, and Schedulable executions. Hitting it silently blocks new jobs: monitor with Limits.getAsyncCalls() or daily usage reports.

06

How do you choose between Queueable and Batch?

Queueable: small-to-medium async work with full DML/SOQL limits, chaining, custom types. Batch: 50K+ records, chunked processing, fresh limits per chunk. If you need both, kick off Batch from a Queueable (or vice versa).

07

Can async Apex jobs see each other's data?

Yes once committed. Each async job is a fresh transaction so they read whatever is currently in the database. To pass data between jobs use job parameters or persistent storage (custom objects, custom settings).

08

How do you test async Apex?

Wrap async calls between Test.startTest() and Test.stopTest(). At stopTest all queued async jobs run synchronously so assertions work. Always assert post-state, not just that the job was enqueued.

09

Common production issues with async Apex?

Hitting daily 250K limit, silent failures without logging, infinite chains, mixed DML between sync and async, race conditions when two async jobs touch the same record. Always log to a custom error object and add concurrency control.

10

Best architecture for an integration-heavy org using async?

Queueable for individual transaction async (single record callouts), Batch for nightly syncs and bulk loads, Scheduled to kick off Batches on a cron. Wrap everything in a base class with retry, logging, and dead-letter handling. Monitor via custom dashboard on AsyncApexJob.

Common Mistakes

Mixing patterns randomly. Pick one async strategy per use case to keep limits predictable.

No monitoring. AsyncApexJob is the single most-ignored table in production.

Silent failures. Always log async errors to a custom object.

Frequently Asked Questions about Async Apex Interviews

Are Platform Events async?

Yes, subscribers run in their own async transaction with fresh limits.

Can Continuation be considered async?

Sort of; it's an async-style callout pattern for long-running external calls in Visualforce/LWC.

Is Change Data Capture async?

Yes, CDC events are processed asynchronously with their own subscriber context.

Can I prioritise async jobs?

Not officially, but Queueable usually runs faster than Batch in light queues.

What logging do you recommend for async?

A custom Apex_Error_Log__c object capturing class, method, error message, stack trace, and input parameters.

Async Apex is tested heavily in PD1, PD2 and Application Architect. See certification guides.

Chat on WhatsApp