Automated EBOM synchronization with ERP system cut sync time

Wanted to share our EBOM-to-ERP synchronization automation project that reduced sync time from 6 hours to 45 minutes. We were running manual exports every night with significant delays impacting production planning.

Our implementation focused on PX batch processing with multi-threaded sync architecture. Key optimization was restructuring database queries and minimizing API calls through intelligent caching. Instead of individual part queries, we batch-fetch related components and cache ERP responses.

The solution handles 15,000+ BOM items across 200+ assemblies nightly. Multi-threaded approach processes 5 parallel streams while maintaining data integrity through transaction coordination. Database query optimization reduced roundtrips by 70% using prepared statements and connection pooling.

API call reduction came from grouping similar operations and implementing delta sync - only changed items trigger ERP updates. PX extensions handle the orchestration with custom event handlers monitoring BOM changes in real-time.

Happy to discuss technical details if others are tackling similar integration challenges.

What was your strategy for the DB query optimization? We’re seeing similar bottlenecks in our integration. Did you use any specific indexing strategy or was it primarily about reducing the number of queries through better join structures?

Query optimization had three main components. First, we created composite indexes on frequently joined columns - specifically ITEM_NUMBER, CHANGE_STATUS, and MODIFIED_DATE combinations. Second, we replaced nested queries with LEFT JOINs to fetch BOM hierarchy in single queries rather than iterative lookups. Third, we implemented prepared statement caching in the connection pool with a 200-statement cache size. The biggest win came from batch fetching WHERE IN clauses with 100-item batches instead of individual SELECT statements. We also added a materialized view for the BOM flattened structure that refreshes every 15 minutes, which the sync process queries instead of recursively traversing the BOM tree each time.

Excellent implementation that addresses all critical performance optimization areas comprehensively. Let me break down the technical architecture for others considering similar projects.

PX Batch Processing Architecture: The solution leverages Agile’s Process Extension framework with custom event handlers (ItemEventListener, ChangeEventListener) feeding a processing queue. The batch processor implements a producer-consumer pattern where event handlers produce change records and worker threads consume them in coordinated batches. This decouples detection from processing, allowing the system to handle burst changes without overwhelming the ERP endpoint.

Multi-Threaded Sync Implementation: Hash-based partitioning ensures thread safety by assigning BOM branches to specific threads based on parent assembly ID. The optimistic locking with version checking prevents conflicts while maintaining high concurrency. The central queue manager acts as a coordinator, implementing a sophisticated state machine (PENDING → PROCESSING → COMPLETED/RETRY). Health monitoring with connection pool thresholds (40% availability check) prevents cascade failures during database contention.

Database Query Optimization Strategy: The three-tier approach delivers compound benefits. Composite indexes on (ITEM_NUMBER, CHANGE_STATUS, MODIFIED_DATE) enable index-only scans for most queries. Replacing nested queries with LEFT JOINs reduces database roundtrips from O(n²) to O(n) for BOM traversal. The materialized view for flattened BOM structure is particularly clever - it trades 15-minute staleness for massive query performance gains. Prepared statement caching with 200-statement capacity eliminates repeated parse overhead.

API Call Reduction Techniques: The delta sync implementation using custom change tracking is superior to audit trail queries. Batch WHERE IN clauses with 100-item groups reduce API calls by 99% compared to individual requests. Intelligent caching of ERP responses with change-based invalidation prevents redundant lookups. The 5% threshold for triggering targeted full resyncs balances data integrity with performance - catches edge cases without unnecessary full syncs.

Production Considerations: The weekend full sync strategy provides baseline consistency. The sync state table with item_count tracking enables drift detection. Transaction coordination during parallel processing maintains ACID properties while maximizing throughput.

Key metrics achieved: 88% time reduction (6h → 45min), 70% fewer database roundtrips, 99% API call reduction through batching. The architecture scales linearly - adding threads proportionally reduces sync time until database or ERP become bottlenecks. For organizations with similar EBOM volumes (15K+ items), this pattern is production-proven and handles real-time change propagation effectively.

Recommend monitoring: thread pool utilization, queue depth, API response times, database connection pool metrics, and sync completion rates. Set alerts for queue depth >1000 items and sync duration >60 minutes to catch degradation early.

We used optimistic locking with version checking at the Agile object level. Each thread operates on distinct BOM branches - the parent assembly determines thread assignment using hash-based partitioning. Database transaction isolation is READ_COMMITTED with explicit row-level locks only during the final commit phase. The PX batch processor coordinates through a central queue manager that tracks processing state. If conflicts occur, the affected items move to a retry queue processed sequentially after parallel phase completes. We also implemented health checks that pause processing if database connection pool drops below 40% availability.

We use a hybrid approach. Custom change tracking table captures BOM modifications through PX event subscribers - specifically ItemEventListener and ChangeEventListener. This gives us millisecond-level precision versus audit trail queries which are expensive. The tracking table stores ITEM_ID, CHANGE_TYPE, and TIMESTAMP with a processed flag. Initial full sync runs on weekends using the same multi-threaded engine but without delta filtering. Incremental syncs query the tracking table for unprocessed changes from the last successful run. We maintain a sync state table that stores last_sync_timestamp and item_count per assembly to detect missed changes. If the count delta exceeds 5%, we trigger a targeted full resync for that assembly tree only.

This is impressive work. The 6 hours to 45 minutes improvement is substantial. How did you handle the multi-threaded coordination specifically? I’m curious about your approach to preventing race conditions when multiple threads are updating related BOM structures. Did you implement any locking mechanism at the Agile level or rely on database-level transaction isolation?