Puppet Class: profile::memcached::instance

Defined in:
modules/profile/manifests/memcached/instance.pp

Overview

Class: profile::memcached::instance

Installs and configures a memcached instance.

Parameters

version

There are different package versions available due to a performance test, most of them are deployed/installed manually. More info: T129963

port

Memcached TCP listening port.

size

Memcached max memory allocated size.

extended_options

Extended options to enable various memcached features.

max_seq_reqs

Maximum number of sequential requests (over the same TCP conn) that memcached will process before yielding to another connection (to avoid starving clients). Sets the '-R' option in memcached. Default: 200 (memcached's default is 20)

growth_factor

Slab growth factor. Default: 1.25

min_slab_size

Size of the first/smallest slab. The other slabs will be created using the growth_factor parameter. Default: 48

threads

Processing threads used by memcached. Sets the '-t' option in memcached. Before 1.5.x, the extensive use of locks was limiting the scalability up to a maximum of 8. Default: undef (memcached's default is 4)

Parameters:

  • version (String) (defaults to: lookup('profile::memcached::version'))
  • port (Stdlib::Port) (defaults to: lookup('profile::memcached::port'))
  • size (Integer) (defaults to: lookup('profile::memcached::size'))
  • extended_options (Array[String]) (defaults to: lookup('profile::memcached::extended_options', {merge => unique}))
  • max_seq_reqs (Integer) (defaults to: lookup('profile::memcached::max_seq_reqs', {'default_value' => 200}))
  • min_slab_size (Integer) (defaults to: lookup('profile::memcached::min_slab_size', {'default_value' => 48}))
  • growth_factor (Float) (defaults to: lookup('profile::memcached::growth_factor', {'default_value' => 1.25}))
  • threads (Optional[Integer]) (defaults to: lookup('profile::memcached::threads', {'default_value' => undef}))


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'modules/profile/manifests/memcached/instance.pp', line 41

class profile::memcached::instance (
    String $version                 = lookup('profile::memcached::version'),
    Stdlib::Port $port              = lookup('profile::memcached::port'),
    Integer $size                   = lookup('profile::memcached::size'),
    Array[String] $extended_options = lookup('profile::memcached::extended_options', {merge => unique}),
    Integer $max_seq_reqs           = lookup('profile::memcached::max_seq_reqs', {'default_value' => 200}),
    Integer $min_slab_size          = lookup('profile::memcached::min_slab_size', {'default_value' => 48}),
    Float $growth_factor            = lookup('profile::memcached::growth_factor', {'default_value' => 1.25}),
    Optional[Integer] $threads      = lookup('profile::memcached::threads', {'default_value' => undef}),
) {
    include ::profile::prometheus::memcached_exporter

    $base_extra_options = {
        '-o' => join($extended_options, ','),
        '-D' => ':',
    }

    if $max_seq_reqs {
        $max_seq_reqs_opt = {'-R' => $max_seq_reqs}
    } else {
        $max_seq_reqs_opt = {}
    }

    if $threads {
        $threads_opt = {'-t' => $threads}
    } else {
        $threads_opt = {}
    }

    $extra_options = $base_extra_options + $max_seq_reqs_opt + $threads_opt

    class { '::memcached':
        size          => $size,
        port          => $port,
        version       => $version,
        growth_factor => $growth_factor,
        min_slab_size => $min_slab_size,
        extra_options => $extra_options,
    }

    ferm::service { 'memcached':
        proto => 'tcp',
        port  => $port,
    }
}