From 287f2113c9eeca5e52a7f794d7248c27f632d6a8 Mon Sep 17 00:00:00 2001 From: Thiago da Silva Date: Mon, 9 Jul 2018 03:17:18 -0400 Subject: [PATCH] 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 --- manifests/storage/all.pp | 7 +++++++ manifests/storage/server.pp | 7 +++++++ spec/classes/swift_storage_all_spec.rb | 4 +++- spec/defines/swift_storage_server_spec.rb | 10 ++++++++++ templates/object-server.conf.erb | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/manifests/storage/all.pp b/manifests/storage/all.pp index 58d4135a..456f7306 100644 --- a/manifests/storage/all.pp +++ b/manifests/storage/all.pp @@ -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, } } diff --git a/manifests/storage/server.pp b/manifests/storage/server.pp index ed1079ce..5f05e7b1 100644 --- a/manifests/storage/server.pp +++ b/manifests/storage/server.pp @@ -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 diff --git a/spec/classes/swift_storage_all_spec.rb b/spec/classes/swift_storage_all_spec.rb index 3f575618..ae8ab68f 100644 --- a/spec/classes/swift_storage_all_spec.rb +++ b/spec/classes/swift_storage_all_spec.rb @@ -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', diff --git a/spec/defines/swift_storage_server_spec.rb b/spec/defines/swift_storage_server_spec.rb index 6050f61c..39bcdcb9 100644 --- a/spec/defines/swift_storage_server_spec.rb +++ b/spec/defines/swift_storage_server_spec.rb @@ -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 diff --git a/templates/object-server.conf.erb b/templates/object-server.conf.erb index 99a8f7e9..265feb89 100644 --- a/templates/object-server.conf.erb +++ b/templates/object-server.conf.erb @@ -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 %>