Add swift::bench to manage swift-bench.conf

This patch adds a conf file swift-bench.conf
for swift performance bench, and add a spec
test for it.

Fixed bug 1188968

Change-Id: Iafb67f116a9403bba96328be7c9c09d21a65a74c
This commit is contained in:
Newptone 2013-06-09 00:00:48 +08:00
parent 75e29ee2be
commit 45cec2d3fb
3 changed files with 161 additions and 0 deletions

26
manifests/bench.pp Normal file
View File

@ -0,0 +1,26 @@
# Configure swift-bench.conf for swift performance bench
class swift::bench (
$auth_url = 'http://localhost:8080/auth/v1.0',
$swift_user = 'test:tester',
$swift_key = 'testing',
$auth_version = '1.0',
$log_level = 'INFO',
$test_timeout = '10',
$put_concurrency = '10',
$get_concurrency = '10',
$del_concurrency = '10',
$lower_object_size = '10',
$upper_object_size = '10',
$object_size = '1',
$num_objects = '1000',
$num_gets = '10000',
$num_containers = '20',
$delete = 'yes',
){
file {'/etc/swift/swift-bench.conf':
ensure => present,
mode => '0644',
content => template('swift/swift-bench.conf.erb')
}
}

View File

@ -0,0 +1,75 @@
require 'spec_helper'
describe 'swift::bench' do
let :default_params do
{:auth_url => 'http://localhost:8080/auth/v1.0'}
end
describe 'with defaults' do
let :params do
default_params
end
it 'should create a reasonable swift-bench file' do
verify_contents(subject, '/etc/swift/swift-bench.conf',
[
"auth = http://localhost:8080/auth/v1.0",
"user = test:tester",
"key = testing",
"auth_version = 1.0",
"log-level = INFO",
"timeout = 10",
"put_concurrency = 10",
"get_concurrency = 10",
"del_concurrency = 10",
"lower_object_size = 10",
"upper_object_size = 10",
"object_size = 1",
"num_objects = 1000",
"num_gets = 10000",
"num_containers = 20",
"delete = yes"
]
)
end
end
describe 'when overridding' do
let :params do
default_params.merge({
:auth_url => 'http://127.0.0.1:8080/auth/v1.0',
:swift_user => 'admin:admin',
:swift_key => 'admin',
:put_concurrency => '20'
})
end
it 'should create a configured swift-bench file' do
verify_contents(subject, '/etc/swift/swift-bench.conf',
[
"auth = http://127.0.0.1:8080/auth/v1.0",
"user = admin:admin",
"key = admin",
"auth_version = 1.0",
"log-level = INFO",
"timeout = 10",
"put_concurrency = 20",
"get_concurrency = 10",
"del_concurrency = 10",
"lower_object_size = 10",
"upper_object_size = 10",
"object_size = 1",
"num_objects = 1000",
"num_gets = 10000",
"num_containers = 20",
"delete = yes"
]
)
end
end
end

View File

@ -0,0 +1,60 @@
[bench]
auth = <%= auth_url %>
user = <%= swift_user %>
key = <%= swift_key %>
auth_version = <%= auth_version %>
log-level = <%= log_level %>
timeout = <%= test_timeout %>
# You can configure PUT, GET, and DELETE concurrency independently or set all
# three with "concurrency"
put_concurrency = <%= put_concurrency %>
get_concurrency = <%= get_concurrency %>
del_concurrency = <%= del_concurrency %>
# concurrency =
# A space-sep list of files whose contents will be read and randomly chosen
# as the body (object contents) for each PUT.
# object_sources =
# If object_sources is not set and lower_object_size != upper_object_size,
# each PUT will randomly select an object size between the two values. Units
# are bytes.
lower_object_size = <%= lower_object_size %>
upper_object_size = <%= upper_object_size %>
# If object_sources is not set and lower_object_size == upper_object_size,
# every object PUT will contain this many bytes.
object_size = <%= object_size %>
num_objects = <%= num_objects %>
num_gets = <%= num_gets %>
num_containers = <%= num_containers %>
# The base name for created containers.
# container_name = (randomly-chosen uuid4)
# Should swift-bench benchmark DELETEing the created objects and then delete
# all created containers?
delete = <%= delete %>
# Without use_proxy, swift-bench will talk directly to the backend Swift
# servers. Doing that will require "url", "account", and at least one
# "devices" entry.
# use_proxy = yes
# If use_proxy = yes, this will override any returned X-Storage-Url returned
# by authenticaion (the account name will still be extracted from
# X-Storage-Url though and may NOT be set with the "account" conf var). If
# use_proxy = no, this setting is required and used as the X-Storage-Url when
# deleting containers and as a source for IP and port for back-end Swift server
# connections. The IP and port specified in this setting must have local
# storage access to every device specified in "devices".
# url =
# Only used (and required) when use_proxy = no.
# account =
# A space-sep list of devices names; only relevant (and required) when
# use_proxy = no.
# devices = sdb1