Sub topic 2
Multi-Tenant SaaS and the Platform Model
This chapter explains how Salesforce runs many customers on shared infrastructure, and why that design shapes everything else you will meet: orgs, editions, limits, and metadata. It assumes you know what a CRM does, how SaaS differs from software you install yourself, and what database tables and records are.
Software as a service on shared infrastructure
Salesforce is delivered as software as a service (SaaS). Customers do not install or patch anything. They sign in through a browser, a mobile app, or an API, and Salesforce runs the servers, storage, upgrades, and backups.
Many SaaS products work this way. What sets Salesforce apart is that it is also a platform as a service (PaaS). Customers can configure the applications and also build new ones on the same infrastructure. Those custom applications run beside the standard CRM features and use the same security, data model, and user interface.
So there are two layers:
- Applications. Sales, Service, and similar products that are ready to use.
- Platform. The shared services underneath: the data model, security, automation tools, APIs, and a place to run custom code.
What multi-tenant means
In a single-tenant design, each customer gets a dedicated copy of the application and its database. In a multi-tenant design, many customers share one running application and one set of infrastructure. Each customer is a tenant. Think of an apartment building: the tenants share the plumbing and the structure, but each has a locked unit.
In Salesforce, a tenant's private space is called an org. The next chapter covers orgs in detail. For now, treat an org as one customer's isolated slice of the shared system.
How isolation works
Sharing hardware does not mean sharing data. The platform tags every record with the identity of the org that owns it, and every query runs with that org's identity applied. A user in Org A cannot read Org B's records, even when both orgs are stored in the same database tables on the same instance.
Applications you build are isolated the same way. Your configuration and code belong to your org alone.
Why Salesforce chose this design
Multi-tenancy has practical consequences for customers:
- Upgrades happen once. Salesforce releases new versions for everyone on a regular schedule. There are no per-customer upgrade projects.
- Lower cost. Shared infrastructure spreads the operating cost across many customers.
- Consistent behavior. Everyone runs the same core code, so documentation and skills transfer from one org to another.
- Backward compatibility. Because customers cannot choose when to upgrade, Salesforce works hard to keep existing customizations working across releases.
The cost of sharing: governor limits
If tenants share resources, one tenant must not be able to use so much that the others suffer. Salesforce prevents this with limits enforced by the platform. The most visible ones are governor limits, which cap what a single piece of code can do in one transaction. Examples include the number of database queries, the number of records processed, and the processing time.
Limits also apply at the org level, for example daily API request allowances and data and file storage. These vary by edition and by purchased add-ons. A later chapter in this tutorial covers how editions change them.
The metadata-driven model
Multi-tenancy raises a question. If every customer runs the same underlying code, how can each one have different objects, fields, page layouts, and rules?
The answer is metadata. Metadata is data that describes the structure and behavior of an org. A custom field, a validation rule, and a page layout are all stored as metadata, not as changes to the platform's code. The runtime engine reads an org's metadata when a request arrives and behaves accordingly.
This gives you two kinds of content in every org:
| Kind | What it holds | Example |
|---|---|---|
| Data | The business records users create | A specific Account named "Acme" |
| Metadata | The definitions that shape how the org behaves | The Account object, its fields, and its layouts |
Because customizations are metadata, they can be created through point-and-click tools, moved between orgs, and kept intact through upgrades. The next chapters cover this distinction further, including why it matters for sandboxes.
Configuration and code on the platform
The platform supports a range of customization, from no code to full code:
- Declarative tools (clicks, not code). Custom objects, fields, validation rules, and Flow automation. These are the first choice when they meet the need.
- Programmatic tools (code). Apex, which is Salesforce's server-side language, plus Lightning Web Components for the user interface. Code runs inside the multi-tenant runtime, which is why governor limits apply to it.
- APIs. REST and SOAP APIs let outside systems read and write org data, subject to the org's API limits.
You can see the platform model at work with a short query. SOQL (Salesforce Object Query Language) reads records in an org. The statement below reads the one Organization record that every org has. Run it in the Developer Console's Query Editor or with the CLI:
SELECT Id, Name, OrganizationType, IsSandbox, InstanceName FROM OrganizationThe result describes only your org. The query has no way to see another tenant's rows, which is the isolation described above. The last chapter in this tutorial uses this query and Salesforce CLI commands to inspect an org's type and edition in detail.
How the pieces relate
The terms in this chapter fit together as follows.
- The platform is the shared, multi-tenant foundation.
- Cloud products are applications built on that foundation. A later chapter defines clouds and notes that some run on separate platforms.
- An org is one customer's isolated tenant. It holds that customer's data and metadata.
- An edition determines which features and limits an org gets.
Common misunderstandings
- "Multi-tenant means my data is mixed with others'." Records share physical storage, but the platform enforces strict separation by org identity.
- "I can delay an upgrade." Major releases arrive on Salesforce's schedule for all customers. You can test in a sandbox, but you cannot opt out.
- "SaaS and PaaS are different products." They are two uses of one platform. The same org can run standard applications and custom ones.
- "Limits only matter for large companies." Governor limits apply to every org, including a free Developer Edition org. Small test data often hides problems that appear at scale.
- "Customizations change Salesforce's code." They change your org's metadata. The shared code stays the same for everyone.
Failure modes to expect
Knowing the model helps you diagnose problems:
- A limit error in production but not in a test. The test used little data. Production sent more records through the same code path. Look for queries or updates inside loops.
- A feature missing in one org but present in another. The orgs have different editions or add-ons, so the same metadata or code may not be supported. Check the edition before assuming a bug.
- Slow responses during heavy use. Shared resources are protected by throttles. Reduce request volume or batch the work.
- Behavior changes after a release. Test in a sandbox during the preview window that Salesforce announces before each release.
Exercise
A teammate says, "Since Salesforce is multi-tenant, any customer could see our records if the query were written badly." Explain why this is wrong, and name the mechanism that lets each org still have its own custom fields.
Show answer
Every record is tied to the org that owns it, and the platform applies that org's identity to every query. A query run in your org cannot return another org's rows, however it is written. Each org can have its own fields because customizations are stored as metadata, not as changes to shared code. The runtime reads the org's metadata and behaves according to it.
Exercise
A trigger processes 5 records in a test without errors. In production, a data load of 5,000 records makes it fail with a limit error. Why does this happen on a multi-tenant platform, and what should you do?
Show answer
Governor limits cap the resources one transaction can use, so that no tenant can monopolize shared infrastructure. The code probably does work, such as a query, once per record, so the work grows with the data volume. Rewrite it to handle records in bulk, with one query for the whole set instead of one per record, and test with realistic volumes.