Skip to content

Conversation

@Watson1978
Copy link
Contributor

Related to fluent/fluentd#4813

daipom pushed a commit to fluent/fluentd that referenced this pull request Feb 3, 2025
…nce (#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>
@daipom daipom self-requested a review February 3, 2025 08:07
@daipom
Copy link
Contributor

daipom commented Feb 3, 2025

Thanks!

How about adding the mention of the things before 1.19.0?

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Copy link
Contributor Author

Watson1978 commented Feb 3, 2025

Thanks.
I added the NOTE,

(The fallback has been changed from `yajl` to `json` since v1.19.0.)

Copy link
Contributor

@daipom daipom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@daipom daipom merged commit c81d1a9 into fluent:1.0 Feb 4, 2025
1 check passed
@Watson1978 Watson1978 deleted the parser_json branch August 15, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants