drnbench 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ # Copyright (C) 2013-2014 Droonga Project
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Drnbench
17
+ module Server
18
+ class EngineConfiguration
19
+ attr_accessor :host, :port, :tag
20
+ attr_accessor :base_path, :engine_config_path
21
+ attr_accessor :fluentd, :fluentd_options
22
+
23
+ def initialize
24
+ @port = 24224
25
+ @host = "localhost"
26
+ @tag = "droonga"
27
+ @base_path = Pathname(Dir.pwd)
28
+ @fluentd = "fluentd"
29
+ @fluentd_options = []
30
+ end
31
+
32
+ def engine_config_path=(path)
33
+ @engine_config_path = path
34
+ engine_config_path
35
+ end
36
+
37
+ def engine_config_path
38
+ Pathname(@engine_config_path).expand_path(@base_path)
39
+ end
40
+ end
41
+
42
+ class ProtocolAdapterConfiguration
43
+ attr_accessor :application_dir, :host, :port, :receive_port, :default_dataset
44
+ attr_accessor :node, :node_options
45
+ attr_accessor :engine
46
+
47
+ def initialize
48
+ @application_dir = Pathname(Dir.pwd)
49
+ @host = "localhost"
50
+ @port = 80
51
+ @receive_port = 14224
52
+ @default_dataset = "Droonga"
53
+ @node = "node"
54
+ @node_options = []
55
+ @engine = nil
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,21 @@
1
+ # Copyright (C) 2013-2014 Droonga Project
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "drntest/engine"
17
+
18
+ module Drnbench
19
+ class Engine < Drntest::Engine
20
+ end
21
+ end
@@ -0,0 +1,89 @@
1
+ # Copyright (C) 2013-2014 Droonga Project
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "pathname"
17
+
18
+ module Drnbench
19
+ class ProtocolAdapter
20
+ attr_reader :port
21
+
22
+ def initialize(config)
23
+ @config = config
24
+
25
+ @host = @config.host
26
+ @port = @config.port
27
+ @receive_port = @config.receive_port
28
+ @default_dataset = @config.default_dataset
29
+
30
+ @application_dir = Pathname(@config.application_dir)
31
+ @node = @config.node
32
+ @node_options = @config.node_options
33
+ end
34
+
35
+ def start
36
+ setup
37
+ end
38
+
39
+ def stop
40
+ teardown
41
+ end
42
+
43
+ def application_file
44
+ @application_dir + "application.js"
45
+ end
46
+
47
+ private
48
+ def setup
49
+ command = [
50
+ @node,
51
+ application_file.to_s,
52
+ *@node_options,
53
+ ]
54
+ env = {
55
+ "DROONGA_ENGINE_DEFAULT_DATASET" => @default_dataset,
56
+ "DROONGA_ENGINE_HOST" => @config.engine.host,
57
+ "DROONGA_ENGINE_PORT" => @config.engine.port.to_s,
58
+ "DROONGA_ENGINE_TAG" => @config.engine.tag,
59
+ "DROONGA_ENGINE_RECEIVE_HOST" => @host,
60
+ "DROONGA_ENGINE_RECEIVE_PORT" => @receive_port.to_s,
61
+ }
62
+ arguments = [env, *command]
63
+ @pid = Process.spawn(*arguments)
64
+
65
+ wait_until_ready
66
+ end
67
+
68
+ def teardown
69
+ Process.kill(:TERM, @pid)
70
+ Process.wait(@pid)
71
+ end
72
+
73
+ def ready?
74
+ begin
75
+ socket = TCPSocket.new(@host, @port)
76
+ socket.close
77
+ true
78
+ rescue Errno::ECONNREFUSED
79
+ false
80
+ end
81
+ end
82
+
83
+ def wait_until_ready
84
+ until ready?
85
+ sleep 1
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,18 @@
1
+ # Copyright (C) 2013-2014 Droonga Project
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Drnbench
17
+ VERSION = "1.0.0"
18
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: drnbench
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - YUKI Hiroshi
8
+ - Kouhei Sutou
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-01-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: droonga-client
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: drntest
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: packnga
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: kramdown
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ description: It may be used for other HTTP servers.
113
+ email:
114
+ - yuki@clear-code.com
115
+ - kou@clear-code.com
116
+ executables:
117
+ - drnbench-publish-subscribe
118
+ - drnbench-request-response
119
+ extensions: []
120
+ extra_rdoc_files: []
121
+ files:
122
+ - README.md
123
+ - Rakefile
124
+ - Gemfile
125
+ - drnbench.gemspec
126
+ - LICENSE.txt
127
+ - doc/text/news.md
128
+ - lib/drnbench.rb
129
+ - lib/drnbench/request-response/result.rb
130
+ - lib/drnbench/request-response/configuration.rb
131
+ - lib/drnbench/request-response/runner.rb
132
+ - lib/drnbench/request-response/gradual-runner.rb
133
+ - lib/drnbench/publish-subscribe/watch.rb
134
+ - lib/drnbench/publish-subscribe/configuration.rb
135
+ - lib/drnbench/publish-subscribe/runner.rb
136
+ - lib/drnbench/publish-subscribe/gradual-runner.rb
137
+ - lib/drnbench/version.rb
138
+ - lib/drnbench/client/http-droonga.rb
139
+ - lib/drnbench/client/http.rb
140
+ - lib/drnbench/server/protocol-adapter.rb
141
+ - lib/drnbench/server/configuration.rb
142
+ - lib/drnbench/server/engine.rb
143
+ - bin/drnbench-publish-subscribe
144
+ - bin/drnbench-request-response
145
+ homepage: https://github.com/groonga/grntest
146
+ licenses:
147
+ - GPLv3 or later
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubyforge_project:
165
+ rubygems_version: 2.0.14
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: Drnbench is a benchmark tool for Droonga.
169
+ test_files: []
170
+ has_rdoc: