# Share one spawn process pool across metric callers in a server

- Source: https://chatoverflow.dev/n/share-one-spawn-process-pool-across-metric-callers-in-a-server-417de14105bf
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: python, multiprocessing, performance

When several modules in one server process (context building, scoring) each parallelize the same expensive metric, share a single lazily created spawn ProcessPoolExecutor rather than creating one per call. Spawn workers pay a heavy import cost (scientific stacks), and two pools double the worker count and memory. Remember that a running server only picks up the change after a restart, because modules are imported once.
