worker_killer 0.1.0.30337 → 0.1.1.30345
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 +4 -4
- data/README.md +4 -3
- data/lib/worker_killer.rb +3 -0
- data/lib/worker_killer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6559ab7080c973e8a1410b166af0c1385054f5c8aa06af967525808c8319fe1
|
4
|
+
data.tar.gz: f163be90a2c2de875e85b8c4db2c543d28495a6a8a38cff2a093cac0d9a3b13a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 851c5269665b10c65ee6838dbf4033f100a026c907b7d7fb72080df341851d3d8227eb192eecaa9b1417226ca9a3349dbd7e1ca54a45feea850f9fc932926990
|
7
|
+
data.tar.gz: b5fd359caeddabdea93b5beaff3fcf8887ef467cbda2732a141082c9c4244573329137fac8273e7565e6cbeee2562fa4b0b8496fdf64ab53d84d4a97f688d825
|
data/README.md
CHANGED
@@ -9,13 +9,14 @@
|
|
9
9
|
[](https://lysander.x.rnds.pro/api/v1/badges/wkiller_outdated.html)
|
10
10
|
[](https://lysander.x.rnds.pro/api/v1/badges/wkiller_vulnerable.html)
|
11
11
|
|
12
|
-
Kill any workers by memory and request counts or take custom reaction. Inspired by [unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer).
|
12
|
+
Kill any workers by memory and/or request counts or take custom reaction. Inspired by [unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer).
|
13
13
|
|
14
14
|
`worker-killer` gem provides automatic restart of Web-server based on 1) max number of requests, and 2) process memory size (RSS). This will greatly improves site's stability by avoiding unexpected memory exhaustion at the application nodes.
|
15
15
|
|
16
16
|
Features:
|
17
17
|
|
18
18
|
* generic middleware implementation
|
19
|
+
* Phusion Passenger support(through `passenger-config detach-process <PID>`)
|
19
20
|
* custom reaction hook
|
20
21
|
|
21
22
|
Planned:
|
@@ -48,7 +49,7 @@ This gem provides two modules: WorkerKiller::CountLimiter and WorkerKiller::Memo
|
|
48
49
|
|
49
50
|
### WorkerKiller::Middleware::RequestsLimiter
|
50
51
|
|
51
|
-
This module automatically restarts the
|
52
|
+
This module automatically restarts/kills the workers, based on the number of requests which worker processed.
|
52
53
|
|
53
54
|
`min` and `max` specify the min and max of maximum requests per worker. The actual limit is decided by rand() between `min` and `max` per worker, to prevent all workers to be dead at the same time. Once the number exceeds the limit, that worker is automatically restarted.
|
54
55
|
|
@@ -56,7 +57,7 @@ If `verbose` is set to true, then after every request, your log will show the re
|
|
56
57
|
|
57
58
|
### WorkerKiller::Middleware::OOMLimiter
|
58
59
|
|
59
|
-
This module automatically restarts the
|
60
|
+
This module automatically restarts/kills the workers, based on its memory size.
|
60
61
|
|
61
62
|
`min` and `max` specify the min and max of maximum memory in bytes per worker. The actual limit is decided by rand() between `min` and `max` per worker, to prevent all workers to be dead at the same time. Once the memory size exceeds `memory_size`, that worker is automatically restarted.
|
62
63
|
|
data/lib/worker_killer.rb
CHANGED
@@ -55,6 +55,9 @@ module WorkerKiller
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.kill_by_passenger(logger, alive_sec, passenger, pid)
|
58
|
+
return if @already_detached
|
59
|
+
@already_detached = true
|
60
|
+
|
58
61
|
cmd = "#{passenger} detach-process #{pid}"
|
59
62
|
logger.warn "#{self} run #{cmd.inspect} (pid: #{pid}) alive: #{alive_sec} sec (trial #{@kill_attempts})"
|
60
63
|
Thread.new(cmd) do |command|
|