phantom-manager 0.0.8 → 0.0.9

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjUzNTIwOGY1MmNjYjRlNTAxYmZjZjJhNDllMjYxNjVkN2JiOGZmZg==
4
+ YThlMjc4YTBhNmVhYTVmM2Q2MzE1OGM0NDM2Mjc2OGM3MDMwZTM0OA==
5
5
  data.tar.gz: !binary |-
6
- MzRjOWYwZTBmN2JmMWY4NTc0M2UxY2UwMGQwYmJmOWQyZmRjNmQwOA==
6
+ OTVmZDA5MTBhZTk1ZjFiMjA3NDI5ZmEzMjZmNjlhMTc0YjlmNDFiZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjEzMTA0NjNkOTIxMGMxY2YzM2E1NDE0OWI4YzZkYzRlYzY2ZGYxYTYzMmIz
10
- MWVlNjIxOTA4MzZhNWQ3ZGUwMGM5MDMxYzg3NDQ5MThiMDk5YWViMWEwY2M4
11
- NWFlMmQ2YTFjNWQ2MDlhNTQzYzUxYTBiMTJlZDM3ODQ2YzcwNmI=
9
+ NDAyZGI0Mjk4ZDMzYTBkMWEzYWYyYWI5ZjY0MWMyYzA1NTNlMjMyZmUyZjg4
10
+ YzU1ODM4ZDRkOThlYWIxNzgyM2M0NGY5NWZkNzgxMTYzNjE5NjIzZGQyY2Q4
11
+ ZWYxNjE1NzE5ZTlkMDIzYjQ3Mjc2MzA4NTA3NzQ0ZjY3MDY1Yjk=
12
12
  data.tar.gz: !binary |-
13
- MzEzNDM5NGE4YjZiNzJjYmQxY2IyN2FmNTAxYTkwZWNjNTc4MzdhYWY0ZWM0
14
- MWQ0ZjhkMjZiYmJiNTJhYTUyZjJjOGYxY2FlNWY1NjU0OWVkNzhiNzQ0MTA5
15
- ZWNkNjA1ODZkMjBmZjUzMmI3M2U2NDhkZmI5NGVkNjMzY2NiNDk=
13
+ NTVmM2IzY2Y3NzNhNmRlOGNlNTUzYmJhNTBlYzg5NDE2MWEzYmRiNWExZmM2
14
+ YWRhYTM2Y2RmMzkzNTVlNThlYmYwZDVmNmU5OTQ3MzYwYzdlNDhmYjEyMmE3
15
+ MWE3YWM2Yjc0MWFmZWViYTc1ZTU1ZDg5OTkzM2Y5ZGJlZjQxMDU=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phantom-manager (0.0.7)
4
+ phantom-manager (0.0.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -17,6 +17,7 @@ While:
17
17
 
18
18
  * Keeping your phantom-js processes running.
19
19
  * Preventing your phantom-js processes from memory-bloat.
20
+ * Making sure all phantom-js processes are responsive.
20
21
 
21
22
  This is a good way to achieve it.
22
23
 
@@ -74,7 +75,7 @@ upstream phantomjs {
74
75
 
75
76
  ## How Does It Work?
76
77
 
77
- Phantom manager will check for both presence and memory consumption of your
78
+ Phantom manager will check for presence, memory consumption and responsiveness of your
78
79
  phantom-js processes under the configuration you have defined.
79
80
 
80
81
  ### Presence
@@ -99,6 +100,21 @@ memory_check_interval: 5
99
100
  The monitor sample all phantom-js processes each 5 seconds and restart those
100
101
  which their memory exceeded 100MB for 3 straight samples.
101
102
 
103
+ ### Response Time
104
+
105
+ Assuming Configuration:
106
+
107
+ ```
108
+ response_time_threshold: 2
109
+ response_time_check_retries: 2
110
+ response_time_check_interval: 40
111
+ ```
112
+
113
+ The monitor will send an HTTP request to root path (/) of each phantom-js process.
114
+ If a response is not received within 2 seconds for 2 consecutive samples the
115
+ process will be restarted.
116
+
117
+
102
118
  ### Restarting Processes
103
119
 
104
120
  To restart a phantom-js process the monitor performs the following actions:
data/config/config.yml CHANGED
@@ -36,3 +36,5 @@ development:
36
36
  response_time_threshold: 2
37
37
  response_time_check_retries: 2
38
38
  response_time_check_interval: 40
39
+ response_time_check_host: 'localhost'
40
+ response_time_check_path: '/'
@@ -28,12 +28,12 @@ module Monitors
28
28
  private
29
29
 
30
30
  def check_response_time(process)
31
- res = `curl -o /dev/null -s -w %{time_total}@%{http_code} #{process_url(process)}`
31
+ res = `curl -o /dev/null -s -w %{time_total}@%{http_code} --header "X-Backend-Host: #{Cfg.response_time_check_host}" --header "X-Phantom: true" #{process_url(process)}`
32
32
  res.split("@").first.to_f
33
33
  end
34
34
 
35
35
  def process_url(process)
36
- "http://localhost:#{process.port}"
36
+ "http://localhost:#{process.port}#{Cfg.response_time_check_path}"
37
37
  end
38
38
  end
39
39
  end
@@ -1,5 +1,5 @@
1
1
  module Phantom
2
2
  module Manager
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -3,12 +3,8 @@ upstream unicorn {
3
3
  }
4
4
 
5
5
  upstream phantomjs {
6
- server 127.0.0.1:8000 fail_timeout=0; # 2013-10-21 10:44:21 +0200
7
- server 127.0.0.1:8000 fail_timeout=0; # 2013-10-21 10:44:21 +0200
8
- server 127.0.0.1:8012 fail_timeout=0; # 2013-10-21 10:44:21 +0200
9
- server 127.0.0.1:8013 fail_timeout=0; # 2013-10-21 10:44:21 +0200
6
+ server 127.0.0.1:8003 fail_timeout=0; # 2013-12-31 16:03:00 +0200
10
7
  server 127.0.0.1:8002;
11
- server 127.0.0.1:8003;
12
8
  server 127.0.0.1:8004;
13
9
  server 127.0.0.1:8005;
14
10
  server 127.0.0.1:8006;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phantom-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erez Rabih
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2013-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,3 +159,4 @@ test_files:
159
159
  - spec/lib/utils/shell_spec.rb
160
160
  - spec/shared_spec.rb
161
161
  - spec/spec_helper.rb
162
+ has_rdoc: