Skip to content
This repository

Add Garbage Collector #25

Open
qbolec opened this Issue · 3 comments

2 participants

qbolec Yao Yue
qbolec

I see that you've invested a lot of time in stackable Eviction Strategies.
That's good for me, because that means, that you've already made the first step : admitted that the default LRU is not as good as it could.

Perhaps you would like to incorporate this changeset:
https://groups.google.com/forum/?fromgroups#!topic/memcached/MdNPv0oxhO8
which makes sure that expired items are never in memory, and does so in O(1).
We use it in nk.pl since years at it works great (evictions dropped to 0, and monitoring memory consumption provides more information now -- also, slabs now have a chance to become emptied and disposed).

The only drawback I can see with it is the additional O(1) memory per item for doubly linked list pointers. I believe that Twitter hires some tough hackers which could make this number smaller (how about the trick with XORed pointers?).

Yao Yue
Collaborator

We have given garbage collection some serious thoughts and I agree with you on the benefits it could bring. What stopped us from simply incorporate something similar already was the memory overhead, which is noticeable for smaller items.

I feel quite a few things could be done to make memory management better, unfortunately I have to shelf the development on Twemcache (other than bug fixes) due to lack of resources. Hopefully I can come back to this in the summer (Q3) and do an in-depth summary and planning about the memory management module as a whole.

qbolec

Cool, please let me know if I could help somehow in the process.

Yao Yue
Collaborator

I think the better approach, as Jamie suggested in the thread, is to use a background, latency oblivious thread to do the clean-ups. If you want to extend the current threading architecture of Twemcache, which uses background threads for various tasks, I'll be happy to review it and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.