Add read/write_affinity settings for Swift

Allow the setting of read/write_affinity and write_affinity_node_count
on a per proxy_host basis.

This allows the deployer to set preferences for which region to
read/write to, which can increase the efficiency of a multi-region
swift cluster.

Sample swift.yml has been updated, as well as the aio swift.yml to
ensure these settings are setup as part of the gate, but this shouldn't
change the functionality of swift at all (since there is only 1 region).

Change-Id: I95b456672f419fcc331d6739ce259b022d350472
Closes-Bug: #1415172
This commit is contained in:
Andy McCrae 2015-06-12 12:47:49 +01:00
parent 3f8905caee
commit 5b9b49f52b
3 changed files with 63 additions and 0 deletions

View File

@ -17,6 +17,15 @@ global_overrides:
swift-proxy_hosts:
aio1:
ip: 172.29.236.100
container_vars:
swift_proxy_vars:
read_affinity: "r1=100"
write_affinity: "r1"
write_affinity_node_count: "1 * replicas"
swift_hosts:
aio1:
ip: 172.29.236.100
container_vars:
swift_vars:
zone: 0
region: 1

View File

@ -232,6 +232,36 @@
# IP address of this target host, typically the IP address assigned to
# the management bridge.
#
# Level: container_vars (optional)
# Contains options for this target host.
#
# Level: swift_proxy_vars (optional)
# Contains swift proxy options for this target host. Typical deployments
# use this level to define read/write affinity settings for proxy hosts.
#
# Option: read_affinity (optional, string)
# Specify which region/zones the proxy server should prefer for reads
# from the account, container and object services.
# E.g. read_affinity: "r1=100" this would prefer region 1
# read_affinity: "r1z1=100, r1=200" this would prefer region 1 zone 1
# if that is unavailable region 1, otherwise any available region/zone.
# Lower number is higher priority.
#
# Option: write_affinity (optional, string)
# Specify which region to prefer when object PUT requests are made.
# E.g. write_affinity: "r1" - favours region 1 for object PUTs
#
# Option: write_affinity_node_count (optional, string)
# Specify how many copies to prioritise in specified region on
# handoff nodes for Object PUT requests.
# Requires "write_affinity" to be set in order to be useful.
# This is a short term way to ensure replication happens locally,
# Swift's eventual consistency will ensure proper distribution over
# time.
# e.g. write_affinity_node_count: "2 * replicas" - this would try to
# store Object PUT replicas on up to 6 disks in region 1 assuming
# replicas is 3, and write_affinity = r1
#
# Example:
#
# Define three swift proxy hosts:
@ -240,10 +270,25 @@
#
# infra1:
# ip: 172.29.236.101
# container_vars:
# swift_proxy_vars:
# read_affinity: "r1=100"
# write_affinity: "r1"
# write_affinity_node_count: "2 * replicas"
# infra2:
# ip: 172.29.236.102
# container_vars:
# swift_proxy_vars:
# read_affinity: "r2=100"
# write_affinity: "r2"
# write_affinity_node_count: "2 * replicas"
# infra3:
# ip: 172.29.236.103
# container_vars:
# swift_proxy_vars:
# read_affinity: "r3=100"
# write_affinity: "r3"
# write_affinity_node_count: "2 * replicas"
#
# --------
#

View File

@ -23,6 +23,15 @@ log_facility = LOG_LOCAL1
node_timeout = 60
conn_timeout = 3.5
account_autocreate = true
{% if swift_proxy_vars.read_affinity is defined %}
read_affinity = {{ swift_proxy_vars.read_affinity }}
{% endif %}
{% if swift_proxy_vars.write_affinity is defined %}
write_affinity = {{ swift_proxy_vars.write_affinity }}
{% if swift_proxy_vars.write_affinity_node_count is defined %}
write_affinity_node_count = {{ swift_proxy_vars.write_affinity_node_count }}
{% endif %}
{% endif %}
[filter:tempauth]
use = egg:swift#tempauth