Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added tests for observability stack [#342](https://github.com/developmentseed/eoapi-k8s/pull/342)
- Added validation to require `postgrescluster.enabled: false` when using external databases [#346](https://github.com/developmentseed/eoapi-k8s/pull/346)
- Added a production.yaml profile [#354](https://github.com/developmentseed/eoapi-k8s/pull/354)
- Added clarification about concurrency and db connection configuration. [#356](https://github.com/developmentseed/eoapi-k8s/pull/356)

### Changed

Expand Down
17 changes: 12 additions & 5 deletions charts/eoapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ raster:
HOST: "0.0.0.0"
PORT: "8080"
# https://www.uvicorn.org/settings/#production
WEB_CONCURRENCY: "5"
WEB_CONCURRENCY: "4" # CPU-intensive; reduce to 2-3 with autoscaling
DB_MIN_CONN_SIZE: "1"
DB_MAX_CONN_SIZE: "3" # Less intensive: Metadata queries only

multidim:
enabled: false # disabled by default
Expand Down Expand Up @@ -377,7 +379,9 @@ multidim:
HOST: "0.0.0.0"
PORT: "8080"
# https://www.uvicorn.org/settings/#production
WEB_CONCURRENCY: "5"
WEB_CONCURRENCY: "4" # CPU-intensive; reduce to 2-3 with autoscaling
DB_MIN_CONN_SIZE: "1"
DB_MAX_CONN_SIZE: "3" # Less intensive: Metadata queries only

stac:
enabled: true
Expand Down Expand Up @@ -437,7 +441,9 @@ stac:
HOST: "0.0.0.0"
PORT: "8080"
# https://www.uvicorn.org/settings/#production
WEB_CONCURRENCY: "5"
WEB_CONCURRENCY: "10" # Handles many concurrent requests; reduce to 4-6 with autoscaling
DB_MIN_CONN_SIZE: "1"
DB_MAX_CONN_SIZE: "5" # Quite intensive (queries, transactions, searches)

vector:
enabled: true
Expand Down Expand Up @@ -501,8 +507,9 @@ vector:
##############
HOST: "0.0.0.0"
PORT: "8080"
# https://www.uvicorn.org/settings/#production
WEB_CONCURRENCY: "5"
WEB_CONCURRENCY: "8" # Moderate concurrency for complex spatial queries; reduce to 4-5 with autoscaling
DB_MIN_CONN_SIZE: "2"
DB_MAX_CONN_SIZE: "5" # Vector queries can be complex and long-running

######################
# STAC Browser
Expand Down
40 changes: 40 additions & 0 deletions docs/autoscaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,46 @@ stac:
requestRate: 50000m # 50 requests/second
```

## Concurrency settings

Each main eoAPI service has `WEB_CONCURRENCY` and database pool settings that should be adjusted based on your scaling strategy:

### Without autoscaling (default)

Higher concurrency per pod to handle some considerate load:

```yaml
stac:
settings:
envVars:
WEB_CONCURRENCY: "10" # More workers per pod
DB_MIN_CONN_SIZE: "1"
DB_MAX_CONN_SIZE: "5" # Total: 10-50 connections per pod
```

### With autoscaling enabled

Lower concurrency for predictable resource usage:

```yaml
stac:
autoscaling:
enabled: true
settings:
envVars:
WEB_CONCURRENCY: "4" # Fewer workers, let HPA scale pods
DB_MIN_CONN_SIZE: "1"
DB_MAX_CONN_SIZE: "3" # Total: 4-12 connections per pod
```

### Service-specific recommentations

| Service | WEB_CONCURRENCY (no autoscaling) | WEB_CONCURRENCY (with autoscaling) | Rationale |
|---------|----------------------------------|-------------------------------------|-----------|
| STAC | 10 | 4-6 | High request volume, DB intensive |
| Raster | 4 | 2-3 | CPU intensive image operations |
| Vector | 8 | 4-5 | Complex spatial queries |

### Scaling Policies

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