You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/Deployment/deployment-cold-start.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,10 +140,10 @@ Starting with this release, `LANGFLOW_GUNICORN_PRELOAD` defaults to `true`. Guni
140
140
141
141
Enabling `preload_app=true` makes any resource constructed before fork (the master process) shared with every worker via copy-on-write. Sockets and file descriptors are literally shared, not copied — a stale inherited HTTP pool, database engine, or background task will break.
142
142
143
-
The Phase 5 audit covered seven classes of pre-fork state:
143
+
The fork-safety audit covered seven classes of pre-fork state:
144
144
145
145
-**SQLAlchemy engine.** Safe by construction — `DatabaseService.__init__` runs inside `initialize_services()` inside the FastAPI lifespan, which executes per-worker post-fork. The engine is never created in the master.
146
-
-**asyncio locks.** Safe. `ComponentCache._lock` uses the IDX-01 lazy `@property` pattern introduced in Phase 2; each worker creates its own `asyncio.Lock()` on first access, bound to its own event loop.
146
+
-**asyncio locks.** Safe. `ComponentCache._lock` uses a lazy `@property` pattern; each worker creates its own `asyncio.Lock()` on first access, bound to its own event loop.
147
147
-**Component index cache.** Safe. `ComponentCache.all_types_dict` is populated inside the FastAPI lifespan (post-fork) by the wave-2 `asyncio.gather` block.
148
148
-**Redis connection pool.** Safe (conditional). `RedisCache` is only constructed when `LANGFLOW_CACHE_TYPE=redis`, and in that case it is built inside `initialize_services()` (post-fork).
149
149
-**asyncio background tasks at import time.** Safe. No `asyncio.create_task` calls at module scope; all tasks are created inside the lifespan body or inside `service.start()` methods.
@@ -172,12 +172,12 @@ For multi-worker deployments using the stock services, the default is recommende
172
172
173
173
### Measured improvements
174
174
175
-
Phase 2 through 5.5 of the cold-start improvements milestone reduced `lfx run` and `langflow run` cold-start latency on Linux CI runners. Headline numbers from the post-fix authoritative run on Python 3.13:
175
+
The cold-start improvements milestone reduced `lfx run` and `langflow run` cold-start latency on Linux CI runners. Headline numbers from the post-fix authoritative run on Python 3.13:
176
176
177
177
-`lfx run` bare boot dropped from 17.82 s to 10.55 s (`lfx_bare` scenario).
178
178
-`lfx run <flow>` uncompiled dropped from 18.92 s to 16.01 s (`lfx_with_flow` scenario).
179
179
-`lfx run <flow>` with pre-baked bytecode dropped from 9.52 s to 8.43 s (`lfx_with_flow_prebaked` scenario).
180
180
181
181
The gains come from in-process changes (deferred imports on the Graph hot path, atomic and version-stamped component index, parallelized lifespan tasks, event-driven MCP startup, persisted component-index cache) combined with the build-time and image-layer tunings documented above (`UV_COMPILE_BYTECODE=1`, multi-stage layer separation).
182
182
183
-
For the full before / after table, per-scenario deltas, and MEAS-03 per-phase checkpoint breakdown, see the cold-start performance improvements entry in the [Langflow release notes](/release-notes).
183
+
For the full before / after table, per-scenario deltas, and per-phase checkpoint breakdown, see the cold-start performance improvements entry in the [Langflow release notes](/release-notes).
0 commit comments