I've read that the really complex solutions such as sharding or distributed transactions/databases are rarely needed. Someone could spend the entire career without seeing or needing that kind of complexity.
I agree. My practical experience for the vast majority of applications is that scalability is usually resolved with "boring" solutions, which is a very good thing!
In Salesforce, as well as in other platforms, we can categorize the challenges in 2 sides: data and processing.
Thus a high percentage of performance challenges can be solved with the following 4 simple levers.
On the data side:
๐น Cache - Avoid redundant queries and recalculations
๐น Indexes - Speed up queries where possible
On the processing side:
๐น Queues - Make processing asynchronous
๐น More servers - Offload heavy work
How that would translate into Salesforce solutions?
(these lists are not exhaustive)
๐ถ Cache โ Platform Cache, Custom setting / metadata (read data without SOQL), in-memory caching using static variables, CDN or client-side cache for public-facing pages or integrations.
๐ถ Indexes โ External id indexing, Custom indexes on selective filters in SOQL, Skinny tables, Denormalize data to avoid costlier joins, SOSL for full-text/multi-object queries, Archival strategy to reduce table size.
๐ถ Queues โ CDC/Platform Events, Queueable/Batchable/Scheduled Apex, Asynchronous Flows, @Future methods for fire-and-forget patterns, external message queues (Kafka, Pub/Sub, AWS SQS).
๐ถ Run more servers โ distribute processing to Heroku, MuleSoft, AWS (SF Private Connect, Event Relay), or other external services, use platform events with asynchronous Apex to emulate horizontal scaling, multi-org architectures.
What other scalability solutions can you think of?
