From 4f64c005476a7aa3fb59e983c86b5d155abbd44f Mon Sep 17 00:00:00 2001 From: Yusuke Ide Date: Tue, 3 Feb 2015 23:07:25 +0900 Subject: [PATCH] Add detail description of image_cache_max_size The description of 'image_cache_max_size' was ambiguous. There was not the certainty that the 'image_cache_max_size' parameter was about the aggregate size of the cache or a per image limit. The 'image_cache_max_size' is an upper limit beyond which pruner, if running, starts cleaning the images cache. Hence added detail description of 'image_cache_max_size' in document and configuration file. Bug: #1411813 Change-Id: Ide8e087db544aeea1990bac92c97cb9ca9f0b522 --- doc/source/cache.rst | 14 ++++++++------ etc/glance-cache.conf | 3 ++- glance/image_cache/__init__.py | 4 +++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/source/cache.rst b/doc/source/cache.rst index 720dbba484..8a12fb548f 100644 --- a/doc/source/cache.rst +++ b/doc/source/cache.rst @@ -38,12 +38,14 @@ Controlling the Growth of the Image Cache ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The image cache has a configurable maximum size (the ``image_cache_max_size`` -configuration file option. However, when images are successfully returned -from a call to ``GET /images/``, the image cache automatically -writes the image file to its cache, regardless of whether the resulting -write would make the image cache's size exceed the value of -``image_cache_max_size``. In order to keep the image cache at or below this -maximum cache size, you need to run the ``glance-cache-pruner`` executable. +configuration file option). The ``image_cache_max_size`` is an upper limit +beyond which pruner, if running, starts cleaning the images cache. +However, when images are successfully returned from a call to +``GET /images/``, the image cache automatically writes the image +file to its cache, regardless of whether the resulting write would make the +image cache's size exceed the value of ``image_cache_max_size``. +In order to keep the image cache at or below this maximum cache size, +you need to run the ``glance-cache-pruner`` executable. The recommended practice is to use ``cron`` to fire ``glance-cache-pruner`` at a regular interval. diff --git a/etc/glance-cache.conf b/etc/glance-cache.conf index a269138937..4a0b2b9efb 100644 --- a/etc/glance-cache.conf +++ b/etc/glance-cache.conf @@ -22,7 +22,8 @@ image_cache_dir = /var/lib/glance/image-cache/ # stalled and eligible for reaping image_cache_stall_time = 86400 -# Max cache size in bytes +# The upper limit (the maximum size of accumulated cache in bytes) beyond +# which pruner, if running, starts cleaning the images cache. image_cache_max_size = 10737418240 # Address to find the registry server diff --git a/glance/image_cache/__init__.py b/glance/image_cache/__init__.py index 6b83750da8..5050bac5d2 100644 --- a/glance/image_cache/__init__.py +++ b/glance/image_cache/__init__.py @@ -39,7 +39,9 @@ image_cache_opts = [ cfg.StrOpt('image_cache_driver', default='sqlite', help=_('The driver to use for image cache management.')), cfg.IntOpt('image_cache_max_size', default=10 * units.Gi, # 10 GB - help=_('The maximum size in bytes that the cache can use.')), + help=_('The upper limit (the maximum size of accumulated ' + 'cache in bytes) beyond which pruner, if running, ' + 'starts cleaning the images cache.')), cfg.IntOpt('image_cache_stall_time', default=86400, # 24 hours help=_('The amount of time to let an image remain in the ' 'cache without being accessed.')),