Skip to content

Docs: add production deployment guide for async servers (FastAPI/uvic…#3856

Open
Shubh3005 wants to merge 1 commit into
huggingface:mainfrom
Shubh3005:docs/async-server-deployment
Open

Docs: add production deployment guide for async servers (FastAPI/uvic…#3856
Shubh3005 wants to merge 1 commit into
huggingface:mainfrom
Shubh3005:docs/async-server-deployment

Conversation

@Shubh3005

Copy link
Copy Markdown

Closes #3839

This PR adds the production deployment guide discussed in #3839.

Per the maintainer's note on that issue, the root cause is correctly framed here as a synchronous, CPU-bound model.encode() call blocking the async event loop when called directly inside an async def endpoint — not an OpenMP/asyncio conflict. The fix section covers running encode() in FastAPI's thread pool (plain def endpoint, or run_in_threadpool inside async def), with batching recommended where possible.

OMP_NUM_THREADS / MKL_NUM_THREADS / TOKENIZERS_PARALLELISM are reframed as thread-oversubscription and fork-safety tuning rather than deadlock fixes, and the KMP_DUPLICATE_LIB_OK recommendation has been dropped per the note that it can mask real errors.

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.

Docs: add production deployment guide for async servers (FastAPI/uvicorn + OpenMP deadlock)

1 participant