web_tsunami 0.0.1 → 0.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +8 -3
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/example.rb +1 -1
- data/lib/web_tsunami/version.rb +3 -0
- data/{web_tsunami.rb → lib/web_tsunami.rb} +3 -4
- data/web_tsunami.gemspec +22 -0
- metadata +36 -18
- data/README +0 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2a151d3928ef65c636d341b5c00c4aab1f51314f7bb809e845f1281782b172db
|
4
|
+
data.tar.gz: '08597d6fcdb0157c1636033ebc92c2a0a0accd66d023ae6d609817f60d371756'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f987ec8a711515c8bf5c8045b8fb074b8e4617af5c802e66cf0900b2e5df89eaeb286b78a529ef9508d7629ed365bbe73384bb722308a77dd26084d2ddce361
|
7
|
+
data.tar.gz: e9e2e9d3c9c975b3f6f2b6ce3ea2657da4bd806819944b34ea7824621e85700637b340a2dab3388af74723d1391080e45da8b766488fbc9d1a41d0369bfcb521
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ethon (0.16.0)
|
5
|
+
ffi (>= 1.15.0)
|
6
|
+
ffi (1.16.3)
|
7
|
+
typhoeus (1.4.1)
|
8
|
+
ethon (>= 0.9.0)
|
7
9
|
|
8
10
|
PLATFORMS
|
9
11
|
ruby
|
10
12
|
|
11
13
|
DEPENDENCIES
|
12
14
|
typhoeus
|
15
|
+
|
16
|
+
BUNDLED WITH
|
17
|
+
2.2.22
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2024 Alexis Bernard
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Web Tsunami
|
2
|
+
|
3
|
+
Write tailor-made scenarios for load testing web apps
|
4
|
+
|
5
|
+
## Why
|
6
|
+
|
7
|
+
Many good tools already exist for a very long time such as ApacheBench and Siege.
|
8
|
+
But, sometimes load testing a web app requires to write a custom scenario.
|
9
|
+
The goal is to focus only on the scenario without thinking about forking, threads and non blocking IOs.
|
10
|
+
Fortunately there is [Typhoeus](https://github.com/typhoeus/typhoeus) to send parallel HTTP requests.
|
11
|
+
|
12
|
+
Web Tsunami is a tiny class that forks every seconds and sends as many requests as expected.
|
13
|
+
|
14
|
+
## Example
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
class Example < WebTsunami::Scenario
|
18
|
+
def run
|
19
|
+
get("http://site.example") do
|
20
|
+
# Block is executed once the response has been received
|
21
|
+
sleep(5) # Simulates the time required for a human to visit the next page
|
22
|
+
get("http://site.example/search?query=stress+test") do |response|
|
23
|
+
# Do whatever you need with the response object or ignore it
|
24
|
+
sleep(10)
|
25
|
+
get("http://site.example/search?query=stress+test&page=2") do
|
26
|
+
sleep(5)
|
27
|
+
get("http://site.example/stress/test")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Simulates 100 concurrent visitors every second for 10 minutes
|
35
|
+
# It's a total of 60K unique visitors for an average of 23'220 rpm.
|
36
|
+
Example.start(concurrency: 100, duration: 60 * 10)
|
37
|
+
```
|
38
|
+
|
39
|
+
In this example, the same requests are always sent.
|
40
|
+
But you can provide dynamic query strings, use variables and some randomness.
|
41
|
+
|
42
|
+
## Output and result
|
43
|
+
|
44
|
+
Web Tsunami does not measure response time or print any result.
|
45
|
+
If you are running a load test, that means you should use an APM (application performance monitoring).
|
46
|
+
It already collects and displays all data you need such as throughput, response time and bottlenecks.
|
47
|
+
|
48
|
+
So, the only output are errors.
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open-source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
53
|
+
|
54
|
+
Rails developer? Check out [RoRvsWild](https://rorvswild.com), our Ruby on Rails application monitoring tool.
|
data/example.rb
CHANGED
@@ -13,7 +13,7 @@ class GoogleTsunami < WebTsunami::Scenario
|
|
13
13
|
puts 'http://www.google.com'
|
14
14
|
get('http://www.google.com/search?q=ruby') do
|
15
15
|
puts 'http://www.google.com/search?q=ruby'
|
16
|
-
get(
|
16
|
+
get('http://www.google.com/search?q=ruby&start=10') do
|
17
17
|
puts 'http://www.google.com/search?q=ruby&start=10'
|
18
18
|
end
|
19
19
|
end
|
@@ -18,8 +18,7 @@ module WebTsunami
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def requests
|
21
|
-
|
22
|
-
@requests
|
21
|
+
@requests ||= Typhoeus::Hydra.new
|
23
22
|
end
|
24
23
|
|
25
24
|
def get(url, &block)
|
@@ -28,7 +27,7 @@ module WebTsunami
|
|
28
27
|
if response.timed_out?
|
29
28
|
puts "Timeout #{url}"
|
30
29
|
elsif response.code == 0
|
31
|
-
puts "#{response.
|
30
|
+
puts "#{response.return_message} #{url}"
|
32
31
|
elsif !response.success? && response.code != 302
|
33
32
|
puts "#{response.code} #{url}"
|
34
33
|
end
|
@@ -37,7 +36,7 @@ module WebTsunami
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def start
|
40
|
-
concurrency.times {
|
39
|
+
concurrency.times { run }
|
41
40
|
requests.run
|
42
41
|
end
|
43
42
|
|
data/web_tsunami.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require_relative "lib/web_tsunami/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "web_tsunami"
|
7
|
+
s.version = WebTsunami::VERSION
|
8
|
+
s.authors = ["Alexis Bernard"]
|
9
|
+
s.email = ["alexis@basesecrete.com"]
|
10
|
+
s.homepage = "https://github.com/BaseSecrete/web_tsunami"
|
11
|
+
s.summary = "Tailor-made load testing for web apps"
|
12
|
+
s.description = "Write realistic scenarios to test the load of a web application."
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.metadata["source_code_uri"] = "https://github.com/BaseSecrete/web_tsunami"
|
19
|
+
s.metadata["changelog_uri"] = "https://github.com/BaseSecrete/web_tsunami/blob/master/CHANGELOG.md"
|
20
|
+
|
21
|
+
s.add_runtime_dependency "typhoeus"
|
22
|
+
end
|
metadata
CHANGED
@@ -1,50 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_tsunami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Alexis Bernard
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: typhoeus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Write realistic scenarios to test the load of a web application.
|
15
28
|
email:
|
16
|
-
- alexis@
|
29
|
+
- alexis@basesecrete.com
|
17
30
|
executables: []
|
18
31
|
extensions: []
|
19
32
|
extra_rdoc_files: []
|
20
33
|
files:
|
34
|
+
- CHANGELOG.md
|
21
35
|
- Gemfile
|
22
36
|
- Gemfile.lock
|
23
|
-
-
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
24
39
|
- example.rb
|
25
|
-
- web_tsunami.rb
|
26
|
-
|
27
|
-
|
40
|
+
- lib/web_tsunami.rb
|
41
|
+
- lib/web_tsunami/version.rb
|
42
|
+
- web_tsunami.gemspec
|
43
|
+
homepage: https://github.com/BaseSecrete/web_tsunami
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata:
|
47
|
+
source_code_uri: https://github.com/BaseSecrete/web_tsunami
|
48
|
+
changelog_uri: https://github.com/BaseSecrete/web_tsunami/blob/master/CHANGELOG.md
|
28
49
|
post_install_message:
|
29
50
|
rdoc_options: []
|
30
51
|
require_paths:
|
31
52
|
- lib
|
32
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
54
|
requirements:
|
35
|
-
- -
|
55
|
+
- - ">="
|
36
56
|
- !ruby/object:Gem::Version
|
37
57
|
version: '0'
|
38
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
59
|
requirements:
|
41
|
-
- -
|
60
|
+
- - ">="
|
42
61
|
- !ruby/object:Gem::Version
|
43
62
|
version: '0'
|
44
63
|
requirements: []
|
45
|
-
|
46
|
-
rubygems_version: 1.8.10
|
64
|
+
rubygems_version: 3.2.22
|
47
65
|
signing_key:
|
48
|
-
specification_version:
|
49
|
-
summary:
|
66
|
+
specification_version: 4
|
67
|
+
summary: Tailor-made load testing for web apps
|
50
68
|
test_files: []
|
data/README
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
Benchmark your web application.
|
2
|
-
|
3
|
-
Why not using Apache Benchmark or any similar tool?
|
4
|
-
|
5
|
-
Because some times we need to send unique requests and AB doesn't fit for that need.
|
6
|
-
|
7
|
-
Check example.rb to see how it's working.
|
8
|
-
|
9
|
-
More documentation and gem is coming soon.
|