fix(immich): improve thumbnail loading performance on iOS app
- Bump immich-server memory 1700Mi/2500Mi → 2000Mi/3500Mi to prevent OOM kills - Disable anti-AI middleware chain for Immich (removes 3 unnecessary ForwardAuth hops per request — Immich content is behind auth, not crawlable) - Double rate limit to 200 avg / 2000 burst for fast-scroll thumbnail requests - Fix ImmichFrame image tag (1.7.4 → v1.0.32.0) - Add PostgreSQL vector search prewarming and tuning (SSD storage type, init container for override conf, postStart pg_prewarm)
This commit is contained in:
parent
37dbad47e9
commit
4d753a6486
3 changed files with 44 additions and 9 deletions
|
|
@ -64,7 +64,7 @@ resource "kubernetes_deployment" "immich-frame" {
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
container {
|
container {
|
||||||
image = "ghcr.io/immichframe/immichframe:1.7.4"
|
image = "ghcr.io/immichframe/immichframe:v1.0.32.0"
|
||||||
name = "immich-frame"
|
name = "immich-frame"
|
||||||
resources {
|
resources {
|
||||||
requests = {
|
requests = {
|
||||||
|
|
|
||||||
|
|
@ -284,10 +284,10 @@ resource "kubernetes_deployment" "immich_server" {
|
||||||
resources {
|
resources {
|
||||||
requests = {
|
requests = {
|
||||||
cpu = "100m"
|
cpu = "100m"
|
||||||
memory = "1700Mi"
|
memory = "2000Mi"
|
||||||
}
|
}
|
||||||
limits = {
|
limits = {
|
||||||
memory = "2500Mi"
|
memory = "3500Mi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -422,22 +422,56 @@ resource "kubernetes_deployment" "immich-postgres" {
|
||||||
}
|
}
|
||||||
env {
|
env {
|
||||||
name = "DB_STORAGE_TYPE"
|
name = "DB_STORAGE_TYPE"
|
||||||
value = "HDD"
|
value = "SSD"
|
||||||
}
|
}
|
||||||
volume_mount {
|
volume_mount {
|
||||||
name = "postgresql-persistent-storage"
|
name = "postgresql-persistent-storage"
|
||||||
mount_path = "/var/lib/postgresql/data"
|
mount_path = "/var/lib/postgresql/data"
|
||||||
}
|
}
|
||||||
|
lifecycle {
|
||||||
|
post_start {
|
||||||
|
exec {
|
||||||
|
command = ["/bin/sh", "-c", <<-EOT
|
||||||
|
# Wait for PG to accept connections, then prewarm vector search tables
|
||||||
|
for i in $(seq 1 60); do
|
||||||
|
if pg_isready -U postgres > /dev/null 2>&1; then
|
||||||
|
psql -U postgres -d immich -c "CREATE EXTENSION IF NOT EXISTS pg_prewarm; SELECT pg_prewarm('smart_search'); SELECT pg_prewarm('clip_index');" > /dev/null 2>&1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
EOT
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
resources {
|
resources {
|
||||||
requests = {
|
requests = {
|
||||||
cpu = "50m"
|
cpu = "100m"
|
||||||
memory = "1Gi"
|
memory = "2Gi"
|
||||||
}
|
}
|
||||||
limits = {
|
limits = {
|
||||||
memory = "1Gi"
|
memory = "2Gi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
init_container {
|
||||||
|
name = "write-pg-override-conf"
|
||||||
|
image = "busybox:1.36"
|
||||||
|
command = ["sh", "-c", <<-EOT
|
||||||
|
cat > /data/postgresql.override.conf <<'PGCONF'
|
||||||
|
# Immich vector search performance tuning
|
||||||
|
shared_buffers = 1024MB
|
||||||
|
effective_cache_size = 1536MB
|
||||||
|
work_mem = 64MB
|
||||||
|
PGCONF
|
||||||
|
EOT
|
||||||
|
]
|
||||||
|
volume_mount {
|
||||||
|
name = "postgresql-persistent-storage"
|
||||||
|
mount_path = "/data"
|
||||||
|
}
|
||||||
|
}
|
||||||
volume {
|
volume {
|
||||||
name = "postgresql-persistent-storage"
|
name = "postgresql-persistent-storage"
|
||||||
persistent_volume_claim {
|
persistent_volume_claim {
|
||||||
|
|
@ -646,6 +680,7 @@ module "ingress-immich" {
|
||||||
rybbit_site_id = "35eedb7a3d2b"
|
rybbit_site_id = "35eedb7a3d2b"
|
||||||
skip_default_rate_limit = true
|
skip_default_rate_limit = true
|
||||||
extra_middlewares = ["traefik-immich-rate-limit@kubernetescrd"]
|
extra_middlewares = ["traefik-immich-rate-limit@kubernetescrd"]
|
||||||
|
anti_ai_scraping = false
|
||||||
extra_annotations = {
|
extra_annotations = {
|
||||||
"gethomepage.dev/enabled" = "true"
|
"gethomepage.dev/enabled" = "true"
|
||||||
"gethomepage.dev/description" = "Photos library"
|
"gethomepage.dev/description" = "Photos library"
|
||||||
|
|
|
||||||
|
|
@ -244,8 +244,8 @@ resource "kubernetes_manifest" "middleware_immich_rate_limit" {
|
||||||
}
|
}
|
||||||
spec = {
|
spec = {
|
||||||
rateLimit = {
|
rateLimit = {
|
||||||
average = 100
|
average = 200
|
||||||
burst = 1000
|
burst = 2000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue