Skip to content

Commit

Permalink
Merge pull request #50 from joshuaspence/master
Browse files Browse the repository at this point in the history
Add support for large memory pages
  • Loading branch information
saz committed Nov 19, 2014
2 parents b1c0011 + 5973ec8 commit 57fdf41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ If you find this module useful, send some bitcoins to 1Na3YFUmdxKxJLiuRXQYJU2kiN
* $processorcount = $::processorcount
* $service_restart = true (restart service after configuration changes, false to prevent restarts)
* $use_sasl = false (start memcached with SASL support)
* $large_mem_pages = false (try to use large memory pages)
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
$processorcount = $::processorcount,
$service_restart = true,
$auto_removal = false,
$use_sasl = false
$use_sasl = false,
$large_mem_pages = false,
) inherits memcached::params {

# validate type and convert string to boolean if necessary
Expand Down
9 changes: 7 additions & 2 deletions spec/classes/memcached_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
:max_connections => '8192',
:install_dev => false,
:processorcount => 1,
:use_sasl => false
:use_sasl => false,
:large_mem_pages => false,
}
end

Expand All @@ -78,7 +79,8 @@
:max_connections => '8193',
:verbosity => 'vvv',
:processorcount => 3,
:use_sasl => true
:use_sasl => true,
:large_mem_pages => true,
},
{
:package_ensure => 'present',
Expand Down Expand Up @@ -189,6 +191,9 @@
if(param_hash[:use_sasl])
expected_lines.push("-S")
end
if(param_hash[:large_mem_pages])
expected_lines.push("-L")
end
(content.split("\n") & expected_lines).should =~ expected_lines
end
end
Expand Down
7 changes: 6 additions & 1 deletion templates/memcached.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ logfile <%= @logfile -%>
# Run daemon as user
-u <%= @user %>

<% if @large_mem_pages -%>
# Try to use large memory pages (if available)
-L
<% end -%>

# Limit the number of simultaneous incoming connections.
-c <%= @max_connections %>

Expand All @@ -59,4 +64,4 @@ logfile <%= @logfile -%>
<% if @auto_removal -%>
# Disable automatic removal of items from the cache when out of memory
-M
<% end -%>
<% end -%>

0 comments on commit 57fdf41

Please sign in to comment.