Reimplement concurrency to be per process

Previously, concurrently was implemented per
storage server type as a global setting.

This commit reimplements concurrency to make it
per process (replicator/updater/reaper)

This is intended to allow the end user more
flexibility over how they implement their
swift cluster.
This commit is contained in:
François Charlier
2012-06-04 11:11:16 -07:00
committed by Dan Bode
parent 01ecb029cd
commit 18365a7c43
5 changed files with 26 additions and 8 deletions

View File

@@ -14,10 +14,9 @@ define swift::storage::server(
$mount_check = 'false', $mount_check = 'false',
$user = 'swift', $user = 'swift',
$workers = '1', $workers = '1',
$concurrency = $::processorcount, $replicator_concurrency = $::processorcount,
$replicator_concurrency = $concurrency, $updater_concurrency = $::processorcount,
$updater_concurrency = $concurrency, $reaper_concurrency = $::processorcount,
$reaper_concurrency = $concurrency,
# this parameters needs to be specified after type and name # this parameters needs to be specified after type and name
$config_file_path = "${type}-server/${name}.conf" $config_file_path = "${type}-server/${name}.conf"
) { ) {

View File

@@ -68,7 +68,6 @@ describe 'swift::storage::server' do
:devices => '/tmp/foo', :devices => '/tmp/foo',
:user => 'dan', :user => 'dan',
:mount_check => true, :mount_check => true,
:concurrency => 5,
:workers => 7, :workers => 7,
:pipeline => ['foo'] :pipeline => ['foo']
}.each do |k,v| }.each do |k,v|
@@ -94,7 +93,24 @@ describe 'swift::storage::server' do
end.should raise_error(Puppet::Error, /is not an Array/) end.should raise_error(Puppet::Error, /is not an Array/)
end end
end end
describe "when replicator_concurrency is set" do
let :params do req_params.merge({:replicator_concurrency => 42}) end
it { should contain_file(fragment_file) \
.with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m)
}
end
if t != 'account'
describe "when updater_concurrency is set" do
let :params do req_params.merge({:updater_concurrency => 73}) end
it { should contain_file(fragment_file) \ it { should contain_file(fragment_file) \
.with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m)
}
end
else
describe "when reaper_concurrency is set" do
let :params do req_params.merge({:reaper_concurrency => 4682}) end
it { should contain_file(fragment_file) \
.with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m)
} }
end end
end end

View File

@@ -6,7 +6,6 @@ mount_check = <%= mount_check %>
user = <%= user %> user = <%= user %>
log_facility = LOG_LOCAL2 log_facility = LOG_LOCAL2
workers = <%= workers %> workers = <%= workers %>
concurrency = <%= concurrency %>
[pipeline:main] [pipeline:main]
pipeline = <%= pipeline.to_a.join(' ') %> pipeline = <%= pipeline.to_a.join(' ') %>
@@ -15,7 +14,9 @@ pipeline = <%= pipeline.to_a.join(' ') %>
use = egg:swift#account use = egg:swift#account
[account-replicator] [account-replicator]
concurrency = <%= replicator_concurrency %>
[account-auditor] [account-auditor]
[account-reaper] [account-reaper]
concurrency = <%= reaper_concurrency %>

View File

@@ -6,7 +6,6 @@ mount_check = <%= mount_check %>
user = <%= user %> user = <%= user %>
log_facility = LOG_LOCAL2 log_facility = LOG_LOCAL2
workers = <%= workers %> workers = <%= workers %>
concurrency = <%= concurrency %>
[pipeline:main] [pipeline:main]
pipeline = <%= pipeline.to_a.join(' ') %> pipeline = <%= pipeline.to_a.join(' ') %>
@@ -15,8 +14,10 @@ pipeline = <%= pipeline.to_a.join(' ') %>
use = egg:swift#container use = egg:swift#container
[container-replicator] [container-replicator]
concurrency = <%= replicator_concurrency %>
[container-updater] [container-updater]
concurrency = <%= updater_concurrency %>
[container-auditor] [container-auditor]

View File

@@ -6,7 +6,6 @@ mount_check = <%= mount_check %>
user = <%= user %> user = <%= user %>
log_facility = LOG_LOCAL2 log_facility = LOG_LOCAL2
workers = <%= workers %> workers = <%= workers %>
concurrency = <%= concurrency %>
[pipeline:main] [pipeline:main]
pipeline = <%= pipeline.to_a.join(' ') %> pipeline = <%= pipeline.to_a.join(' ') %>
@@ -15,7 +14,9 @@ pipeline = <%= pipeline.to_a.join(' ') %>
use = egg:swift#object use = egg:swift#object
[object-replicator] [object-replicator]
concurrency = <%= replicator_concurrency %>
[object-updater] [object-updater]
concurrency = <%= updater_concurrency %>
[object-auditor] [object-auditor]