This repository was archived by the owner on Apr 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Added ability to specifiy filter worker threads #25
Open
daph
wants to merge
6
commits into
elastic:master
Choose a base branch
from
daph:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
671579b
Added ability to specifiy filter worker threads
daph 4654cec
Change workers var to int and convert to string in popen
daph a05a89d
Change number of workers to variable
daph b16addc
Added note about logstash 2.0 default thread number.
daph 9c360ed
Deleted with_workers examples
daph 741a363
Mixed :workers into the example suites.
daph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}, | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
Contributor
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.
Author
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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.