2024-09-20 17:08:42 -07:00
|
|
|
.. _arch_overview_threading:
|
|
|
|
|
|
2024-10-06 16:54:34 -07:00
|
|
|
Threading Model
|
2024-09-20 17:08:42 -07:00
|
|
|
===============
|
|
|
|
|
|
2025-12-23 17:14:50 -08:00
|
|
|
Plano builds on top of Envoy's single process with multiple threads architecture.
|
2024-09-20 17:08:42 -07:00
|
|
|
|
|
|
|
|
A single *primary* thread controls various sporadic coordination tasks while some number of *worker*
|
|
|
|
|
threads perform filtering, and forwarding.
|
|
|
|
|
|
2024-09-30 14:54:01 -07:00
|
|
|
Once a connection is accepted, the connection spends the rest of its lifetime bound to a single worker
|
|
|
|
|
thread. All the functionality around prompt handling from a downstream client is handled in a separate worker thread.
|
2025-12-23 17:14:50 -08:00
|
|
|
This allows the majority of Plano to be largely single threaded (embarrassingly parallel) with a small amount
|
2024-09-20 17:08:42 -07:00
|
|
|
of more complex code handling coordination between the worker threads.
|
|
|
|
|
|
2025-12-23 17:14:50 -08:00
|
|
|
Generally, Plano is written to be 100% non-blocking.
|
2024-09-20 17:08:42 -07:00
|
|
|
|
|
|
|
|
.. tip::
|
|
|
|
|
|
|
|
|
|
For most workloads we recommend configuring the number of worker threads to be equal to the number of
|
2024-09-30 14:54:01 -07:00
|
|
|
hardware threads on the machine.
|