ERP

ERP Connection Pooling Optimization Guide

Connection pooling is the invisible infrastructure that determines how efficiently your ERP application server communicates with the database. Misconfigured connection pools cause two opposite problems: too few connections create bottlenecks where ERP users wait for database access, while too many connections overwhelm the database server with context switching overhead that degrades performance for everyone. ERP systems are particularly sensitive to connection pool issues because they maintain long-running sessions, use distributed transactions across multiple databases, and experience sharp concurrency spikes during batch processing windows.

Connection Pool Sizing for ERP Workloads

The optimal connection pool size for an ERP system is not 'as many as possible.' Research and production experience show that optimal pool size follows the formula: connections = (CPU cores * 2) + effective_spindle_count for the database server. For a 16-core SQL Server with SSD storage (effectively 1 spindle), this means 33 connections is optimal. More connections increase lock contention, context switching, and memory overhead without improving throughput. ERP application servers should maintain separate pools for OLTP transactions (smaller, faster) and reporting queries (larger, longer-running).

  • Calculate base pool size using the formula: (database server CPU cores * 2) + number of storage spindles (1 for SSD)
  • Separate OLTP and reporting connection pools on the ERP application server to prevent long reports from starving transactions
  • Set minimum pool size to 10-20% of maximum to maintain warm connections and reduce initial connection setup latency
  • Configure pool maximum at 50-75% of SQL Server max connections to leave headroom for admin connections and other applications
  • Load test with realistic ERP user concurrency to validate pool sizing: monitor both pool wait time and database CPU utilization

Connection Leak Detection and Prevention

Connection leaks--where application code opens a database connection but fails to return it to the pool--are the most common cause of ERP connection pool exhaustion. Leaks accumulate slowly, causing intermittent timeout errors that worsen over time until the pool is completely exhausted and all ERP users lose database access. Detection requires monitoring both pool-level metrics (active connections, available connections, wait count) and database-level metrics (sleeping sessions with open transactions, idle connections exceeding timeout thresholds).

  • Monitor connection pool active count over time: a steadily rising count without corresponding user increase indicates a leak
  • Query sys.dm_exec_sessions for sleeping sessions with open_transaction_count > 0 as potential connection leak indicators
  • Enable connection pool logging in the ERP application server (IIS, Tomcat, WebSphere) to track checkout and return patterns
  • Set connection lifetime and idle timeout in pool configuration to automatically reclaim leaked connections (e.g., 300 seconds)
  • Implement application-level connection usage auditing that logs stack traces when connections are checked out for leak tracing

Timeout Configuration and Retry Logic

ERP connection timeout settings must balance user experience against database protection. Connection timeout (time to establish a new connection) should be 15-30 seconds for ERP--long enough to survive brief network hiccups but short enough to fail fast when the database is down. Command timeout (time to execute a query) varies by operation type: 30 seconds for OLTP transactions, 300-600 seconds for reports, and 3600+ seconds for batch processes like MRP. Retry logic with exponential backoff handles transient connection failures without overwhelming the database during recovery.

  • Set connection timeout to 15-30 seconds: long enough for transient recovery, short enough for fast failure detection
  • Configure command timeouts by operation type: 30s for OLTP, 300s for reports, 3600s for batch processing in ERP
  • Implement retry logic with exponential backoff (1s, 2s, 4s, 8s) and jitter for transient connection failures
  • Configure connection validation queries (SELECT 1) on pool checkout to detect stale connections from network interruptions
  • Monitor connection timeout and retry metrics in application performance monitoring (APM) to detect degradation trends early

Experiencing connection pool issues with your ERP system? Netray optimizes connection management for maximum throughput and reliability--schedule a configuration review.