Enable use of splice in object server

Use splice() for zero-copy object GETs. This requires Linux kernel
version 3.0 or greater

Change-Id: I0c25b0f99c7fabe5def4ab253c0164a88c250796
This commit is contained in:
Thiago da Silva 2018-07-09 03:17:18 -04:00
parent f9a446d3bd
commit 287f2113c9
5 changed files with 28 additions and 1 deletions

View File

@ -109,6 +109,11 @@
# (optional) Number of account server workers.
# Defaults to undef.
#
# [*splice*]
# (optional) Use splice for zero-copy object GETs. This requires Linux Kernel
# version 3.0 or greater.
# Defaults to false.
#
class swift::storage::all(
$storage_local_net_ip,
$devices = '/srv/node',
@ -136,6 +141,7 @@ class swift::storage::all(
$account_server_workers = undef,
$container_server_workers = undef,
$object_server_workers = undef,
$splice = false,
) {
include ::swift::deps
@ -203,5 +209,6 @@ class swift::storage::all(
incoming_chmod => $incoming_chmod,
outgoing_chmod => $outgoing_chmod,
workers => $object_server_workers,
splice => $splice,
}
}

View File

@ -135,6 +135,11 @@
# (optional) Prefix for data being sent to statsd.
# Defaults to ''
#
# [*splice*]
# (optional) Use splice for zero-copy object GETs. This requires Linux Kernel
# version 3.0 or greater.
# Defaults to false.
#
define swift::storage::server(
$type,
$storage_local_net_ip,
@ -167,6 +172,7 @@ define swift::storage::server(
$log_statsd_default_sample_rate = '1.0',
$log_statsd_sample_rate_factor = '1.0',
$log_statsd_metric_prefix = '',
$splice = false,
) {
include ::swift::deps
@ -198,6 +204,7 @@ define swift::storage::server(
validate_re($type, '^object|container|account$')
validate_array($pipeline)
validate_bool($allow_versions)
validate_bool($splice)
# TODO - validate that name is an integer
$bind_port = $name

View File

@ -41,6 +41,7 @@ describe 'swift::storage::all' do
:container_pipeline => ["healthcheck"],
:account_pipeline => ["healthcheck"],
:allow_versions => true,
:splice => true,
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
:incoming_chmod => '0644',
:outgoing_chmod => '0644',
@ -98,7 +99,8 @@ describe 'swift::storage::all' do
:config_file_path => 'object-server.conf',
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:object_pipeline] || ['object-server'] }.merge(storage_server_defaults)
:pipeline => param_hash[:object_pipeline] || ['object-server'],
:splice => param_hash[:splice] || false }.merge(storage_server_defaults)
)}
it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
{:type => 'container',

View File

@ -111,6 +111,16 @@ describe 'swift::storage::server' do
end
end
if t == 'object'
describe "when splice is not set" do
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^splice\s*=\s*false\s*$/) }
end
describe "when splice is set" do
let :params do req_params.merge({ :splice => true, }) end
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^splice\s*=\s*true\s*$/) }
end
end
describe "when log_udp_port is set" do
context 'and log_udp_host is not set' do
let :params do req_params.merge({ :log_udp_port => 514}) end

View File

@ -34,6 +34,7 @@ set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = <%= @log_requests %>
set log_address = <%= @log_address %>
splice = <%= @splice %>
[object-replicator]
concurrency = <%= @replicator_concurrency %>