Files
loadtest/History/2026-07-10-final-answer.md
naeel 4a09038f96
Deploy loadtest / validate (push) Waiting to run
feat: Gunicorn + gevent (keepalive), bump 1.0.8→1.0.9
2026-07-10 23:42:54 +04:00

24 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-07-10 — Финальный ответ: Werkzeug Connection: close
## Корень
Werkzeug dev-сервер ВСЕГДА закрывает TCP-соединение после ответа (`Connection: close`).
nginx должен создавать НОВЫЙ TCP на каждый запрос → Cilium conntrack cycling → intermittent failure.
nginx:alpine держит `Connection: keep-alive` → 1 TCP на все запросы → 10/10.
## Почему все тесты такие
| Тест | Результат | Причина |
|------|-----------|---------|
| nginx:alpine | 10/10 | keep-alive, 1 TCP |
| Flask | 2-5/10 | close, N TCP |
| Gunicorn sync | 1/10 | тоже close + ошибка конфига |
| upstream-keepalive=0 | 0/10 | даже keepalive запрещён |
| внутри кластера | 10/10 | другой code path Cilium |
| свежий деплой 10/10 | чистый conntrack |
## Решение
Gunicorn с gevent worker (поддерживает keepalive):
```
gunicorn -w 2 -k gevent --keep-alive 75 --timeout 120 --bind 0.0.0.0:5000 app:app
```