swift/test/unit/common
Samuel Merritt 7d0e5ebe69 Zero-copy object-server GET responses with splice()
This commit lets the object server use splice() and tee() to move data
from disk to the network without ever copying it into user space.

Requires Linux. Sorry, FreeBSD folks. You still have the old
mechanism, as does anyone who doesn't want to use splice. This
requires a relatively recent kernel (2.6.38+) to work, which includes
the two most recent Ubuntu LTS releases (Precise and Trusty) as well
as RHEL 7. However, it excludes Lucid and RHEL 6. On those systems,
setting "splice = on" will result in warnings in the logs but no
actual use of splice.

Note that this only applies to GET responses without Range headers. It
can easily be extended to single-range GET requests, but this commit
leaves that for future work. Same goes for PUT requests, or at least
non-chunked ones.

On some real hardware I had laying around (not a VM), this produced a
37% reduction in CPU usage for GETs made directly to the object
server. Measurements were done by looking at /proc/<pid>/stat,
specifically the utime and stime fields (user and kernel CPU jiffies,
respectively).

Note: There is a Python module called "splicetee" available on PyPi,
but it's licensed under the GPL, so it cannot easily be added to
OpenStack's requirements. That's why this patch uses ctypes instead.

Also fixed a long-standing annoyance in FakeLogger:

    >>> fake_logger.warn('stuff')
    >>> fake_logger.get_lines_for_level('warn')
    []
    >>>

This, of course, is because the correct log level is 'warning'. Now
you get a KeyError if you call get_lines_for_level with a bogus log
level.

Change-Id: Ic6d6b833a5b04ca2019be94b1b90d941929d21c8
2014-09-18 16:02:47 -07:00
..
middleware Move multipart MIME parser into utils 2014-09-16 10:10:59 -07:00
ring Let admins add a region without melting their cluster 2014-08-21 08:56:29 -07:00
__init__.py Initial commit of Swift code 2010-07-12 17:03:45 -05:00
corrupted_example.db Real files for bad databases. 2011-08-02 18:21:25 +00:00
malformed_example.db Real files for bad databases. 2011-08-02 18:21:25 +00:00
test_bufferedhttp.py Change OpenStack LLC to Foundation 2013-09-20 01:02:31 +08:00
test_constraints.py Merge "Extra unit tests for check_delete_headers" 2014-09-12 06:30:47 +00:00
test_container_sync_realms.py Zero-copy object-server GET responses with splice() 2014-09-18 16:02:47 -07:00
test_daemon.py Revert "Refactor common/utils methods to common/ondisk" 2013-10-07 17:18:09 -04:00
test_db_replicator.py Enqueue misplaced objects during container replication 2014-06-18 21:09:50 -07:00
test_db.py Add two vector timestamps 2014-06-19 10:18:06 -07:00
test_direct_client.py Replace POLICY and POLICY_INDEX with string literals 2014-06-23 12:52:50 -07:00
test_exceptions.py Remove swiftclient dep on direct_client 2013-12-24 03:11:43 -08:00
test_internal_client.py Fix swift-dispersion-populate bug when using SimpleClient class 2014-08-01 14:18:04 +00:00
test_manager.py Fixed a handful of typos 2014-05-26 16:07:41 -05:00
test_memcached.py Attempt to make test_memcache_pool_timeout stable 2014-02-03 00:47:09 -05:00
test_request_helpers.py Enable object system metadata on PUTs 2014-08-01 16:41:33 -07:00
test_storage_policy.py Add Storage Policy Support 2014-06-18 17:31:37 -07:00
test_swob.py Add two vector timestamps 2014-06-19 10:18:06 -07:00
test_utils.py Zero-copy object-server GET responses with splice() 2014-09-18 16:02:47 -07:00
test_wsgi.py make the bind_port config setting required 2014-09-08 07:28:43 -07:00