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
[Fluent Bit](https://fluentbit.io) implements a unified networking interface that is exposed to components like plugins. This interface abstract all the complexity of general I/O and is fully configurable.
3
+
[Fluent Bit](https://fluentbit.io) implements a unified networking interface that's
4
+
exposed to components like plugins. This interface abstracts the complexity of
5
+
general I/O and is fully configurable.
4
6
5
-
A common use case is when a component or plugin needs to connect to a service to send and receive data. Despite the operational mode sounds easy to deal with, there are many factors that can make things hard like unresponsive services, networking latency or any kind of connectivity error. The networking interface aims to abstract and simplify the network I/O handling, minimize risks and optimize performance.
7
+
A common use case is when a component or plugin needs to connect with a service to send
8
+
and receive data. There are many challenges to handle like unresponsive services,
9
+
networking latency, or any kind of connectivity error. The networking interface aims
10
+
to abstract and simplify the network I/O handling, minimize risks, and optimize
11
+
performance.
6
12
7
-
## Concepts
13
+
## Networking concepts
8
14
9
-
### TCP Connect Timeout
15
+
Fluent Bit uses the following networking concepts:
10
16
11
-
Most of the time creating a new TCP connection to a remote server is straightforward and takes a few milliseconds. But there are cases where DNS resolving, slow network or incomplete TLS handshakes might create long delays, or incomplete connection statuses.
17
+
### TCP connect timeout
12
18
13
-
The `net.connect_timeout` allows to configure the maximum time to wait for a connection to be established, note that this value already considers the TLS handshake process.
19
+
Typically, creating a new TCP connection to a remote server is straightforward
20
+
and takes a few milliseconds. However, there are cases where DNS resolving, a slow
21
+
network, or incomplete TLS handshakes might create long delays, or incomplete
22
+
connection statuses.
14
23
15
-
The `net.connect_timeout_log_error` indicates if an error should be logged in case of connect timeout. If disabled, the timeout is logged as debug level message instead.
24
+
-`net.connect_timeout` lets you configure the maximum time to wait for a connection
25
+
to be established. This value already considers the TLS handshake process.
16
26
17
-
### TCP Source Address
27
+
-`net.connect_timeout_log_error` indicates if an error should be logged in case of
28
+
connect timeout. If disabled, the timeout is logged as a debug level message.
18
29
19
-
On environments with multiple network interfaces, might be desired to choose which interface to use for our data that will flow through the network.
30
+
### TCP source address
20
31
21
-
The `net.source_address` allows to specify which network address must be used for a TCP connection and data flow.
32
+
On environments with multiple network interfaces, you can choose which
33
+
interface to use for Fluent Bit data that will flow through the network.
22
34
23
-
### Connection Keepalive
35
+
Use `net.source_address` to specify which network address to use for a TCP connection
36
+
and data flow.
24
37
25
-
TCP is a _connected oriented_ channel, to deliver and receive data from a remote end-point in most of cases we use a TCP connection. This TCP connection can be created and destroyed once is not longer needed, this approach has pros and cons, here we will refer to the opposite case: keep the connection open.
38
+
### Connection keepalive
26
39
27
-
The concept of `Connection Keepalive` refers to the ability of the client \(Fluent Bit on this case\) to keep the TCP connection open in a persistent way, that means that once the connection is created and used, instead of close it, it can be recycled. This feature offers many benefits in terms of performance since communication channels are always established before hand.
40
+
A connection keepalive refers to the ability of a client to keep the TCP connection
41
+
open in a persistent way. This feature offers many benefits in terms
42
+
of performance because communication channels are always established beforehand.
28
43
29
-
Any component that uses TCP channels like HTTP or [TLS](transport-security.md), can take advantage of this feature. For configuration purposes use the `net.keepalive` property.
44
+
Any component that uses TCP channels like HTTP or [TLS](transport-security.md), can
45
+
take use feature. For configuration purposes use the `net.keepalive`
46
+
property.
30
47
31
-
### Connection Keepalive Idle Timeout
48
+
### Connection keepalive idle timeout
32
49
33
-
If a connection is keepalive enabled, there might be scenarios where the connection can be unused for long periods of time. Having an idle keepalive connection is not helpful and is recommendable to keep them alive if they are used.
34
-
35
-
In order to control how long a keepalive connection can be idle, we expose the configuration property called `net.keepalive_idle_timeout`.
50
+
If a connection keepalive is enabled, there might be scenarios where the connection
51
+
can be unused for long periods of time. Unused connections can be removed. To control
52
+
how long a keepalive connection can be idle, Fluent Bit uses a configuration property
53
+
called `net.keepalive_idle_timeout`.
36
54
37
55
### DNS mode
38
56
39
-
If a transport layer protocol is specified, the plugin whose configuration section the `net.dns.mode` setting is specified on overrides the global `dns.mode` value and issues DNS requests using the specified protocol which can be either TCP or UDP
40
-
41
-
### Max Connections Per Worker
42
-
43
-
By default, Fluent Bit tries to deliver data as faster as possible and create TCP connections on-demand and in keepalive mode for performance reasons. In high-scalable environments, the user might want to control how many connections are done in parallel by setting a limit.
44
-
45
-
This can be done by the configuration property called `net.max_worker_connections` that can be used in the output plugins sections.
46
-
This feature acts at the worker level, e.g., if you have 5 workers and `net.max_worker_connections` is set to 10, a max of 50 connections will be allowed.
47
-
If the limit is reached, the output plugin will issue a retry.
48
-
49
-
50
-
## Configuration Options
51
-
52
-
For plugins that rely on networking I/O, the following section describes the network configuration properties available and how they can be used to optimize performance or adjust to different configuration needs:
|`net.connect_timeout`| Set maximum time expressed in seconds to wait for a TCP connection to be established, this include the TLS handshake time. | 10 |
57
-
|`net.connect_timeout_log_error`| On connection timeout, specify if it should log an error. When disabled, the timeout is logged as a debug message. | true |
58
-
|`net.dns.mode`| Select the primary DNS connection type (TCP or UDP). Can be set in the [SERVICE] section and overridden on a per plugin basis if desired. ||
59
-
|`net.dns.prefer_ipv4`| Prioritize IPv4 DNS results when trying to establish a connection. | false |
60
-
|`net.dns.resolver`| Select the primary DNS resolver type (LEGACY or ASYNC). ||
61
-
|`net.keepalive`| Enable or disable connection keepalive support. Accepts a boolean value: on / off. | on |
62
-
|`net.keepalive_idle_timeout`| Set maximum time expressed in seconds for an idle keepalive connection. | 30 |
63
-
|`net.keepalive_max_recycle`| Set maximum number of times a keepalive connection can be used before it is retired. | 2000 |
64
-
|`net.max_worker_connections`| Set maximum number of TCP connections that can be established per worker. | 0 (unlimited) |
65
-
|`net.source_address`| Specify network address to bind for data traffic. ||
57
+
The global `dns.mode` value issues DNS requests using the specified protocol, either
58
+
TCP or UDP. If a transport layer protocol is specified, plugins that configure the
59
+
`net.dns.mode` setting override the global setting.
60
+
61
+
### Maximum connections per worker
62
+
63
+
For optimal performance, Fluent Bit tries to deliver data quickly and create
64
+
TCP connections on-demand and in keepalive mode. In highly scalable
65
+
environments, you might limit how many connections are created in
66
+
parallel.
67
+
68
+
Use the `net.max_worker_connections` property in the output plugin section to set
69
+
the maximum number of allowed connections. This property acts at the worker level.
70
+
For example, if you have five workers and `net.max_worker_connections` is set
71
+
to 10, a maximum of 50 connections is allowed. If the limit is reached, the output
72
+
plugin issues a retry.
73
+
74
+
## Configuration options
75
+
76
+
The following table describes the network configuration properties available and
77
+
their usage in optimizing performance or adjusting configuration needs for plugins
78
+
that rely on networking I/O:
79
+
80
+
| Property | Description | Default |
81
+
| :------- |:------------|:--------|
82
+
|`net.connect_timeout`| Set maximum time expressed in seconds to wait for a TCP connection to be established, including the TLS handshake time. |`10`|
83
+
|`net.connect_timeout_log_error`| On connection timeout, specify if it should log an error. When disabled, the timeout is logged as a debug message. |`true`|
84
+
|`net.dns.mode`| Select the primary DNS connection type (TCP or UDP). Can be set in the `[SERVICE]` section and overridden on a per plugin basis if desired. |_none_|
85
+
|`net.dns.prefer_ipv4`| Prioritize IPv4 DNS results when trying to establish a connection. |`false`|
86
+
|`net.dns.resolver`| Select the primary DNS resolver type (`LEGACY` or `ASYNC`). |_none_|
87
+
|`net.keepalive`| Enable or disable connection keepalive support. Accepts a Boolean value: `on` or `off`. |`on`|
88
+
|`net.keepalive_idle_timeout`| Set maximum time expressed in seconds for an idle keepalive connection. |`30`|
89
+
|`net.keepalive_max_recycle`| Set maximum number of times a keepalive connection can be used before it's retired. |`2000`|
90
+
|`net.max_worker_connections`| Set maximum number of TCP connections that can be established per worker. |`0` (unlimited) |
91
+
|`net.source_address`| Specify network address to bind for data traffic. |_none_|
66
92
67
93
## Example
68
94
69
-
As an example, we will send 5 random messages through a TCP output connection, in the remote side we will use `nc`\(netcat\) utility to see the data.
95
+
This example sends five random messages through a TCP output connection. The remote
96
+
side uses the `nc` (netcat) utility to see the data.
70
97
71
98
Put the following configuration snippet in a file called `fluent-bit.conf`:
72
99
@@ -96,10 +123,11 @@ Put the following configuration snippet in a file called `fluent-bit.conf`:
96
123
In another terminal, start `nc` and make it listen for messages on TCP port 9090:
97
124
98
125
```text
99
-
$ nc -l 9090
126
+
nc -l 9090
100
127
```
101
128
102
-
Now start Fluent Bit with the configuration file written above and you will see the data flowing to netcat:
129
+
Start Fluent Bit with the configuration file you defined previously to see
If the `net.keepalive` option is not enabled, Fluent Bit will close the TCP connection and netcat will quit, here we can see how the keepalive connection works.
141
+
If the `net.keepalive` option isn't enabled, Fluent Bit closes the TCP connection
142
+
and netcat quits.
114
143
115
-
After the 5 records arrive, the connection will keep idle and after 10 seconds it will be closed due to `net.keepalive_idle_timeout`.
144
+
After the five records arrive, the connection idles. After 10 seconds, the connection
0 commit comments