Glance cache sqlite driver prunes newly cached images first over older images

Bug #1438564 reported by Hemanth Makkapati
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Hemanth Makkapati

Bug Description

Glance cache uses LRU strategy for cache pruning. It does so by keeping track of the last accessed time on cached images. While the xattr driver uses the last accessed time reported by the underlying filesystem, the sqlite driver keeps track of its own last accessed time. The sqlite driver doesn't set [1] the last accessed time the very first time an image is added to cache. It updates [2] the last accessed time for every subsequent access of the image from cache. This behavior makes the newly cached images susceptible to cache pruning over older images because they don't have a last accessed time set[3]. So, whenever the pruner runs, it'll prune the newly cached images first and then look for older images.

This bug may reduce Glance image download performance under certain traffic patterns as images will be served from Swift instead of image cache.

 [1] https://github.com/openstack/glance/blob/bb59c33ffcc6e1cde23c93bb25d38846e84c2cb9/glance/image_cache/drivers/sqlite.py#L324
[2] https://github.com/openstack/glance/blob/bb59c33ffcc6e1cde23c93bb25d38846e84c2cb9/glance/image_cache/drivers/sqlite.py#L376
[3] https://github.com/openstack/glance/blob/bb59c33ffcc6e1cde23c93bb25d38846e84c2cb9/glance/image_cache/drivers/sqlite.py#L280-L281

Changed in glance:
assignee: nobody → Hemanth Makkapati (hemanth-makkapati)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/169219

Changed in glance:
status: New → In Progress
Changed in glance:
importance: Undecided → Medium
Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Marking it as High as I think we should fix it in K. Thanks for the earlier triage Stuart!

Changed in glance:
importance: Medium → High
milestone: none → kilo-rc1
tags: added: kilo-rc-potential
Changed in glance:
milestone: kilo-rc1 → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/169219
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=95d3561de8afb01251b657b639d028bcf5f13002
Submitter: Jenkins
Branch: master

commit 95d3561de8afb01251b657b639d028bcf5f13002
Author: Hemanth Makkapati <email address hidden>
Date: Tue Mar 31 04:36:48 2015 -0400

    Glance cache to not prune newly cached images

    Sqlite driver doesn't set the last accessed time when an image is
    first added to cache. This makes the newly cached images susceptible
    to pruning first instead of older images.

    Change-Id: I46973a921c7cfb42811c58383e1b7a4004e70f27
    Closes-bug: #1438564

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → kilo-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: kilo-rc1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.