Enable pypy to be used with swift

The intention of this change is to enable an option to increase swift
performance without changing any of the swift internals. This change is
in-line with documentation published by the good folks at swiftstack and
intel. This change will only effect swift when its installed in a
virtual environment which is a self-imposed limitation such that we're
not messing with the system's default Python.

New Options:
  - A new option `swift_pypy_enabled` has been added to enable or
    disable the pypy interpreter for swift. The default is "false".
  - A new option `swift_pypy_archive` has been added to allow a
    pre-built pypy archive to be downloaded and moved into place. This
    option is a dictionary and contains the URL and SHA256 as keys.

Reference: [ https://software.intel.com/en-us/blogs/2016/05/06/doubling-the-performance-of-openstack-swift-with-no-code-changes ].

Change-Id: I045e8b97d29b96e2c2450761efa1c2668de12a75
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-05-10 09:01:35 -05:00 committed by Kevin Carter (cloudnull)
parent 85c5842aea
commit 60b7b834f9
4 changed files with 79 additions and 0 deletions

View File

@ -305,6 +305,12 @@ swift_object_program_names:
swift_proxy_program_names:
- swift-proxy-server
# Set this option to enable or disable the pypy interpreter for swift
swift_pypy_enabled: false
swift_pypy_archive:
url: "https://bitbucket.org/pypy/pypy/downloads/pypy-5.1.1-linux64.tar.bz2"
sha256: "c852622e8bc81618c137da35fcf57b2349b956c07b6fd853300846e3cefa64fc"
## Tunable overrides
swift_swift_conf_overrides: {}
swift_swift_dispersion_conf_overrides: {}

View File

@ -0,0 +1,15 @@
---
features:
- While default python interpreter for swift is cpython, pypy is
now an option. This change adds the ability to greatly improve swift
performance without the core code modifications. These changes have
been implemented using the documentation provided by Intel and
Swiftstack. Notes about the performance increase can be seen
`here <https://software.intel.com/en-us/blogs/2016/05/06/doubling-the-performance-of-openstack-swift-with-no-code-changes>`_.
upgrade:
- A new option `swift_pypy_enabled` has been added to enable or
disable the pypy interpreter for swift. The default is "false".
- A new option `swift_pypy_archive` has been added to allow a pre-built
pypy archive to be downloaded and moved into place to support swift
running under pypy. This option is a dictionary and contains the URL
and SHA256 as keys.

View File

@ -206,6 +206,16 @@
- swift-install
- swift-pip-packages
- include: swift_pypy_setup.yml
when:
- swift_venv_enabled | bool
- swift_get_venv | success
- swift_pypy_enabled | bool
tags:
- swift-install
- swift-pip-packages
- swift-pypy
- name: Install pip packages (venv)
pip:
name: "{{ item }}"

View File

@ -0,0 +1,48 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Download pre-built pypy
get_url:
url: "{{ swift_pypy_archive['url'] }}"
sha256sum: "{{ swift_pypy_archive['sha256'] }}"
dest: "/var/cache/{{ swift_pypy_archive['url'] | basename }}"
force: yes
- name: Create pypy dir
file:
path: "/opt/pypy-runtime"
state: directory
- name: Set pypy version fact
set_fact:
swift_pypy_version: "{{ swift_pypy_archive['url'] | basename | replace('.tar.bz2', '') }}"
- name: Set pypy env fact
set_fact:
swift_pypy_env: "/opt/pypy-runtime/{{ swift_pypy_version }}/bin/pypy"
- name: Unarchive pre-built pypy
unarchive:
src: "/var/cache/{{ swift_pypy_archive['url'] | basename }}"
dest: "/opt/pypy-runtime"
copy: "no"
creates: "/opt/pypy-runtime/{{ swift_pypy_version }}/bin/pypy"
- name: Change virtualenv python to pypy
shell: |
virtualenv --python {{ swift_pypy_env }} "{{ swift_venv_bin | dirname }}"
touch "{{ swift_venv_bin | dirname }}/{{ swift_pypy_version }}-inuse"
args:
creates: "{{ swift_venv_bin | dirname }}/{{ swift_pypy_version }}-inuse"