Skip to content

Commit bf90bf3

Browse files
committed
administration: performance
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 3bea250 commit bf90bf3

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
* [HTTP Proxy](administration/http-proxy.md)
7979
* [Hot Reload](administration/hot-reload.md)
8080
* [Troubleshooting](administration/troubleshooting.md)
81+
* [Performance Tips](administration/performance.md)
8182

8283
## Local Testing
8384

administration/multithreading.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ This event loop runs in the main Fluent Bit thread.
1111
To free up resources in the main thread, you can configure
1212
[inputs](../pipeline/inputs/README.md) and [outputs](../pipeline/outputs/README.md)
1313
to run in their own self-contained threads. However, inputs and outputs implement
14-
multithreading in distinct ways: inputs can run in threaded mode, and outputs
15-
can use one or more workers.
14+
multithreading in distinct ways: inputs can run in `threaded` mode, and outputs
15+
can use one or more `workers`.
1616

1717
Threading also affects certain processes related to inputs and outputs. For example,
1818
[filters](../pipeline/filters/README.md) always run in the main thread, but

administration/performance.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Performance Tips
2+
3+
Fluent Bit is designed for high performance and minimal resource usage. Depending on your use case, you can optimize further using specific configuration options to achieve faster performance or reduce resource consumption.
4+
5+
## Reading Files with Tail
6+
7+
The `Tail` input plugin is used to read data from files on the filesystem. By default, it uses a small memory buffer of `32KB` per monitored file. While this is sufficient for most generic use cases and helps keep memory usage low when monitoring many files, there are scenarios where you may want to increase performance by using more memory.
8+
9+
If your files are typically larger than `32KB`, consider increasing the buffer size to speed up file reading. For example, you can experiment with a buffer size of `128KB`:
10+
11+
```yaml
12+
pipeline:
13+
inputs:
14+
- name: tail
15+
path: '/var/log/containers/*.log'
16+
buffer_chunk_size: 128kb
17+
buffer_max_size: 128kb
18+
```
19+
20+
By increasing the buffer size, Fluent Bit will make fewer system calls (read(2)) to read the data, reducing CPU usage and improving performance.
21+
22+
## Fluent Bit and SIMD for JSON Encoding
23+
24+
Starting in Fluent Bit v3.2, performance improvements have been introduced for JSON encoding. Plugins that convert logs from Fluent Bit’s internal binary representation to JSON can now do so up to 30% faster using SIMD (Single Instruction, Multiple Data) optimizations.
25+
26+
### Enabling SIMD Support
27+
28+
Ensure that your Fluent Bit binary is built with SIMD support. This feature is available for architectures such as x86_64, amd64, aarch64, and arm64. As of now, SIMD is only enabled by default in Fluent Bit container images.
29+
30+
You can check if SIMD is enabled by looking for the following log entry when Fluent Bit starts:
31+
32+
```
33+
[2024/11/10 22:25:53] [ info] [fluent bit] version=3.2.0, commit=12cb22e0e9, pid=74359
34+
[2024/11/10 22:25:53] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, max_chunks_up=128
35+
[2024/11/10 22:25:53] [ info] [simd ] SSE2
36+
[2024/11/10 22:25:53] [ info] [cmetrics] version=0.9.8
37+
[2024/11/10 22:25:53] [ info] [ctraces ] version=0.5.7
38+
[2024/11/10 22:25:53] [ info] [sp] stream processor started
39+
```
40+
41+
Look for the simd entry, which will indicate the SIMD support type, such as SSE2, NEON, or none.
42+
43+
If your Fluent Bit binary was not built with SIMD enabled and you are using a supported platform, you can build Fluent Bit from source using the CMake option `-DFLB_SIMD=On`.
44+
45+
## Run input plugins in threaded mode
46+
47+
By default, most of input plugins runs in the same system thread than the main event loop, however by configuration you can instruct them to run in a separate thread which will allow you to take advantage of other CPU cores in your system.
48+
49+
To run an input plugin in threaded mode, just add `threaded: true` as in the example below:
50+
51+
```yaml
52+
pipeline:
53+
inputs:
54+
- name: tail
55+
path: '/var/log/containers/*.log'
56+
threaded: true
57+
```

0 commit comments

Comments
 (0)