# Best practices for quotas, transactions and scalable code

*B2C Commerce Developer Study Guide · Application Development · Last updated November 3, 2026 · https://www.certifyforce.com/study-guide/b2c-commerce-developer/application-development/best-practices-for-quotas-transactions-and-scalable-code*

How to spot and fix B2C Commerce code that breaks the documented performance and stability standards: quota violations, search post-processing, variant loops, live calls, long-running controllers, oversized transactions, shared-data writes and SFRA anti-patterns.

- Certification: Salesforce B2C Commerce Developer
- Exam section: Application Development
- Study guide: https://www.certifyforce.com/study-guide/b2c-commerce-developer

**Official exam objective:**

> Given code that violates documented best practices, identify the issues and modify the code to conform with best practices including performance and scalability.

## What the exam expects

- Read a quota status or quota exception and pick the documented response: correct the code, never catch the exception.
- Replace search post-processing, variant loops and unpaged result sets with query criteria, index-friendly APIs and paging.
- Keep storefront requests fast: no live third-party calls on busy pages without a low timeout, no long-running work, light OnSession and OnRequest logic, cacheable GET routes.
- Keep writes safe: small transactions, shared data read-only in storefront requests.
- Flag SFRA anti-patterns: controllers calling controllers, pipelets with script equivalents, `pdict` misuse, edited base cartridges.

Key terms: **quota** (a monitored limit on memory, API calls or object counts in custom code); **enforced quota** (one whose limit throws an exception); **touched business objects** (the persistent objects a request loads or changes); **shared data** (catalogs and prices that every shopper reads); **customer-specific data** (profiles, carts, orders).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Warning threshold | 60% of the quota limit | [Governance and Quotas](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-governance-and-quotas.html) |
| Enforced quota exceeded | Exception stops the operation; storefront shows the general error page | [Governance and Quotas](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-governance-and-quotas.html) |
| Softening | Production: Salesforce Support only; sandbox: import settings from production | [Governance and Quotas](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-governance-and-quotas.html) |
| Object quota status | Updated with up to a 20-minute delay | [Governance and Quotas](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-governance-and-quotas.html) |
| Page size example | Maximum of 120 products per page | [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html) |
| Live call timeout | Low, for example 1 second | [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html) |
| Browser connection | Closed by the web tier after 5 minutes | [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html) |
| Transaction size | Up to 1,000 modified business objects | [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html) |
| OnSession and OnRequest | Limit logic over 10 ms | [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html) |
| Page cache | GET only; POST never cached | [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html) |
| ISML output limit | 10 MB, then processing is canceled | [Development Best Practices](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-best-practices.html) |
| Script timeouts | Controller requests 5 minutes; OCAPI hooks 30 seconds | [Scripts](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-working-with-scripts.html) |

## Check yourself

- When are the Private Keys and Certificates quotas updated?
- Why can't quota settings be imported to make a production instance softer?
- What happens when an ISML template generates more than 10 MB of output?
- When may order processing jobs start modifying a new order?

## Sources

- [Site Performance](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-site-performance.html)
- [Governance and Quotas](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-governance-and-quotas.html)
- [Development Best Practices](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-best-practices.html)
- [Scripts](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-working-with-scripts.html)
- [Customize SFRA](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-customizing-sfra.html)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 13 linked practice questions, and unlimited timed mock exams are included with the B2C Commerce Developer pack (USD $19): https://www.certifyforce.com/practice-exams
