You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a3ae971
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/getting-started/advanced-topics/scaling.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ Use a plain `postgresql://` URL. Open WebUI picks the async driver (psycopg 3) i
54
54
55
55
- Open WebUI does **not** migrate data between databases, so plan this before you have production data in SQLite.
56
56
-**Connection pool.** With [`DATABASE_POOL_SIZE`](/reference/env-configuration#database_pool_size) unset, each process uses SQLAlchemy's default of 5 connections plus 10 overflow. Once you set `DATABASE_POOL_SIZE`, the overflow default drops to `0`, so set [`DATABASE_POOL_MAX_OVERFLOW`](/reference/env-configuration#database_pool_max_overflow) too. `DATABASE_POOL_SIZE=0` disables pooling. `DATABASE_POOL_SIZE=15` with `DATABASE_POOL_MAX_OVERFLOW=20` is a good start for busy instances.
57
-
- **Every worker process has its own pools.** Each process holds two engines on `DATABASE_URL`, a sync one and an async one, and each can open `DATABASE_POOL_SIZE + DATABASE_POOL_MAX_OVERFLOW` connections. With [`VECTOR_DB=pgvector`](/reference/env-configuration#vector_db), PGVector opens a third pool of [`PGVECTOR_POOL_SIZE`](/reference/env-configuration#pgvector_pool_size) + [`PGVECTOR_POOL_MAX_OVERFLOW`](/reference/env-configuration#pgvector_pool_max_overflow) connections (also 5 + 10 when `PGVECTOR_POOL_SIZE` is unset), even when `PGVECTOR_DB_URL` is unset and it shares the main database. The maximum number of connections is `(2 × (DATABASE_POOL_SIZE + DATABASE_POOL_MAX_OVERFLOW) + PGVector pool) × UVICORN_WORKERS × replicas`, where [`UVICORN_WORKERS`](/reference/env-configuration#uvicorn_workers) is the number of worker processes per replica (default 1). Keep that below PostgreSQL's `max_connections` (default 100) with room for other clients. With the values above, one worker and no PGVector, 3 replicas can open 210 connections, so raise `max_connections` or lower the pool sizes.
57
+
-**Budget connections per database server.** With PostgreSQL pooling enabled, each worker has a synchronous and an asynchronous application pool. With `VECTOR_DB=pgvector`, an unset `PGVECTOR_DB_URL` defaults to `DATABASE_URL`. pgvector creates a separate engine for that URL even though it targets the same server. Count the pools that connect to each server and multiply by the total number of workers across replicas. See [PostgreSQL pool sizing](/reference/env-configuration#database_pool_size) for an example.
58
58
- For single-instance pool tuning, see [Connection Pool Sizing](/troubleshooting/performance#connection-pool-sizing).
59
59
60
60
For credential handling and encryption at rest, see the [Database section of the Hardening guide](/getting-started/advanced-topics/hardening#database).
Copy file name to clipboardExpand all lines: docs/reference/env-configuration.mdx
+6-16Lines changed: 6 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3589,10 +3589,10 @@ If set to `false`, open-webui will assume the postgreSQL database where embeddin
3589
3589
3590
3590
- Type: `str`
3591
3591
- Options:
3592
-
- `ivfflat`: Uses inverted file with flat compression, better for datasets with many dimensions.
3592
+
- `ivfflat`: Groups vectors into lists and searches a subset of those lists.
3593
3593
- `hnsw`: Uses Hierarchical Navigable Small World graphs, generally provides better query performance.
3594
-
- Default: Not specified (pgvector will use its default)
3595
-
- Description: Specifies the index method for pgvector. The choice affects query performance and index build time.
3594
+
- Default: unset. Open WebUI selects `ivfflat` for `vector` columns and `hnsw` for `halfvec` columns.
3595
+
- Description: Specifies the index method for pgvector. If the existing `idx_document_chunk_vector` uses a different method, initialization fails and Open WebUI leaves the index in place. Plan a maintenance window to replace the index with one that uses the new method before restarting. Changing only the index method can reuse the stored embeddings.
3596
3596
- Persistence: Set via environment variable; applied at startup (not a `ConfigVar`).
3597
3597
3598
3598
:::info
@@ -8411,23 +8411,13 @@ Each SQLite connection carries its own page cache (`DATABASE_SQLITE_PRAGMA_CACHE
8411
8411
8412
8412
For deployments with many concurrent users, consider increasing both `DATABASE_POOL_SIZE` and `DATABASE_POOL_MAX_OVERFLOW`. A good starting point is `DATABASE_POOL_SIZE=15` and `DATABASE_POOL_MAX_OVERFLOW=20`.
8413
8413
8414
-
**Important:** The combined total (`DATABASE_POOL_SIZE` + `DATABASE_POOL_MAX_OVERFLOW`) should remain well below your database server's `max_connections` limit. PostgreSQL defaults to 100 max connections, so keeping the combined total under 50-80 per Open WebUI instance is recommended to leave room for other clients and maintenance connections.
8415
-
8416
8414
:::
8417
8415
8418
-
:::warning Pool Size Multiplies with Concurrency
8419
-
8420
-
**Each Open WebUI process maintains its own independent connection pool.** This applies to every replica, whether Kubernetes pods, Docker Compose or Docker Swarm replicas, and to every Uvicorn worker inside one.
8421
-
8422
-
The actual maximum number of database connections is:
8423
-
8424
-
```
8425
-
Total connections = (DATABASE_POOL_SIZE + DATABASE_POOL_MAX_OVERFLOW) × Number of processes/instances
8426
-
```
8416
+
:::warning PostgreSQL pools multiply with workers
8427
8417
8428
-
For example, with `DATABASE_POOL_SIZE=15`, `DATABASE_POOL_MAX_OVERFLOW=20`, and 4 replicas, you could open up to **140 connections** (35 × 4).
8418
+
Each Open WebUI worker has separate synchronous and asynchronous application engines. When pooling is enabled, each can open up to `DATABASE_POOL_SIZE + DATABASE_POOL_MAX_OVERFLOW` connections. For example, a size of 15 and overflow of 20 across four replicas with one worker each gives an application pool capacity of 280 connections (2 × 35 × 4).
8429
8419
8430
-
When calculating pool settings, always account for this multiplier to avoid exhausting your database's `max_connections` limit. This is a fundamental limitation: connection pools cannot be shared across separate processes or containers.
8420
+
With `VECTOR_DB=pgvector`, an unset `PGVECTOR_DB_URL` defaults to `DATABASE_URL`. The nonempty URL gives pgvector a separate engine governed by [its own pool settings](#pgvector_pool_size), even when it points to the same server. Count that pool against the server it connects to. Leave room under each server's `max_connections` for clients outside Open WebUI. These limits describe configured pools. Disabling pooling does not set a connection cap.
Copy file name to clipboardExpand all lines: docs/troubleshooting/performance.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,7 @@ For high-concurrency PostgreSQL deployments, the default connection pool may be
108
108
109
109
SQLite uses its own pool sizing, see [SQLite Memory Footprint on Constrained Containers](#5-sqlite-memory-footprint-on-constrained-containers).
110
110
111
-
**Important:**The combined total (`DATABASE_POOL_SIZE` + `DATABASE_POOL_MAX_OVERFLOW`) should remain well below your database's `max_connections` limit. PostgreSQL defaults to 100 max connections, so keep the combined total under 50-80 per Open WebUI instance to leave room for other clients and maintenance operations.
111
+
**Important:**For PostgreSQL, count the synchronous pool, asynchronous pool, and any pgvector pool that connects to the same database server. Multiply by the number of workers across replicas and leave room for other clients. See [PostgreSQL pool sizing](/reference/env-configuration#database_pool_size).
112
112
113
113
### Vector Database (RAG)
114
114
For multi-user setups, the choice of Vector DB matters.
0 commit comments