Skip to content
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

fix environment initialization #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions examples/suite/basic_performance_long.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@
# {:name => "simple json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :events => 50000},
#]
#
TIME = 120
CONFIG_PATH = "examples/config/"
INPUT_PATH = "examples/input/"

[
{:name => "simple line in/out", :config => "config/simple.conf", :input => "input/simple_10.txt", :time => 120},
{:name => "simple line in/json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :time => 120},
{:name => "json codec in/out", :config => "config/json_inout_codec.conf", :input => "input/json_medium.txt", :time => 120},
{:name => "line in/json filter/json out", :config => "config/json_inout_filter.conf", :input => "input/json_medium.txt", :time => 120},
{:name => "apache in/json out", :config => "config/simple.conf", :input => "input/apache_log.txt", :time => 120},
{:name => "apache in/grok codec/json out", :config => "config/simple_grok.conf", :input => "input/apache_log.txt", :time => 120},
{:name => "syslog in/json out", :config => "config/complex_syslog.conf", :input => "input/syslog_acl_10.txt", :time => 120},
]
{:name => "simple line in/out", :config => "simple.conf", :input => "simple_10.txt", :time => TIME},
{:name => "simple line in/json out", :config => "simple_json_out.conf", :input => "simple_10.txt", :time => TIME},
{:name => "json codec in/out", :config => "json_inout_codec.conf", :input => "json_medium.txt", :time => TIME},
{:name => "line in/json filter/json out", :config => "json_inout_filter.conf", :input => "json_medium.txt", :time => TIME},
{:name => "apache in/json out", :config => "simple.conf", :input => "apache_log.txt", :time => TIME},
{:name => "apache in/grok codec/json out", :config => "simple_grok.conf", :input => "apache_log.txt", :time => TIME},
{:name => "syslog in/json out", :config => "complex_syslog.conf", :input => "syslog_acl_10.txt", :time => TIME},
].map do |test|
test.merge({:config => CONFIG_PATH + test[:config], :input => INPUT_PATH + test[:input], :time => TIME})
end

22 changes: 14 additions & 8 deletions examples/suite/basic_performance_quick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
# {:name => "simple json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :events => 50000},
#]
#
TIME = 30
CONFIG_PATH = "examples/config/"
INPUT_PATH = "examples/input/"

[
{:name => "simple line in/out", :config => "config/simple.conf", :input => "input/simple_10.txt", :time => 30},
{:name => "simple line in/json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :time => 30},
{:name => "json codec in/out", :config => "config/json_inout_codec.conf", :input => "input/json_medium.txt", :time => 30},
{:name => "line in/json filter/json out", :config => "config/json_inout_filter.conf", :input => "input/json_medium.txt", :time => 30},
{:name => "apache in/json out", :config => "config/simple.conf", :input => "input/apache_log.txt", :time => 30},
{:name => "apache in/grok codec/json out", :config => "config/simple_grok.conf", :input => "input/apache_log.txt", :time => 30},
{:name => "syslog in/json out", :config => "config/complex_syslog.conf", :input => "input/syslog_acl_10.txt", :time => 30},
]
{:name => "simple line in/out", :config => "simple.conf", :input => "simple_10.txt", :time => TIME},
{:name => "simple line in/json out", :config => "simple_json_out.conf", :input => "simple_10.txt", :time => TIME},
{:name => "json codec in/out", :config => "json_inout_codec.conf", :input => "json_medium.txt", :time => TIME},
{:name => "line in/json filter/json out", :config => "json_inout_filter.conf", :input => "json_medium.txt", :time => TIME},
{:name => "apache in/json out", :config => "simple.conf", :input => "apache_log.txt", :time => TIME},
{:name => "apache in/grok codec/json out", :config => "simple_grok.conf", :input => "apache_log.txt", :time => TIME},
{:name => "syslog in/json out", :config => "complex_syslog.conf", :input => "syslog_acl_10.txt", :time => TIME},
].map do |test|
test.merge({:config => CONFIG_PATH + test[:config], :input => INPUT_PATH + test[:input], :time => TIME})
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understood you properly, with this change you actually make this examples executable, isn't? I always thought this would be just examples, not intended to be runnable. What do you think?

by default the gem include the default configs, see https://github.com/elastic/logstash-performance-testing/blob/master/lib/lsperfm/defaults/suite.rb that are actually executable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, I did not even see the lib/lsperfm/defaults ... this is weird. why have both? this is uselessly duplicated. I think it should all be put into the examples dir and be runnable from there?

end
2 changes: 1 addition & 1 deletion lib/lsperfm/core/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def run(required_events_count, required_run_time, input_lines)
puts("launching #{command.join(" ")} #{required_events_count} #{required_run_time}") if @debug
stats = LogStash::PerformanceMeter::Stats.new
real_events_count = 0
Open3.popen3(*@command) do |i, o, e|
Open3.popen3({:BUNDLE_BIN_PATH => "", :BUNDLE_GEMFILE => "", :RUBYOPT => ""}, *@command) do |i, o, e|
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this change, good idea. Can we make this options passed throught a var? something like

ENV_OPTS = {:BUNDLE_BIN_PATH => "", :BUNDLE_GEMFILE => "", :RUBYOPT => ""}

and then have

Open3.popen3(ENV_OPTS, *@command)....

what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

puts("sending initial event") if @debug
start_time = Benchmark.realtime do
i.puts(INITIAL_MESSAGE)
Expand Down