Membase存儲

In addition to the quota, there are two watermarks the engine will use to determine when it is necessary to start freeing up available memory. These are mem_low_wat and mem_high_wat.

As the system is loaded with data, eventually the mem_low_wat is passed. At this time, a background job is scheduled to reclaim the cached values of replica items from RAM...freeing up memory for further data growth. This is called "ejection" and can only take place on items that have already been written to disk...marking them as "clean". As data continues to load, it will evenutally reach/pass mem_high_wat. The job will continue to run, now ejecting active items as well until memory is below mem_low_wat. If the rate of incoming items is faster than the writing of items to disk, the system may return errors indicating there is not enough space. This will continue until there is available memory.

達到low_wat時會回收 複製的內容
達到high_wat時會回收 活動的內容
 In the case of memcached, items are evicted from memory, and the newly mutated item is stored. In the case of Membase, however, the expectation is that we'll migrate items to disk.
Return a SERVER_ERROR with a standard message indicating that a retry later is likely to succeed

Currently, we have implemented option 2. The handling of SERVER_ERROR is required by the client.(目前空間不足時,只返回SERVER_ERROR)

Get Flow

The actual process of eviction is relatively simple now.  When we need memory, we look around in hash tables and attempt to find things we can get rid of (i.e.things that are persisted on disk) andstart dropping it.  We will also eject data as soon as it's persisted iff it's for an inactive (e.g. replica) vbucket






















發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章