monasca / monasca-docker

Docker files and setup for Monasca
Apache License 2.0
24 stars 47 forks source link

the role of monasca-api memcached #487

Open zhangjianweibj opened 5 years ago

zhangjianweibj commented 5 years ago

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 commented 5 years ago

image

memcached no any message

witekest commented 5 years ago

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

matrixik commented 5 years ago

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?

zhangjianweibj commented 5 years ago

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.

matrixik commented 5 years ago

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.

zhangjianweibj commented 5 years ago

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

matrixik commented 5 years ago

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

zhangjianweibj commented 5 years ago

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

image

matrixik commented 5 years ago

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