Performance Optimization
Baseline: main 23.0+. Complements skills bitrix-caching, bitrix-sessions, and bitrix-database.
Composite Site
Technology caching static HTML while loading dynamic blocks via AJAX. Kernel entry points: \Bitrix\Main\Composite\Engine, \Bitrix\Main\Composite\Responder.
- Mark dynamic zones:
<div data-dynamic="true">...</div>or frame mode APIs. - Enable in Admin → Settings → Composite Site (Autocomposite or Composite mode).
- Configure NGINX to serve composite cache pool directly.
- Clear component cache before enabling.
Modes:
- Autocomposite — kernel auto-detects static/dynamic.
- Composite — manual zone configuration.
NGINX: point try_files to the composite cache pool directory (BitrixVM: Configure nginx to use composite cache).
Do not put personalized data in static zone (cart, user name, permissions).
Query Optimization
- Limit ORM
selectfields. - Use indexes matching
filter/ordercolumns. - Avoid N+1 —
fetchCollection()with relations. - Batch operations instead of per-row updates.
- Enable ORM query cache where appropriate.
- Use
SqlTrackerin dev to find slow queries (skillbitrix-database).
Replication and Clustering
- MySQL master-slave for read scaling.
- Extra connections via
.settings.phpconnectionsand\Bitrix\Main\Data\ConnectionPool(Application::getConnectionPool()/Application::getConnection('name')). - Read-only analytics queries → separate connection.
Sharding
Horizontal partitioning for very large tables (enterprise scenarios). Kernel support varies by edition.
Hot/Cold Sessions
Related to separated session mode (bitrix-sessions):
- Hot data (kernel
$_SESSION['BX']) → encrypted cookies. - Cold data → Redis/DB backend.
- Reduces storage round-trips on every hit.
Checklist
- Composite tested with all dynamic blocks (cart, auth, personal).
- NGINX composite cache configured in production.
- Slow queries identified and indexed.
- Session backend matches load (Redis for high-traffic).
- File cache replaced with Redis/Memcached in production.