Glance Image Cache

Glance 增加了一层 cache 的 Middleware, 用来缓存从 file store 后端取过来的镜像 。 一定 程度上可以加快取镜像的速度 。 这个功能默认情况下是没开启的 。

因为是通过 middleware 来控制的 , 所以只要修改一下 paster 的配置就行 。 更简单的是指定 glance-api 加载的 pipeline 的名字 。

[deploy]
# possible value: none, cachine, keystone, keystone+caching, 
# keystone+cachemanagement
# This value can get from glance-api-paste.conf file
flavor=keystone+caching

具体看下 glance-api-paster.conf 文件就能明白 。

[pipeline:glance-api]
pipeline = versionnegotiation unauthenticated-context rootapp

# Use this pipeline for image caching and no auth
[pipeline:glance-api-caching]
pipeline = versionnegotiation unauthenticated-context cache rootapp

# Use this pipeline for caching w/ management interface but no auth
[pipeline:glance-api-cachemanagement]
pipeline = versionnegotiation unauthenticated-context cache cachemanage rootapp

# Use this pipeline for keystone auth
[pipeline:glance-api-keystone]
pipeline = versionnegotiation authtoken context rootapp

# Use this pipeline for keystone auth with image caching
[pipeline:glance-api-keystone+caching]
pipeline = versionnegotiation authtoken context cache rootapp

# Use this pipeline for keystone auth with caching and cache management
[pipeline:glance-api-keystone+cachemanagement]
pipeline = versionnegotiation authtoken context cache cachemanage rootapp

不同的 pipeline 用到了不同的 middleware, 启作用的是 cache 和 cachemanagement 这两个 。

REF

  1. The Glance Image Cache

Comments