Configuring Composite Cache in 1C-Bitrix
Composite mode is one of the few Bitrix tools capable of reducing TTFB from 800 ms to 20–50 ms without changing the server infrastructure. The principle: the first request to a page is executed fully (PHP + DB), the result is saved as static HTML in /bitrix/cache/html/, and subsequent requests are served directly from the file via nginx — PHP is not invoked at all. Dynamic blocks (cart, username, stock quantities) are replaced by AJAX requests after the page loads.
Requirements and Preliminary Setup
For composite mode to work:
- A "Business" licence or higher (unavailable on "Start" and "Standard")
- The
bitrix.compositemodule (installed from the Marketplace; built in on older versions) - Correct nginx configuration to serve the HTML cache without PHP
The nginx configuration is the critical point. Without it, composite mode works at half capacity: HTML is saved, but PHP is still invoked to check the cache. The server block needs a condition that checks for the cache file and serves it directly:
set $composite_cache "";
if (!-f $document_root/bitrix/cache/html/$host$request_uri/index.html) {
set $composite_cache "no";
}
if ($composite_cache = "") {
rewrite ^ /bitrix/cache/html/$host$request_uri/index.html last;
}
The exact configuration depends on the Bitrix version and site structure — the official documentation provides several variants for different URL schemes.
Marking Dynamic Zones
The primary cause of composite mode problems is incorrect marking of dynamic blocks. Everything that must not end up in the static cache is wrapped in the bitrix:nocache tag:
<?$APPLICATION->IncludeComponent("bitrix:sale.basket.basket", ".default",
array("CACHE_TYPE" => "N"), false);?>
Or in the component template via $this->addExternalCSS and explicit markers. In modern projects, dynamic zones are moved into separate AJAX endpoints and loaded via BX.ajax after the page loads.
Typical blocks requiring nocache: cart and item counter, authorisation block / username, comparison widgets, personalised recommendations, stock quantities if they change frequently.
Case Study: News Portal on Bitrix
A portal with 40,000 unique daily visitors, predominantly anonymous users. TTFB on article pages — 650–900 ms, server under load during peak hours. After configuring composite mode for article pages (only the "latest comments" block is dynamic, loaded via AJAX) TTFB dropped to 15–30 ms. Load on PHP-FPM fell so dramatically that the number of workers had to be reduced — they were sitting idle.
Limitations and Anti-Patterns
Composite mode does not work for authenticated users by default — they always go through the full PHP cycle. There is a personalisation mode (bitrix:composite.async), but it requires dedicated implementation. Also, pages with POST parameters and pages on the exclusion list (/personal/, /order/) are cached.
A common mistake — enabling composite globally without nocache markup in the right places. Result: one user's data ends up in cache and is displayed to another user. This is not discovered immediately and creates serious security issues.
Configuration Phases
Configuration takes 1 to 3 days depending on the complexity of the template and the number of dynamic blocks. Includes a component audit on the page, nginx configuration, nocache zone markup, migrating dynamic blocks to AJAX, and testing under various scenarios (anonymous, authenticated, mobile).







