Does cachelib support persist cache by call specific API? #113
-
Currently, cachelib could persist cache by call shutdown api. But if the process is killed by 'kill -9', then no signal could be catch by the process so that could not call shutdown api. Does cachelib have an persistence API and the application could call it periodically? And could load the cache even if the process is killed by 'kill -9'? The cache is not up to date is accepted. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
no, cachelib doesn't support online backup. Could you explain why do you need persistence in the case of "kill -9"? |
Beta Was this translation helpful? Give feedback.
-
Unlike storage engines, cachelib does not offer crash consistent storage of items. for caches, this is not a deal breaker since durability is not a prime concern for the cache. Besides, caches operate with background evictions, so the application already expects the cache to be empty or missing items. In steady state, cachelib has DRAM data structures that need to be persisted for recovery on restart. If a cache process is receiving a kill -9, we can not guarantee the state of these DRAM data structures to be consistent for shutdown. So I would not recommend catching the kill signal and doing a shutdown unless you can guarantee that the application threads have stopped accessing the cache and shutdown api can be safely called. There is an internal experimental feature, but it is not the "kill -9" feature you are probably looking for. With that you can snapshot the cache by shutting it down (after ensuring application thread stop accessing cache) and copying the state to another machine to bootstrap another cache from it. |
Beta Was this translation helpful? Give feedback.
-
I think this is a quite valid feature request. The Cachelib research paper highlights the goodness of supporting "Frequent Restart".
It's not reliable to enforce some cache shutdown operation in order to retain a clean state. |
Beta Was this translation helpful? Give feedback.
Unlike storage engines, cachelib does not offer crash consistent storage of items. for caches, this is not a deal breaker since durability is not a prime concern for the cache. Besides, caches operate with background evictions, so the application already expects the cache to be empty or missing items. In steady state, cachelib has DRAM data structures that need to be persisted for recovery on restart. If a cache process is receiving a kill -9, we can not guarantee the state of these DRAM data structures to be consistent for shutdown. So I would not recommend catching the kill signal and doing a shutdown unless you can guarantee that the application threads have stopped accessing the cache…