Update setup_server.py
This commit is contained in:
parent
5dddd82240
commit
6424c784f9
|
|
@ -582,15 +582,24 @@ def _write_services():
|
||||||
services_dir = str(APP_DIR / "backend/services")
|
services_dir = str(APP_DIR / "backend/services")
|
||||||
|
|
||||||
# (wsgi_target, workers, threads, timeout_sec, port, description)
|
# (wsgi_target, workers, threads, timeout_sec, port, description)
|
||||||
|
#
|
||||||
|
# NOTA backend (1 worker + 8 threads, era 2 sync workers fino al 2026-05-04):
|
||||||
|
# Le sessioni utente sono mantenute in-memory (_sessions_cache in core.py)
|
||||||
|
# con persistence su file (argos_sessions.json) MA senza ricarica per
|
||||||
|
# worker. Con N>1 worker, il worker B non vede sessioni create da worker
|
||||||
|
# A → 401 random post-login (round-robin kernel). Workaround attuale:
|
||||||
|
# 1 worker con 8 threads = concorrenza intra-process via GIL release su
|
||||||
|
# I/O. Sufficiente per il carico ASREM. Soluzione futura: session store
|
||||||
|
# condiviso (Redis o SQLite) per scalare a N>1 worker.
|
||||||
services = {
|
services = {
|
||||||
"backend": ("argos_backend:app", 2, 1, 120, 8080, "Backend API"),
|
"backend": ("argos_backend:app", 1, 8, 120, 8080, "Backend API"),
|
||||||
"sync": ("argos_sync_wsgi:app", 1, 4, 600, 8081, "Sync Daemon"),
|
"sync": ("argos_sync_wsgi:app", 1, 4, 600, 8081, "Sync Daemon"),
|
||||||
"ops": ("argos_ops_wsgi:app", 1, 4, 600, 8082, "Ops Daemon"),
|
"ops": ("argos_ops_wsgi:app", 1, 4, 600, 8082, "Ops Daemon"),
|
||||||
"analytics": ("argos_analytics_wsgi:app", 1, 4, 300, 8083, "Analytics Daemon"),
|
"analytics": ("argos_analytics_wsgi:app", 1, 4, 300, 8083, "Analytics Daemon"),
|
||||||
}
|
}
|
||||||
|
|
||||||
for svc, (wsgi, workers, threads, timeout, port, desc) in services.items():
|
for svc, (wsgi, workers, threads, timeout, port, desc) in services.items():
|
||||||
# Solo i servizi con threads>1 usano gthread; backend e' sync con 2 worker.
|
# Tutti i servizi ora usano gthread (threads>=4); workers=1 obbligatorio.
|
||||||
threads_line = f" --threads {threads} \\\n" if threads > 1 else ""
|
threads_line = f" --threads {threads} \\\n" if threads > 1 else ""
|
||||||
unit = f"""[Unit]
|
unit = f"""[Unit]
|
||||||
Description=ARGOS {desc} (Gunicorn)
|
Description=ARGOS {desc} (Gunicorn)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue