From 666469e92272c04407a189cacff927cbcdb7471b Mon Sep 17 00:00:00 2001 From: Ryan Finnie Date: Thu, 4 Oct 2012 04:38:58 -0700 Subject: [PATCH] Allow arbitrary number of TCP workers --- config.yaml | 4 ++++ hooks/swift-proxy-common | 6 ++++-- revision | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index b900568..9b5e394 100644 --- a/config.yaml +++ b/config.yaml @@ -37,6 +37,10 @@ options: default: 8080 type: int description: TCP port to listen on + workers: + default: 0 + type: int + description: Number of TCP workers to launch (0 for the number of system cores) auth-type: default: tempauth type: string diff --git a/hooks/swift-proxy-common b/hooks/swift-proxy-common index a4620f3..bf5427f 100755 --- a/hooks/swift-proxy-common +++ b/hooks/swift-proxy-common @@ -7,6 +7,7 @@ LOCALE=$(config-get locale) COMMON_NAME=$(config-get common-name) PPA=$(config-get swift-release) BINDPORT=$(config-get bind-port) +WORKERS=$(config-get workers) AUTHTYPE=$(config-get auth-type) KEYSTONE_AUTH_HOST=$(config-get keystone-auth-host) KEYSTONE_AUTH_PORT=$(config-get keystone-auth-port) @@ -15,8 +16,9 @@ KEYSTONE_ADMIN_TENANT_NAME=$(config-get keystone-admin-tenant-name) KEYSTONE_ADMIN_USER=$(config-get keystone-admin-user) KEYSTONE_ADMIN_PASSWORD=$(config-get keystone-admin-password) -# Used in proxy-server.conf. Run one worker per cpu core for now +# Used in proxy-server.conf. Run one worker per cpu core by default. CORES=$(cat /proc/cpuinfo | grep processor | wc -l) +[ "$WORKERS" = "0" ] && WORKERS="$CORES" # TODO: Need to use different addresses for internal swift traffic # as this the only security measure in place is network isolation @@ -60,7 +62,7 @@ cat >/etc/swift/proxy-server.conf <