Skip to content

fix: run Flask with Gunicorn gthread - #77

Merged
tappe9 merged 52 commits into
mainfrom
fix/flask-gunicorn-70
Sep 27, 2026
Merged

tappe9 merged 52 commits into
mainfrom
fix/flask-gunicorn-70

Conversation

@tappe9

@tappe9 tappe9 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • replace Waitress with pinned Gunicorn 26.0.0 for the existing Python / Flask implementation
  • run Gunicorn with one gthread request worker, one request thread, and HTTP keep-alive
  • keep Flask handlers, the synchronous psycopg pool, the 1 CPU / 512 MiB container budget, and the existing benchmark endpoints unchanged
  • create the PostgreSQL pool inside the Gunicorn worker and close it on worker exit
  • validate the Gunicorn arbiter + exactly one request worker without weakening the one-process contract for other implementations
  • preserve historical Waitress reports without introducing a new report schema: server packages remain recorded in provenance, while the registry requires only version fields common to both Flask server generations

Why

Issue #70 reproduced the extreme Flask/Waitress JSON slowdown. A predeclared non-publishing alternatives screen showed that changing the WSGI server to Gunicorn gthread avoided the anomaly without CPU-affinity policy or a framework rewrite. This is the smallest supported production change from that investigation.

TDD and evidence

  • RED: temporary CI run 36287376476 failed because the acceptance contract required gunicorn==26.0.0 while main still pinned Waitress.
  • Process-model tests require exactly one Gunicorn arbiter plus one request worker and reject an extra worker.
  • GREEN: temporary acceptance run 36287677391 passed the Python / Flask real-container acceptance, including startup failure, HTTP behavior, resource/process checks and SIGTERM shutdown.
  • Non-publishing confirmation run 36287747335 passed the same acceptance plus the shared HTTP contract and bounded load confirmation. Its diagnostic values are evidence only, not official results.
  • The temporary workflow was removed before this PR.

Scope boundaries

No CPU-affinity change, framework rewrite, official benchmark dispatch, publication, cohort activation, release, tag, repository setting or permission change.

Closes #70.

tappe9 and others added 30 commits September 27, 2026 11:03
@tappe9
tappe9 merged commit eba127e into main Sep 27, 2026
13 checks passed
@tappe9
tappe9 deleted the fix/flask-gunicorn-70 branch September 27, 2026 10:08

tappe9 commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

Post-merge verification — 2026-09-27

This continuation re-read GitHub state and found the PR already merged; no duplicate source change or merge was performed.

Verification limit: a direct check of publicly served Pages bytes could not be completed. The web fetch was inaccessible and this execution environment could not resolve either the Pages or raw-content host. This is an access limitation, not evidence of a site failure; the successful GitHub Pages deployment was verified separately. No live byte-parity claim is made.

No local test re-execution, source modification, new workflow invocation, official measurement/publication, or settings change was performed in this continuation. This records existing executed CI evidence, not an independent review approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate unexpectedly low Flask JSON throughput without changing official results

1 participant