swift/test/unit/obj
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
..
__init__.py Initial commit of Swift code 2010-07-12 17:03:45 -05:00
test_auditor.py Merge "Fix object auditor recon and logging" 2014-08-16 21:50:07 +00:00
test_diskfile.py Zero-copy object-server GET responses with splice() 2014-09-18 16:02:47 -07:00
test_expirer.py Delete expired objects in slightly smarter way. 2014-09-09 18:54:22 +00:00
test_replicator.py Object services user-agent string uses full name 2014-07-02 18:35:49 -07:00
test_server.py Zero-copy object-server GET responses with splice() 2014-09-18 16:02:47 -07:00
test_ssync_receiver.py Replace POLICY and POLICY_INDEX with string literals 2014-06-23 12:52:50 -07:00
test_ssync_sender.py Replace POLICY and POLICY_INDEX with string literals 2014-06-23 12:52:50 -07:00
test_updater.py Replace POLICY and POLICY_INDEX with string literals 2014-06-23 12:52:50 -07:00