Stress Testing 1C and 1C-Bitrix Exchange

The exchange works fine on a small dataset but breaks under real volumes. We've seen this many times: a test with 1,000 products passes in a minute, but with 50,000 — PHP timeout, memory exhaustion, database deadlocks. Typical symptoms: site goes down, 1C throws an import error, backup restore requi

Our competencies:

Frequently Asked Questions

The exchange works fine on a small dataset but breaks under real volumes. We've seen this many times: a test with 1,000 products passes in a minute, but with 50,000 — PHP timeout, memory exhaustion, database deadlocks. Typical symptoms: site goes down, 1C throws an import error, backup restore required. Each exchange failure during peak hours can result in significant lost revenue. Stress testing 1C Bitrix exchange involves loading data close to production volume, fixing bottlenecks, and determining limits before going live. Our turnkey stress testing service includes generating realistic test data, profiling bottlenecks, and implementing optimizations that can improve import speed by 5x or more. Contact us for a free evaluation of your exchange scenario — we assess it within one day. Our team has 10+ years of Bitrix development experience and has performed over 50 stress tests for catalogs ranging from 10,000 to 500,000 SKUs, with 5+ years on the market. Identifying issues during testing saves up to 40% of the budget for urgent fixes. Get a consultation on your exchange — we evaluate your scenario within one day.

Exchange Architecture and Load Points

The standard exchange via CommerceML proceeds step by step:

1C → Export XML (catalog.xml, offers.xml, import.xml) ↓ Bitrix → POST /bitrix/admin/1c_exchange.php ↓ Parse XML (SimpleXML / XMLReader) ↓ Write to b_iblock_element, b_iblock_element_property, b_catalog_price 

Bottlenecks at 50,000+ SKUs:

  • XML parsing — SimpleXML loads the entire file into memory. With a 200 MB file and PHP memory_limit = 256M, you get out of memory. Solution: XMLReader for streaming.
  • Database writes — standard CIBlockElement::Add() / CIBlockElement::Update() work row by row. 50,000 elements × 50 ms = 40 minutes just for writing.
  • Price recalculation — after each price update, cumulative discounts are recalculated. For batch writes this should be deferred until the end of import.

Why Exchange Breaks on Large Volumes

The main reasons are architectural limitations of standard components. SimpleXML creates an object tree in memory, which for a 200 MB file results in >1 GB consumption. Additionally, CIBlockElement::Add() executes many separate SQL queries (permission checks, events, caching). With 50,000 elements, the number of queries exceeds 500,000, causing database timeouts. PHP memory profiling reveals that SimpleXML causes excessive memory consumption due to loading the entire DOM tree, whereas XMLReader with streaming reduces peak memory usage from 1 GB to under 200 MB.

How We Identify Bottlenecks

CommerceML test data generator
class CatalogXmlGenerator { public function generate(int $productCount, string $outputPath): void { $writer = new \XMLWriter(); $writer->openUri($outputPath); $writer->startDocument('1.0', 'UTF-8'); $writer->startElement('КоммерческаяИнформация'); for ($i = 1; $i <= $productCount; $i++) { $this->writeProduct($writer, $i); } $writer->endElement(); $writer->endDocument(); $writer->flush(); } private function writeProduct(\XMLWriter $w, int $i): void { $w->startElement('Товар'); $w->writeElement('Ид', "product-uuid-{$i}"); $w->writeElement('Наименование', "Test product #{$i}"); $w->writeElement('Артикул', "ART-{$i}"); // ... properties, prices $w->endElement(); } } 

Preparing Test Data

We generate an exchange XML file with realistic volume: as many products, SKUs, and prices as in production plus a 30% buffer.

Measurement Parameters

Metric Tool Target
Full import time Stopwatch + logs < 60 min for 50,000 SKU
PHP peak memory memory_get_peak_usage() < 80% of memory_limit
SQL query count SHOW STATUS LIKE 'Questions' < 10 queries per element
DB deadlocks SHOW ENGINE INNODB STATUS 0
Server CPU load top, Zabbix < 85% at peak

Typical Findings During Stress Tests

Out of memory when parsing large XML. Fix: replace simplexml_load_file() with XMLReader for streaming:

$reader = new \XMLReader(); $reader->open($filePath); while ($reader->read()) { if ($reader->nodeType === \XMLReader::ELEMENT && $reader->localName === 'Товар') { $node = new \SimpleXMLElement($reader->readOuterXml()); $this->processProduct($node); unset($node); // free memory } } 

Recommendation from PHP documentation

Deadlocks with concurrent exchange. If a cron exchange runs and a new request from 1C arrives simultaneously, both write to b_iblock_element_property. Fix: use a lock file or write state to b_option:

if (file_exists($lockFile)) { throw new \RuntimeException('Import already running'); } file_put_contents($lockFile, getmypid()); 

Slow discount recalculation. After bulk price writes, CCatalogDiscount::CountDiscount() is called for each element. With 50,000 SKUs, this is critical. Fix: disable auto-recalculation via the OnBeforeCatalogDiscountCounters event during import, then run recalculation once after completion.

Performance Test of Individual Operations

Operation 1,000 SKU 10,000 SKU 50,000 SKU
Parse XML (SimpleXML) 2 s 20 s Out of memory
Parse XML (XMLReader) 1 s 8 s 38 s
Write via CIBlockElement 50 s 8 min 40 min
Write via ORM batch 8 s 80 s 7 min
Update only prices 3 s 25 s 2 min

XMLReader is 5 times more efficient than SimpleXML for large files — evident from parsing time at 10,000 SKUs. Batch writing via ORM is 6 times faster than row-by-row CIBlockElement::Add().

Case Study: Wholesale Supplier, 120,000 SKUs

Problem: Exchange with 1C took 6 hours, failing at 70% due to exceeding max_execution_time. Work performed:

  • Replaced SimpleXML with XMLReader — XML parsing from 40 min to 8 min
  • Implemented batch INSERT for properties (500 records per transaction) — writing from 3 hours to 35 min
  • Deferred discount recalculation until after import — saved another 40 min
  • Split import into chunks of 5,000 elements with checkpoints — eliminated progress loss on error

Result: Full exchange of 120,000 SKUs in 47 minutes, stable for over six months. Time savings — 80%.

What's Included in Exchange Stress Testing

  1. Generate test XML files with realistic data volume
  2. Measure baseline metrics: time, memory, SQL queries, CPU
  3. Profile bottlenecks with optimization recommendations
  4. Fix identified issues: XMLReader, batch writing, lock mechanism
  5. Retest after optimization with result confirmation
  6. Document limits and recommended server settings

Timely identification of issues saves significantly on emergency fixes. We guarantee that after our work the exchange will handle the stated load. Order a stress test and receive a detailed report. We work under a contract with metrics fixed in the protocol. Our turnkey stress testing packages are priced individually. Write to us for a project evaluation and get a detailed cost estimate within one business day.

CommerceML