Sanjaay Gowda T S
Salesforce, Inc. practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Schedule tenant jobs fairly

Software engineeringHardConcept

Original practice scenario inspired by Salesforce, Inc.'s public business context; this is not a reported interview question or a description of its internal systems. A fictional multi-tenant CRM service processes background imports. One tenant submits thousands of jobs and delays small imports for everyone else. Describe a fair queue implementation and tests without claiming any particular vendor architecture.

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Separate per-tenant admission from global worker capacity. A single FIFO queue lets a large tenant dominate waiting time even when every individual job is valid.

Work through it

  1. Maintain bounded tenant queues and choose a scheduling policy such as round-robin or weighted deficit scheduling. Define concurrency and cost limits at the tenant level.
  2. Make job execution idempotent and preserve retry attempt state. A failed job should not bypass fairness by repeatedly returning to the front of a global queue.
  3. Test a noisy tenant, many small tenants, a long-running job, repeated failures, and worker restarts. Measure per-tenant wait time and completion fairness alongside total throughput.

Tradeoffs to discuss

  • Strict fairness can reduce throughput when job costs differ. Estimated-cost scheduling helps but must tolerate inaccurate estimates and avoid starving expensive legitimate work.

Common pitfalls

  • Limiting submission rate alone does not control queued backlog.
  • A global average latency hides a tenant that is consistently starved.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub