Commit 1d5b0de
authored
parser_json: use JSON as fallback parser instead of Yajl for performance (#4813)
**Which issue(s) this PR fixes**:
Fixes #
**What this PR does / why we need it**:
Recently, Ruby's json has incredible performance improvements.
It might be faster than oj gem.
So, I think json is a suitable as fallback.
This is similar with #4759
Here is easily benchmark. (I used same log file in #4759)
* Before
* It spent 90.50963662 sec to handle 10 GB file
* After
* It spent 74.624230077 sec to handle 10 GB file
* config
```
<source>
@type tail
path "#{File.expand_path '~/tmp/access*.log'}"
pos_file "#{File.expand_path '~/tmp/fluentd/access.log.pos'}"
tag log
read_from_head true
<parse>
@type json
</parse>
</source>
<match **>
@type file
path "#{File.expand_path '~/tmp/fluentd/log'}"
</match>
```
FYI)
*
https://byroot.github.io/ruby/json/2024/12/15/optimizing-ruby-json-part-1.html
*
https://byroot.github.io/ruby/json/2024/12/18/optimizing-ruby-json-part-2.html
*
https://byroot.github.io/ruby/json/2024/12/27/optimizing-ruby-json-part-3.html
*
https://byroot.github.io/ruby/json/2024/12/29/optimizing-ruby-json-part-4.html
*
https://byroot.github.io/ruby/json/2025/01/04/optimizing-ruby-json-part-5.html
*
https://byroot.github.io/ruby/json/2025/01/12/optimizing-ruby-json-part-6.html
*
https://byroot.github.io/ruby/json/2025/01/14/optimizing-ruby-json-part-7.html
**Docs Changes**:
fluent/fluentd-docs-gitbook#560
**Release Note**:
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>1 parent 24f08be commit 1d5b0de
File tree
2 files changed
+4
-4
lines changed- lib/fluent/plugin
- test/plugin
2 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments