monasca-docker icon indicating copy to clipboard operation
monasca-docker copied to clipboard

the role of monasca-api memcached

Open zhangjianweibj opened this issue 6 years ago • 9 comments

hello,i install monasca in my docker platform.find memecached no any message.but monasca workds well.i wonder what is the role of monasca memcached.is api get tokens from memcached ,if memcached no token then request to keystone and put token in memcached?very thanks..

zhangjianweibj avatar Jan 03 '19 02:01 zhangjianweibj

image

memcached no any message

zhangjianweibj avatar Jan 03 '19 02:01 zhangjianweibj

You're right. Memcached caches Keystone tokens to reduce the number of authorization requests to Keystone.

witekest avatar Jan 03 '19 08:01 witekest

I just tested it with docker-compose and memcached is used correctly:

STAT cmd_get 443
STAT cmd_set 19
STAT get_misses 20
STAT get_expired 12
STAT curr_items 1
STAT total_items 19
stats items
STAT items:14:number 1
STAT items:14:number_hot 0
STAT items:14:number_warm 0
STAT items:14:number_cold 1
STAT items:14:age_hot 0
STAT items:14:age_warm 0
STAT items:14:age 25
STAT items:14:evicted 0
STAT items:14:evicted_nonzero 0
STAT items:14:evicted_time 0
STAT items:14:outofmemory 0
STAT items:14:tailrepairs 0
STAT items:14:reclaimed 6
STAT items:14:expired_unfetched 0
STAT items:14:evicted_unfetched 0
STAT items:14:evicted_active 0
STAT items:14:crawler_reclaimed 0
STAT items:14:crawler_items_checked 4
STAT items:14:lrutail_reflocked 452
STAT items:14:moves_to_cold 234
STAT items:14:moves_to_warm 215
STAT items:14:moves_within_lru 8
STAT items:14:direct_reclaims 0
STAT items:14:hits_to_hot 16
STAT items:14:hits_to_warm 9
STAT items:14:hits_to_cold 398
STAT items:14:hits_to_temp 0
END

Are you sure monasca-api can connect to memcached? Any warnings/errors in monasca-api logs?

matrixik avatar Jan 03 '19 09:01 matrixik

api error logs show api can not validate token. image

but keystone logs show token validate success.

image

i think keystone validate token success ,but cached token in memecached failed.then api judge the token validate failed.memcached may encounter some problems.but kubectl logs memcached -n morning say nothing.i find dockerfile no any configuration parameter.

zhangjianweibj avatar Jan 04 '19 01:01 zhangjianweibj

But from memcached stats looks like nothing is send to memcached. STAT total_items 0 For me it's looks like nothing is send from api to memcached.

matrixik avatar Jan 04 '19 08:01 matrixik

very thanks.i check the api source code(https://github.com/openstack/monasca-api/blob/master/README.rst),but find nothing about memcached operate.en ,i thank memcached is used by keystone,not cached tokens for api.did you find any operation about memcached in api project?

as the picture show,keystone can use memcached cach tokens.

image

zhangjianweibj avatar Jan 04 '19 08:01 zhangjianweibj

https://github.com/monasca/monasca-docker/blob/master/monasca-api-python/api-config.conf.j2#L126

matrixik avatar Jan 04 '19 08:01 matrixik

thanks,but i mean the project source code(*.py),not the configuration file.

image

zhangjianweibj avatar Jan 04 '19 09:01 zhangjianweibj

It's used by keystonemiddleware https://docs.openstack.org/keystonemiddleware/latest/middlewarearchitecture.html#improving-response-time

matrixik avatar Jan 04 '19 09:01 matrixik