perf: improve worker and storage throughput
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
237899745
2026-07-26 00:57:29 +08:00
parent da9b273253
commit de5f451cd1
14 changed files with 611 additions and 101 deletions

View File

@@ -21,10 +21,11 @@ ADMIN_EMAIL=admin@example.com
ADMIN_USERNAME=admin
ADMIN_PASSWORD=replace-with-a-strong-admin-password
# A four-core host should start with two image jobs per process.
DATABASE_MAX_CONNECTIONS=10
# 8-core starting point: four tasks, two files per task, four CPU-bound image jobs.
DATABASE_MAX_CONNECTIONS=16
WORKER_TASK_CONCURRENCY=4
WORKER_CONCURRENCY=2
IMAGE_PROCESSING_CONCURRENCY=2
IMAGE_PROCESSING_CONCURRENCY=4
# Resource ceilings tuned for an 8-core / 16 GB application host.
POSTGRES_MEMORY_LIMIT=2g

View File

@@ -2,7 +2,7 @@ name: imageforge
x-imageforge-environment: &imageforge-environment
DATABASE_URL: postgres://imageforge:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@postgres:5432/imageforge
DATABASE_MAX_CONNECTIONS: ${DATABASE_MAX_CONNECTIONS:-10}
DATABASE_MAX_CONNECTIONS: ${DATABASE_MAX_CONNECTIONS:-16}
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
JWT_EXPIRY_HOURS: ${JWT_EXPIRY_HOURS:-168}
@@ -10,6 +10,7 @@ x-imageforge-environment: &imageforge-environment
BILLING_PROVIDER: ${BILLING_PROVIDER:-stripe}
STORAGE_PATH: /app/uploads
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-http://localhost:8080}
WORKER_TASK_CONCURRENCY: ${WORKER_TASK_CONCURRENCY:-4}
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-2}
IMAGE_PROCESSING_CONCURRENCY: ${IMAGE_PROCESSING_CONCURRENCY:-2}
ALLOW_ANONYMOUS_UPLOAD: ${ALLOW_ANONYMOUS_UPLOAD:-true}