-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.rb
More file actions
28 lines (24 loc) · 930 Bytes
/
example.rb
File metadata and controls
28 lines (24 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$LOAD_PATH << File.dirname(__FILE__)
require 'web_tsunami'
# Triggers the following requests concurently:
# http://www.google.com
# http://www.google.com/search?q=ruby
# http://www.google.com/search?q=ruby&start=10
class GoogleTsunami < WebTsunami::Scenario
def run
get('http://www.google.com') do
puts 'http://www.google.com'
get('http://www.google.com/search?q=ruby') do
puts 'http://www.google.com/search?q=ruby'
get('http://www.google.com/search?q=ruby&start=10') do
puts 'http://www.google.com/search?q=ruby&start=10'
end
end
end
end
end
# Set concurrency and duration in seconds and start your script.
# These numbers are voluntary low because I don't want any trouble with Google.
# But don't hesitate to set a higher concurrency and a duration of almost 5 minutes
# in order to get a reliable benchmark.
GoogleTsunami.start(concurrency: 2, duration: 10)