
August 13, 2026
9 min read
Table of Contents
By Kokil Thapa | Last reviewed: August 2026
When your catalog exceeds 10,000 SKUs, the default admin UI becomes a liability rather than a tool. Successfully executing a Magento 2 import products from CSV at scale requires bypassing the browser entirely and treating the import as a server-side batch process governed by strict resource limits. For store owners managing complex inventories or migrating legacy data, understanding this distinction prevents the timeouts and silent failures that plague large-scale eCommerce operations. If you are planning a major catalog overhaul or migration, reviewing scalable product catalog architecture for e-commerce before touching any CSV files will save significant rework later.
bin/magento import:check followed by import:start with tuned batch sizes (100–500 rows), increased PHP memory limits (4G+), and disabled indexers during execution to prevent database locking on large datasets.How do you prepare CSV data for Magento 2 import products from CSV at scale?
Data preparation is where most large-scale imports fail long before they reach the database. In my experience working on production Magento applications, 90% of "import errors" are actually data formatting issues that the validator catches only after consuming hours of processing time. You must validate and normalize your CSV structure against the specific entity type requirements before attempting a bulk load.
For configurable products, the relationship between parent and child SKUs must be explicit. The configurable_variations column uses a pipe-delimited format that breaks easily if your attribute values contain special characters. Always export a sample set of existing products first to establish a baseline template. This ensures your headers match the exact internal attribute codes expected by the import processor, including custom attributes created via EAV setup scripts.
A common mistake is assuming UTF-8 encoding is universal. Many supplier exports from Windows-based ERP systems arrive in Latin-1 or UTF-16LE. Magento’s parser will choke silently or corrupt multibyte characters like Nepali or Hindi script if the file isn't converted explicitly. Use iconv -f UTF-16LE -t UTF-8 input.csv > output.csv on your Linux server before staging the file. Also verify that image paths are relative to the pub/media/import/ directory, not absolute server paths, as the importer runs within a sandboxed filesystem context.
What are the optimal server settings for large CSV imports in Magento 2?
Default PHP and MySQL configurations are designed for web requests, not sustained batch processing. When you attempt to import 50,000+ rows, you are fighting against garbage collection pauses, connection timeouts, and buffer pool exhaustion. Tuning these parameters specifically for the import window is non-negotiable for maintaining throughput.
- PHP Memory Limit: Set to at least 4G for imports exceeding 20k rows. The import processor loads entire batches into memory for validation before writing. Insufficient memory causes fatal errors mid-batch without rollback.
- Max Execution Time: Configure to 0 (unlimited) or 7200 seconds minimum when running via CLI. Web requests should remain capped, but the import worker needs unrestricted runtime.
- MySQL innodb_buffer_pool_size: Should be 70-80% of available RAM on dedicated database servers. During import, set
innodb_flush_log_at_trx_commit=2temporarily to reduce disk I/O overhead, accepting minimal durability risk for 3-5x write speed improvement. - Elasticsearch/OpenSearch Heap: If reindexing occurs during import, ensure JVM heap is sized appropriately (typically 4-8GB). Monitor GC logs; frequent full GC pauses indicate undersized heap.
On production servers I manage, we typically create a separate PHP-FPM pool or CLI-specific php.ini override file located at /etc/php/8.4/cli/conf.d/99-magento-import.ini. This isolates aggressive import settings from normal storefront traffic. Never apply 4G memory limits globally; a single malformed request could exhaust server resources and crash the site.
; /etc/php/8.4/cli/conf.d/99-magento-import.ini
memory_limit = 4G
max_execution_time = 0
max_input_vars = 10000
post_max_size = 256M
upload_max_filesize = 256M
; OPcache settings for CLI batch work
opcache.enable_cli = 1
opcache.memory_consumption = 512
opcache.max_accelerated_files = 20000 How does the Magento 2 CLI import workflow differ from admin UI?
The admin interface processes imports synchronously within a single HTTP request lifecycle, making it fundamentally unsuitable for large datasets. The CLI workflow decouples validation from execution and leverages asynchronous queue processing where available. Understanding this architectural difference explains why the same CSV that fails in admin succeeds via command line.
The two-phase CLI approach separates concerns cleanly. First, bin/magento import:check --file=products.csv validates structure, attribute existence, and referential integrity without modifying the database. This step generates a detailed error report in var/log/import/. Only after clean validation should you execute bin/magento import:start --file=products.csv --behavior=append. The behavior flag matters: append adds/updates without deleting, while replace deletes matching entities first—a dangerous operation at scale that can trigger cascading foreign key checks.
For Adobe Commerce (Enterprise) installations, consider leveraging the Message Queue Framework to offload import processing to RabbitMQ. This allows the CLI command to enqueue batches rather than process them directly, enabling horizontal scaling across multiple consumers. Open Source users must rely on sequential CLI processing, making batch size optimization even more critical.
Which batch size and indexer strategy prevents timeout failures?
Batch size is the single most impactful tuning parameter for import performance. Too small, and overhead dominates; too large, and memory pressure triggers swapping or OOM kills. The optimal range depends on row complexity, not just count.
| Catalog Profile | Recommended Batch Size | Indexer Mode | Expected Throughput |
|---|---|---|---|
| Simple products, few attributes | 500–1000 | Schedule Update | 3,000–5,000 rows/min |
| Configurable products, 20+ attrs | 100–300 | Schedule Update | 500–1,200 rows/min |
| Bundled/grouped with media | 50–150 | Schedule Update | 200–600 rows/min |
| Multi-storeview translations | 200–400 | Schedule Update | 800–2,000 rows/min |
Always switch indexers to "Update by Schedule" mode before starting a large import. Real-time indexing during import causes catastrophic lock contention as each saved product triggers partial reindex queries. Execute bin/magento indexer:set-mode schedule for all indexers, then run bin/magento cron:run periodically after import completion to rebuild indexes in controlled batches. For catalogs exceeding 100k SKUs, consider disabling non-critical indexers (like search or catalog rule) entirely during import, rebuilding them once post-completion.
Monitor memory usage during test batches with memory_get_peak_usage(true) logged at batch boundaries. If peak usage approaches 80% of your configured limit, reduce batch size by 30%. It is better to run 200 batches of 250 rows than 50 batches of 1000 rows that fail at batch 47 due to fragmentation. On a recent project involving 45,000 configurable products for an international florist client, we found batch size 200 with schedule-update indexing completed 40% faster than batch size 1000 with real-time indexing, despite higher per-row overhead.
How do you handle errors and resume interrupted imports safely?
Large imports rarely complete without interruption. Server restarts, network blips, or data anomalies will halt progress. Your recovery strategy determines whether you lose hours of work or resume seamlessly.
Maintain granular logging by redirecting CLI output to timestamped files: bin/magento import:start --file=products.csv 2>&1 | tee -a var/log/import/products_$(date +%Y%m%d_%H%M%S).log. Parse these logs programmatically to identify failed SKUs rather than scanning manually. Create a separate "retry CSV" containing only failed rows plus their dependencies (e.g., parent configurables if children failed). This avoids reprocessing 49,000 successful rows to fix 200 failures.
Implement idempotency in your import logic. Use SKU as the natural key and ensure updates are truly additive or corrective. Avoid relying on auto-increment entity IDs in CSV files, as these shift between environments. For images, use content hashing or deterministic naming so re-importing the same row doesn’t create duplicate media entries. If using third-party import extensions like FireBear or Wyomind, configure their checkpoint/resume features—they track processed row offsets in dedicated tables, allowing true mid-file resumption after crashes.
Post-import verification is equally important. Run aggregate queries comparing source CSV counts against database totals: SELECT COUNT(*) FROM catalog_product_entity WHERE sku IN (...). Spot-check random samples for attribute correctness, especially price tiers, tier pricing, and custom options which have complex nested structures prone to silent truncation. Only declare import complete after automated reconciliation passes.
Conclusion
Executing Magento 2 import products from CSV at scale is an infrastructure problem disguised as a data task. Success depends on disciplined preparation, CLI-first execution, conservative batch sizing, and robust error recovery—not hoping the admin UI handles edge cases it was never designed for. Treat every large import as a deployment event: stage changes, validate thoroughly, monitor actively, and verify outcomes systematically. If your team lacks bandwidth to manage this complexity internally, or if repeated import failures are blocking catalog growth, reach out to discuss your Magento import challenges. Whether you need a one-time migration or ongoing catalog automation support, getting the foundation right now prevents costly rework later. For teams evaluating platform alternatives due to persistent import friction, comparing Shopify vs WooCommerce for Nepali businesses may reveal simpler architectures better suited to your operational capacity.

