.. _arch_overview_listeners: Listeners ========= The Envoy configuration supports any number of listeners within a single process. Generally we recommend running a single Envoy per machine regardless of the number of configured listeners. This allows for easier operation and a single source of statistics. Envoy supports both :ref:`TCP ` and :ref:`UDP ` listeners. .. _arch_overview_listeners_tcp: TCP --- Each listener is independently configured with :ref:`filter_chains `, where an individual :ref:`filter_chain ` is selected based on its :ref:`filter_chain_match ` criteria. An individual :ref:`filter_chain ` is composed of one or more network level (L3/L4) :ref:`filters `. When a new connection is received on a listener, the appropriate :ref:`filter_chain ` is selected, and the configured connection-local filter stack is instantiated and begins processing subsequent events. The generic listener architecture is used to perform the vast majority of different proxy tasks that Envoy is used for (e.g., :ref:`rate limiting `, :ref:`TLS client authentication `, :ref:`HTTP connection management `, MongoDB :ref:`sniffing `, raw :ref:`TCP proxy `, etc.). Listeners are optionally also configured with some number of :ref:`listener filters `. These filters are processed before the network level filters, and have the opportunity to manipulate the connection metadata, usually to influence how the connection is processed by later filters or clusters. Listeners can also be fetched dynamically via the :ref:`listener discovery service (LDS) `. .. tip:: See the Listener :ref:`configuration `, :ref:`protobuf ` and :ref:`components ` sections for reference documentation. .. _arch_overview_listeners_udp: UDP --- Envoy also supports UDP listeners and specifically :ref:`UDP listener filters `. UDP listener filters are instantiated once per worker and are global to that worker. Each listener filter processes each UDP datagram that is received by the worker listening on the port. In practice, UDP listeners are configured with the ``SO_REUSEPORT`` kernel option which will cause the kernel to consistently hash each UDP 4-tuple to the same worker. This allows a UDP listener filter to be "session" oriented if it so desires. A built-in example of this functionality is the :ref:`UDP proxy ` listener filter.