Currently Devstack starts all Swift services, including those
in charge of "consistency convergence" (remember Swift is eventually
consistent), data scrubbing, hard-deletion (*-reaper services)
cleanup.
But when running with Replication Factor 1 some of those services
are not needed at all. Besides, the fonctionnalities provided by
some of these services are not tested at all (neither in Tempest
nor in Swift functional tests).
Thus, in light of saving some Mo of RAM, this patch introduces a config
flag to start only a minimal set of Swift services, just what's required
to make all of our current tests pass.
The default value for this new config flag is set to start all services,
that is to maintain Devstack's current behavior.
For sake of completeness, here is the list of services that are not
going to be started is the config flag is toggled, and the associated RSS
according to our peakmem_tracker
40004 swift-object-replicator /etc/swift/object-server/1.conf
34320 swift-container-replicator /etc/swift/container-server/1.conf
33584 swift-object-auditor /etc/swift/object-server/1.conf
33328 swift-object-reconstructor /etc/swift/object-server/1.conf
31936 swift-object-updater /etc/swift/object-server/1.conf
31492 swift-account-reaper /etc/swift/account-server/1.conf
31076 swift-account-replicator /etc/swift/account-server/1.conf
29540 swift-container-updater /etc/swift/container-server/1.conf
29220 swift-account-auditor /etc/swift/account-server/1.conf
29036 swift-container-auditor /etc/swift/container-server/1.conf
So we are looking at saving at most ~350Mo of RAM (could be less
because RSS doesn't account for shared memory).
A follow-up patch will soon be proposed in devstack-gate to not run
those additional services in our Gate jobs.
Change-Id: I8a0d03ac0296a74e38efd185beb8513866eaf0c4
| ... | ... |
@@ -128,6 +128,11 @@ SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
|
| 128 | 128 |
SWIFT_REPLICAS=${SWIFT_REPLICAS:-1}
|
| 129 | 129 |
SWIFT_REPLICAS_SEQ=$(seq ${SWIFT_REPLICAS})
|
| 130 | 130 |
|
| 131 |
+# Set ``SWIFT_START_ALL_SERVICES`` to control whether all Swift |
|
| 132 |
+# services (including the *-auditor, *-replicator, *-reconstructor, etc. |
|
| 133 |
+# daemons) should be started. |
|
| 134 |
+SWIFT_START_ALL_SERVICES=$(trueorfalse True SWIFT_START_ALL_SERVICES) |
|
| 135 |
+ |
|
| 131 | 136 |
# Set ``SWIFT_LOG_TOKEN_LENGTH`` to configure how many characters of an auth |
| 132 | 137 |
# token should be placed in the logs. When keystone is used with PKI tokens, |
| 133 | 138 |
# the token values can be huge, seemingly larger the 2K, at the least. We |
| ... | ... |
@@ -786,8 +791,11 @@ function start_swift {
|
| 786 | 786 |
fi |
| 787 | 787 |
|
| 788 | 788 |
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then |
| 789 |
+ # Apache should serve the "PACO" a.k.a "main" services |
|
| 789 | 790 |
restart_apache_server |
| 791 |
+ # The rest of the services should be started in backgroud |
|
| 790 | 792 |
swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
|
| 793 |
+ # Be we still want the logs of Swift Proxy in our screen session |
|
| 791 | 794 |
tail_log s-proxy /var/log/$APACHE_NAME/proxy-server |
| 792 | 795 |
if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
| 793 | 796 |
for type in object container account; do |
| ... | ... |
@@ -797,31 +805,42 @@ function start_swift {
|
| 797 | 797 |
return 0 |
| 798 | 798 |
fi |
| 799 | 799 |
|
| 800 |
- # By default with only one replica we are launching the proxy, |
|
| 801 |
- # container, account and object server in screen in foreground and |
|
| 802 |
- # other services in background. If we have ``SWIFT_REPLICAS`` set to something |
|
| 803 |
- # greater than one we first spawn all the Swift services then kill the proxy |
|
| 804 |
- # service so we can run it in foreground in screen. ``swift-init ... |
|
| 805 |
- # {stop|restart}`` exits with '1' if no servers are running, ignore it just
|
|
| 806 |
- # in case |
|
| 807 |
- local todo type |
|
| 808 |
- swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
|
|
| 800 |
+ |
|
| 801 |
+ # By default with only one replica we are launching the proxy, container |
|
| 802 |
+ # account and object server in screen in foreground. Then, the rest of |
|
| 803 |
+ # the services is optionally started. |
|
| 804 |
+ # |
|
| 805 |
+ # If we have ``SWIFT_REPLICAS`` set to something greater than one |
|
| 806 |
+ # we first spawn *all* the Swift services then kill the proxy service |
|
| 807 |
+ # so we can run it in foreground in screen. |
|
| 808 |
+ # |
|
| 809 |
+ # ``swift-init ... {stop|restart}`` exits with '1' if no servers are
|
|
| 810 |
+ # running, ignore it just in case |
|
| 809 | 811 |
if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
| 810 |
- todo="object container account" |
|
| 812 |
+ local foreground_services type |
|
| 813 |
+ |
|
| 814 |
+ foreground_services="object container account" |
|
| 815 |
+ for type in ${foreground_services}; do
|
|
| 816 |
+ run_process s-${type} "$SWIFT_BIN_DIR/swift-${type}-server ${SWIFT_CONF_DIR}/${type}-server/1.conf -v"
|
|
| 817 |
+ done |
|
| 818 |
+ |
|
| 819 |
+ if [[ "$SWIFT_START_ALL_SERVICES" == "True" ]]; then |
|
| 820 |
+ swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
|
|
| 821 |
+ else |
|
| 822 |
+ # The container-sync daemon is strictly needed to pass the container |
|
| 823 |
+ # sync Tempest tests. |
|
| 824 |
+ swift-init --run-dir=${SWIFT_DATA_DIR}/run container-sync start
|
|
| 825 |
+ fi |
|
| 826 |
+ else |
|
| 827 |
+ swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
|
|
| 828 |
+ swift-init --run-dir=${SWIFT_DATA_DIR}/run proxy stop || true
|
|
| 811 | 829 |
fi |
| 812 |
- for type in proxy ${todo}; do
|
|
| 813 |
- swift-init --run-dir=${SWIFT_DATA_DIR}/run ${type} stop || true
|
|
| 814 |
- done |
|
| 830 |
+ |
|
| 815 | 831 |
if is_service_enabled tls-proxy; then |
| 816 | 832 |
local proxy_port=${SWIFT_DEFAULT_BIND_PORT}
|
| 817 | 833 |
start_tls_proxy swift '*' $proxy_port $SERVICE_HOST $SWIFT_DEFAULT_BIND_PORT_INT |
| 818 | 834 |
fi |
| 819 | 835 |
run_process s-proxy "$SWIFT_BIN_DIR/swift-proxy-server ${SWIFT_CONF_DIR}/proxy-server.conf -v"
|
| 820 |
- if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
|
| 821 |
- for type in object container account; do |
|
| 822 |
- run_process s-${type} "$SWIFT_BIN_DIR/swift-${type}-server ${SWIFT_CONF_DIR}/${type}-server/1.conf -v"
|
|
| 823 |
- done |
|
| 824 |
- fi |
|
| 825 | 836 |
|
| 826 | 837 |
if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]]; then |
| 827 | 838 |
swift_configure_tempurls |