Table of Contents

Property MaxPoolSize

Namespace
YndigoBlue.Velocity.Data
Assembly
YndigoBlue.Velocity.dll

MaxPoolSize

Gets or sets the maximum number of connections in the connection pool.

public int MaxPoolSize { get; set; }

Property Value

int

Remarks

This setting controls the maximum number of database connections that can exist in the pool at any time. Once this limit is reached, additional requests must wait for a connection to become available before they can execute.

Setting MaxPoolSize:

  • Too Low: Applications under load will encounter "connection pool exhausted" or timeout errors. Users experience failures when concurrent operations exceed available connections. Default of 100 is reasonable for most applications but may be insufficient for high-concurrency scenarios.
  • Too High: Wastes resources. Each open connection consumes memory on both the client and database server. Setting MaxPoolSize to 1000 when you never use more than 50 connections wastes database resources and memory. Monitor actual concurrent connection usage to size appropriately.
  • Sizing Strategy: Set MaxPoolSize based on expected peak concurrent operations. A web application handling 100 simultaneous requests that each use a database connection should set MaxPoolSize to at least 100-120 (with headroom). For batch processing, MaxPoolSize can be much lower since operations are sequential.
  • Database Limits: Ensure your database is configured to accept at least MaxPoolSize connections from your application. Some databases limit total connections per user or database. Verify your database can handle the total connection count before setting high values.

Monitor your application's actual connection usage under peak load and adjust MaxPoolSize accordingly. This is not a "set and forget" value for high-traffic applications.