-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory not release #453
Comments
match config
|
Similar issue is reported on Fluentd core upstream: |
@lixianyang Could you paste your whole configuration? |
@repeatedly Yes, when I use out_file, the memory aways around 50M.
out_es config:
testlog.template
|
out_file test pmap -d $pid:(write more than es test log) out_es pmap -d $pid:(write 1000000 logs) |
@lixianyang Could you try |
@cosmo0920 It doesn't work. I use docker stats command: 651.3MiB / 10.66GiB(MEM USAGE / LIMIT)
fluentd.conf
pmap -p $pid
|
My test config files: fluentd-es-test |
I've tested with modified ES plugin and @lixianyang 's test script. I collected memory usage but I cannot find memory leak on ES plugin. ES plugin patch: diff --git a/Gemfile b/Gemfile
index ca132d6..ddb7e03 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,3 +6,4 @@ gemspec
gem 'simplecov', require: false
gem 'coveralls', require: false
gem 'strptime', require: false if RUBY_ENGINE == "ruby" && RUBY_VERSION =~ /^2/
+gem 'memprof2'
diff --git a/lib/fluent/plugin/out_elasticsearch.rb b/lib/fluent/plugin/out_elasticsearch.rb
index e6cd110..6ea1510 100644
--- a/lib/fluent/plugin/out_elasticsearch.rb
+++ b/lib/fluent/plugin/out_elasticsearch.rb
@@ -4,6 +4,7 @@ require 'excon'
require 'elasticsearch'
require 'json'
require 'uri'
+require 'memprof2'
begin
require 'strptime'
rescue LoadError
@@ -126,8 +127,19 @@ EOC
def initialize
super
+
+ Memprof2.start
end
+ def shutdown
+ puts " !!!!--- report ---!!!!"
+ Memprof2.report
+ Memprof2.stop
+ puts " !!!!--- report end ---!!!"
+
+ super
+ end
+
def configure(conf)
compat_parameters_convert(conf, :buffer)
Here is memory-report.txt. Sorted result is:
|
i didn't find any culprit of high memory usage/memory leak on ES plugin itself. |
I replaced serialize class to use Oj, but this issue still exists. |
Currently, I investigated this issue and to be revealed that:
|
@cosmo0920 |
With Yajl, around 700〜800MB.
JSON encode/decode needs to consume memory to be proportional JSON size. If you need to handle enormous logs, you need to increase memory limit. |
Thanks |
I also have this problem, and memory is high. pmap -x $pid total kB 10051720 4891440 4888460 |
Could you check your log flow rate? |
Log flow rate is high, but how can I find the specific flow rate? |
The issue is still in place, the workaround
is still working with the plugin version 5.1.5 and es version 7.17.0 |
Problem
I use fluentd in docker with memory limit. I test it some times. The process's memory increase until kernel kill the worker0 and restart.
test:
a script write logs to fluentd (4000/s)
Steps to replicate
Dockerfile
pmap output
Expected Behavior or What you need to ask
memory decrease when no log write to es
Using Fluentd and ES plugin versions
bigdecimal (1.2.8)
cool.io (1.5.3)
did_you_mean (1.0.0)
dig_rb (1.0.1)
elasticsearch (6.1.0)
elasticsearch-api (6.1.0)
elasticsearch-transport (6.1.0)
excon (0.62.0)
faraday (0.15.2)
fluent-plugin-elasticsearch (2.11.3)
fluentd (1.2.2)
http_parser.rb (0.6.0)
io-console (0.4.5)
json (2.1.0, 1.8.3)
minitest (5.9.0)
msgpack (1.2.4)
multi_json (1.13.1)
multipart-post (2.0.0)
net-telnet (0.1.1)
oj (3.3.10)
power_assert (0.2.7)
psych (2.1.0)
rake (10.5.0)
rdoc (4.2.1)
serverengine (2.0.6)
sigdump (0.2.4)
strptime (0.2.3)
test-unit (3.1.7)
thread_safe (0.3.6)
tzinfo (1.2.5)
tzinfo-data (1.2018.5)
yajl-ruby (1.4.0)
The text was updated successfully, but these errors were encountered: