Connection Pool Calc
Optimal pool size from concurrency and database spec
Connection Pool Calc is a free online Developer tool. Optimal pool size from concurrency and database spec Related terms: 连接池 · pool · 连接数 · max connections · 数据库配置 · 并发. Use it on this page without signing in.
# HikariCP (Java) maximumPoolSize=3 minimumIdle=1 connectionTimeout=30000 idleTimeout=600000 maxLifetime=1800000
# Node.js pg
const pool = new Pool({
max: 3,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000,
});# SQLAlchemy (Python) engine = create_engine( DB_URL, pool_size=3, max_overflow=1, pool_timeout=30, pool_recycle=1800, )
# pgbouncer.ini [databases] mydb = host=127.0.0.1 dbname=prod [pgbouncer] pool_mode = transaction default_pool_size = 3 max_client_conn = 100 reserve_pool_size = 1
公式 1 反映「同时正在执行的查询数」,公式 2(PostgreSQL 官方经验)反映「CPU 并行收益上限」,最终取较小值与数据库 80% 上限中的最小值,避免连接过多反而因上下文切换降低吞吐。
使用说明
- 输入预估并发请求数
- 输入平均查询耗时(毫秒)
- 输入数据库最大连接数
- 自动计算推荐连接池大小和说明
计算公式
连接池大小 = 并发数 × 平均耗时(秒) × 安全系数(1.2)
参考 PostgreSQL 官方建议:
- 公式:poolsize = (corecount × 2) + effectivespindlecount
- 经验值:大多数应用 10-20 个连接即可达到最佳吞吐
- 过多连接反而降低性能(上下文切换开销)
More Developer
View allJSON Formatter
Format, minify, validate JSON, convert to Go struct / TS interface
JSON Field Search
Search JSON by field, value or path with highlights, supports jq expressions
Timestamp Converter
Convert between Unix timestamps and dates, seconds and milliseconds
Cron Expression
Generate and parse cron expressions, preview next run time
UUID Generator
Generate UUID v4 / v7 / ULID / NanoID
Hash Calculator
Compute MD5 / SHA1 / SHA256 / SHA512 of text or files
JWT Decoder
Decode JWT header and payload, view expiry time
URL Encoder / Decoder
Encode and decode URL / URI components
FAQ about Connection Pool Calc
What can Connection Pool Calc do?
Connection Pool Calc is a Developer tool. Optimal pool size from concurrency and database spec You can finish the job on this page.
Who should use Connection Pool Calc?
Anyone handling 连接池 · pool · 连接数 · max connections · 数据库配置 · 并发 who does not want to install desktop software can use Connection Pool Calc in the browser.
Is Connection Pool Calc safe? Is my data uploaded?
This tool runs in your browser. We do not collect the content you enter into Connection Pool Calc just because you used it.
What similar tools exist?
Related tools in the same Developer group are listed at the bottom of this page.