diff options
author | Mohammed Junaid <junaid@redhat.com> | 2013-04-07 06:05:56 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-04-12 13:48:43 -0700 |
commit | bbaa273468f8e5377027aedcabcaa076dd7fec7e (patch) | |
tree | 89447270516e604cd61d58a2ac9229716086cd6d /ufo/gluster | |
parent | f34343d3751cd73e8eabe6d5544fb1f58b316595 (diff) |
object-storage: turn off stat() for container list
Turn of stat() system calls used to fetch the file size during a
container listing operation since these system calls can swamp Gluster
and the result is most often not used.
When a GET or HEAD request is made on a container, stat() system calls
are made during the Python standard library method, os.walk, to
determine if a given directory entry is another directory to recurse
into, and then utils._update_list() will stat() each file to get it
size, and finally utils.get_container_details_from_fs() will stat()
each directory encountered.
For most installations we have seen so far, we don't need the
container listing to accurately return the size of all the objects in
the container, so we can reduce the number of stat() system calls by
not fetching the size of the object.
For now, turn it off by default, and provide an /etc/swift/fs.conf
configuration parameter to turn it back on:
accurate_size_in_listing = yes
The default for the above is "no".
Change-Id: I7dde11e14bb32ecafa3eabb08852f1ffc4366b35
BUG: 903396
Signed-off-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-on: http://review.gluster.org/4787
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'ufo/gluster')
-rw-r--r-- | ufo/gluster/swift/common/Glusterfs.py | 7 | ||||
-rw-r--r-- | ufo/gluster/swift/common/utils.py | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/ufo/gluster/swift/common/Glusterfs.py b/ufo/gluster/swift/common/Glusterfs.py index 6cbdf6c3551..1053610b386 100644 --- a/ufo/gluster/swift/common/Glusterfs.py +++ b/ufo/gluster/swift/common/Glusterfs.py @@ -27,6 +27,7 @@ MOUNT_IP = 'localhost' OBJECT_ONLY = False RUN_DIR='/var/run/swift' SWIFT_DIR = '/etc/swift' +_do_getsize = False if _fs_conf.read(os.path.join('/etc/swift', 'fs.conf')): try: MOUNT_IP = _fs_conf.get('DEFAULT', 'mount_ip', 'localhost') @@ -41,6 +42,12 @@ if _fs_conf.read(os.path.join('/etc/swift', 'fs.conf')): except (NoSectionError, NoOptionError): pass + try: + _do_getsize = _fs_conf.get('DEFAULT', 'accurate_size_in_listing', \ + "no") in TRUE_VALUES + except (NoSectionError, NoOptionError): + pass + NAME = 'glusterfs' diff --git a/ufo/gluster/swift/common/utils.py b/ufo/gluster/swift/common/utils.py index 7e9f8a60f74..f2cd8dea10c 100644 --- a/ufo/gluster/swift/common/utils.py +++ b/ufo/gluster/swift/common/utils.py @@ -241,7 +241,7 @@ def _update_list(path, cont_path, src_list, reg_file=True, object_count=0, object_count += 1 - if reg_file: + if Glusterfs._do_getsize and reg_file: bytes_used += os_path.getsize(os.path.join(path, obj_name)) sleep() |