-
Notifications
You must be signed in to change notification settings - Fork 20
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
Added ability to specifiy filter worker threads #25
base: master
Are you sure you want to change the base?
Changes from all commits
671579b
4654cec
a05a89d
b16addc
9c360ed
741a363
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
{:workers => 2, :name => "simple 1", :config => "simple.conf", :input => "simple_10.txt", :time => 5}, | ||
{:workers => 2, :name => "simple 2", :config => "simple.conf", :input => "simple_10.txt", :time => 10}, | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
describe LogStash::PerformanceMeter::Core do | ||
|
||
let(:config) { 'spec/fixtures/config.yml' } | ||
let(:logstash_home) { '.' } | ||
let(:suite_def) { 'spec/fixtures/worker_basic_suite.rb' } | ||
let(:serial_runner) { double('DummySerialRunner') } | ||
let(:runner) { LogStash::PerformanceMeter::Runner } | ||
let(:workers) { 2 } | ||
|
||
let(:run_outcome) { { :percentile => [2000] , :elapsed => 100, :events_count => 3000, :start_time => 12 } } | ||
subject(:manager) { LogStash::PerformanceMeter::Core.new(suite_def, logstash_home, config, runner) } | ||
|
||
context "with a valid configuration and worker threads set to 2" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we make the number of workers a variable here? by using a fixture, number of workers used is more hidden, just want to make sure people understand. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's good sense. Sorry it wasn't like that before. |
||
before(:each) do | ||
expect(serial_runner).to receive(:run).with(0, 5, anything()).ordered { run_outcome } | ||
expect(serial_runner).to receive(:run).with(0, 10, anything()).ordered { run_outcome } | ||
end | ||
context "using a file" do | ||
|
||
it "run each test case in a serial maner" do | ||
expect(runner).to receive(:new).with("spec/fixtures/simple.conf", workers, false, logstash_home).twice { serial_runner } | ||
manager.run | ||
end | ||
|
||
end | ||
|
||
context "without a file" do | ||
|
||
let(:config) { '' } | ||
|
||
it "run each test case as expected" do | ||
expect(runner).to receive(:read_input_file).with('simple_10.txt').twice { [] } | ||
expect(runner).to receive(:new).with("simple.conf", workers, false, logstash_home).twice { serial_runner } | ||
manager.run | ||
end | ||
|
||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add a note here about version 2.0 improvement. Since 2.0 is released and GA, workers will be assigned to half the number of cpus, but for the case of benchmarks I like the default 1 as it makes things easier to understand. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize 2.0 changed that behavior. Honestly, I would expect not specifying workers to do whatever logstash does by default when using it directly. So for 1.x that was just defaulting to 1 thread, but if 2.0 defaults to half the amount of cpu cores, I would expect that to happen when running lsperfm.
But that's just me, if you prefer having it always default to one, then I'm cool with that. If so, then yeah, we should note the behavior in a comment.
If we do decide to just have it default to whatever logstash does, then I guess the way to go about it is just construct the command send to popen to not have the -w if workers is never specified in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like more the idea of letting the tool user decide how many workers does he wants, then the expectations are more clear and should be less misunderstanding prone.