Skip to content

Commit 1943630

Browse files
authored
feat: Add clarification about concurrency and db connection configuration. (#356)
1 parent 4a7185f commit 1943630

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ stac:
3535
- Added tests for observability stack [#342](https://github.com/developmentseed/eoapi-k8s/pull/342)
3636
- Added validation to require `postgrescluster.enabled: false` when using external databases [#346](https://github.com/developmentseed/eoapi-k8s/pull/346)
3737
- Added a production.yaml profile [#354](https://github.com/developmentseed/eoapi-k8s/pull/354)
38+
- Added clarification about concurrency and db connection configuration. [#356](https://github.com/developmentseed/eoapi-k8s/pull/356)
3839

3940
### Changed
4041

charts/eoapi/values.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ raster:
288288
HOST: "0.0.0.0"
289289
PORT: "8080"
290290
# https://www.uvicorn.org/settings/#production
291-
WEB_CONCURRENCY: "5"
291+
WEB_CONCURRENCY: "4" # CPU-intensive; reduce to 2-3 with autoscaling
292+
DB_MIN_CONN_SIZE: "1"
293+
DB_MAX_CONN_SIZE: "3" # Less intensive: Metadata queries only
292294

293295
multidim:
294296
enabled: false # disabled by default
@@ -349,7 +351,9 @@ multidim:
349351
HOST: "0.0.0.0"
350352
PORT: "8080"
351353
# https://www.uvicorn.org/settings/#production
352-
WEB_CONCURRENCY: "5"
354+
WEB_CONCURRENCY: "4" # CPU-intensive; reduce to 2-3 with autoscaling
355+
DB_MIN_CONN_SIZE: "1"
356+
DB_MAX_CONN_SIZE: "3" # Less intensive: Metadata queries only
353357

354358
stac:
355359
enabled: true
@@ -398,7 +402,9 @@ stac:
398402
HOST: "0.0.0.0"
399403
PORT: "8080"
400404
# https://www.uvicorn.org/settings/#production
401-
WEB_CONCURRENCY: "5"
405+
WEB_CONCURRENCY: "10" # Handles many concurrent requests; reduce to 4-6 with autoscaling
406+
DB_MIN_CONN_SIZE: "1"
407+
DB_MAX_CONN_SIZE: "5" # Quite intensive (queries, transactions, searches)
402408

403409
vector:
404410
enabled: true
@@ -451,8 +457,9 @@ vector:
451457
##############
452458
HOST: "0.0.0.0"
453459
PORT: "8080"
454-
# https://www.uvicorn.org/settings/#production
455-
WEB_CONCURRENCY: "5"
460+
WEB_CONCURRENCY: "8" # Moderate concurrency for complex spatial queries; reduce to 4-5 with autoscaling
461+
DB_MIN_CONN_SIZE: "2"
462+
DB_MAX_CONN_SIZE: "5" # Vector queries can be complex and long-running
456463

457464
######################
458465
# STAC Browser

docs/autoscaling.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,46 @@ stac:
4444
requestRate: 50000m # 50 requests/second
4545
```
4646

47+
## Concurrency settings
48+
49+
Each main eoAPI service has `WEB_CONCURRENCY` and database pool settings that should be adjusted based on your scaling strategy:
50+
51+
### Without autoscaling (default)
52+
53+
Higher concurrency per pod to handle some considerate load:
54+
55+
```yaml
56+
stac:
57+
settings:
58+
envVars:
59+
WEB_CONCURRENCY: "10" # More workers per pod
60+
DB_MIN_CONN_SIZE: "1"
61+
DB_MAX_CONN_SIZE: "5" # Total: 10-50 connections per pod
62+
```
63+
64+
### With autoscaling enabled
65+
66+
Lower concurrency for predictable resource usage:
67+
68+
```yaml
69+
stac:
70+
autoscaling:
71+
enabled: true
72+
settings:
73+
envVars:
74+
WEB_CONCURRENCY: "4" # Fewer workers, let HPA scale pods
75+
DB_MIN_CONN_SIZE: "1"
76+
DB_MAX_CONN_SIZE: "3" # Total: 4-12 connections per pod
77+
```
78+
79+
### Service-specific recommentations
80+
81+
| Service | WEB_CONCURRENCY (no autoscaling) | WEB_CONCURRENCY (with autoscaling) | Rationale |
82+
|---------|----------------------------------|-------------------------------------|-----------|
83+
| STAC | 10 | 4-6 | High request volume, DB intensive |
84+
| Raster | 4 | 2-3 | CPU intensive image operations |
85+
| Vector | 8 | 4-5 | Complex spatial queries |
86+
4787
### Scaling Policies
4888

4989
1. Go to the [releases section](https://github.com/developmentseed/eoapi-k8s/releases) of this repository and find the latest

0 commit comments

Comments
 (0)