Module: PumaAutoTune

Extended by:
PumaAutoTune
Included in:
PumaAutoTune
Defined in:
lib/puma_auto_tune.rb,
lib/puma_auto_tune.rb,
lib/puma_auto_tune/hook.rb,
lib/puma_auto_tune/master.rb,
lib/puma_auto_tune/memory.rb,
lib/puma_auto_tune/worker.rb,
lib/puma_auto_tune/version.rb

Defined Under Namespace

Classes: Hook, Master, Memory, Worker

Constant Summary collapse

INFINITY =
1/0.0
RESOURCES =
{ ram: PumaAutoTune::Memory.new }
VERSION =
'0.0.1'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#frequencyObject

Returns the value of attribute frequency


17
18
19
# File 'lib/puma_auto_tune.rb', line 17

def frequency
  @frequency
end

#max_workersObject

Returns the value of attribute max_workers


17
18
19
# File 'lib/puma_auto_tune.rb', line 17

def max_workers
  @max_workers
end

#ramObject

Returns the value of attribute ram


17
18
19
# File 'lib/puma_auto_tune.rb', line 17

def ram
  @ram
end

#reap_durationObject

Returns the value of attribute reap_duration


17
18
19
# File 'lib/puma_auto_tune.rb', line 17

def reap_duration
  @reap_duration
end

Class Method Details

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (PumaAutoTune)

    the object that the method was called on


24
25
26
27
# File 'lib/puma_auto_tune.rb', line 24

def self.config
  yield self
  self
end

.hooks(name = nil, resource = nil, &block) ⇒ Object


29
30
31
32
33
34
35
36
# File 'lib/puma_auto_tune.rb', line 29

def self.hooks(name = nil, resource = nil, &block)
  @hooks       ||= {}
  return @hooks if name.nil?
  resource     ||= RESOURCES[name] || raise("no default resource specified for #{name.inspect}")
  @hooks[name] ||= Hook.new(resource)
  block.call(@hooks[name]) if block
  @hooks[name]
end

Instance Method Details

#startObject


38
39
40
# File 'lib/puma_auto_tune.rb', line 38

def start
  hooks.map {|name, hook| hook.auto_cycle}
end