Revert to use only a single worker by default on outputs

The move to auto-scale output workers was great in theory, but a lot of outputs
just weren't built to support it well, they often used too many resources or had
logical errors.

Fixes #4905
This commit is contained in:
Andrew Cholakian 2016-03-28 12:11:58 -05:00
parent fff4e2440e
commit 0188a7f3f9
2 changed files with 4 additions and 6 deletions

View file

@ -19,6 +19,8 @@ require "logstash/output_delegator"
module LogStash; class Pipeline
attr_reader :inputs, :filters, :outputs, :worker_threads, :events_consumed, :events_filtered, :reporter, :pipeline_id, :logger, :thread, :config_str, :original_settings
DEFAULT_OUTPUT_WORKERS = 1
DEFAULT_SETTINGS = {
:default_pipeline_workers => LogStash::Config::CpuCoreStrategy.maximum,
:pipeline_batch_size => 125,
@ -413,16 +415,12 @@ module LogStash; class Pipeline
klass = LogStash::Plugin.lookup(plugin_type, name)
if plugin_type == "output"
LogStash::OutputDelegator.new(@logger, klass, default_output_workers, *args)
LogStash::OutputDelegator.new(@logger, klass, DEFAULT_OUTPUT_WORKERS, *args)
else
klass.new(*args)
end
end
def default_output_workers
@settings[:pipeline_workers] || @settings[:default_pipeline_workers]
end
# for backward compatibility in devutils for the rspec helpers, this method is not used
# in the pipeline anymore.
def filter(event, &block)

View file

@ -209,7 +209,7 @@ describe LogStash::Pipeline do
pipeline.run
expect(pipeline.outputs.size ).to eq(1)
expect(pipeline.outputs.first.workers.size ).to eq(pipeline.default_output_workers)
expect(pipeline.outputs.first.workers.size ).to eq(::LogStash::Pipeline::DEFAULT_OUTPUT_WORKERS)
expect(pipeline.outputs.first.workers.first.num_closes ).to eq(1)
end