bitrix-performance
Bitrix high-load tuning — Composite (dynamic areas, createFrame, StaticArea), query optimization, read replicas via the cluster module. Use when a page or query is slow or when enabling composite.
How do I install this agent skill?
npx skills add https://github.com/bxmaximum/bitrix-framework-skills --skill bitrix-performanceIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides educational content on Bitrix performance optimization techniques and contains no security risks.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Performance
Baseline: main 23.0+ · Verified: main 26.800.0
Caching itself: bitrix-caching. SQL profiling: bitrix-database (SqlTracker). Sessions: bitrix-sessions.
Composite
Static HTML of the page is served from the composite cache (NGINX can serve it directly); dynamic areas are fetched by a follow-up request. Enable in Settings → Composite site. Kernel: Bitrix\Main\Composite\Engine, Page, StaticArea, BufferArea.
In a component template ($this is CBitrixComponentTemplate):
$this->setFrameMode(true); // template is composite-compatible
$frame = $this->createFrame()->begin('Loading…'); // stub shown in the cached HTML
echo htmlspecialcharsbx($arResult['USER_NAME']); // dynamic content
$frame->end();
Long stub markup: begin() → dynamic content → beginStub() → stub HTML → end().
Outside components (site template header, init.php helpers):
use Bitrix\Main\Composite\StaticArea;
$area = new StaticArea('vendor_cart_counter');
$area->setStub('<span>0</span>');
$area->startDynamicArea();
echo (int)$basketCount;
$area->finishDynamicArea();
- Per-component switch without code: params
COMPOSITE_FRAME_MODE(A/Y/N) andCOMPOSITE_FRAME_TYPE(AUTO,STATIC,DYNAMIC_WITH_STUB,DYNAMIC_WITHOUT_STUB). - Exclude a page:
\Bitrix\Main\Composite\Page::getInstance()->markNonCacheable(). - There is no
data-dynamicattribute and nocomposite_frame_modepage property. - Never leave personal data (name, cart, rights, CSRF tokens) in the static part. Test every dynamic area as a guest and as a user.
Queries
- Select only needed fields; index columns used in
filter/order. - No N+1:
fetchCollection()+fill(), or relations inselect(bitrix-orm). - Batch writes (
addMulti,updateMulti) instead of per-row loops. - ORM query cache for repeated reads; tagged data cache for assembled results.
Read replicas
With the cluster module, SELECTs from query() may go to a slave. Pin read-after-write to the master:
$pool = \Bitrix\Main\Application::getInstance()->getConnectionPool();
$pool->useMasterOnly(true);
try
{
$row = OrderTable::getById($id)->fetch();
}
finally
{
$pool->useMasterOnly(false);
}
Extra DBs (analytics, reports): a named connection in connections (bitrix-database).
Checklist
- Every composite dynamic area checked as guest and as logged-in user.
- NGINX serves the composite cache in production.
- Slow queries found with SqlTracker and indexed.
- Cache and sessions on Redis/Memcached, not files, under load.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/bxmaximum/bitrix-framework-skills/bitrix-performance">View bitrix-performance on skillZs</a>