[SERVER-5592] Requesting document-level LRU Created: 13/Apr/12 Updated: 29/Jun/12 Resolved: 13/Apr/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | P Eger | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
Requesting MongoDB to officially support "LRU Capped Collections", basically capped collections but with LRU instead of FIFO ordering. IOW I would like to be able to set a max collection size, and have MongoDB automatically delete least recently used (read or write) documents when full. The LRU need not be perfect, but a decent approximation would likely be good enough for most needs. This is a fundamental requirement for us using MongoDB as a cache, presently we will need to implement one of the following less desireable hacks: Either way, we have to write a background job that continually monitors the db size and deletes when we hit a threshold (or do this on every write which is expensive). Which also sucks because it has ugly failure modes. Ideally, the LRU would be persisted. I can think of a few ways this can be done relatively cheaply, as long as the LRU is not expected to be exact. A simple in-memory lru would be sufficient for our needs though. A couple of things I don't need, though others might Thanks and open to alternatives. I tried seeing how this could be simulated with capped collections but could not find a reasonable solution. |
| Comments |
| Comment by P Eger [ 13/Apr/12 ] |
|
Yeah I saw that ticket but could not convince myself that it would provide LRU/capped behaviour. A simple TTL would need to be configured and sized to the data insertion rate, which is definitely not desired and similar to the problems with trying to use capped collections. Do you have a pointer to a more complete description/documentation of the feature? |
| Comment by Eliot Horowitz (Inactive) [ 13/Apr/12 ] |
|
I believe this is fully covered by Well, not fully covered, but could be easily implemented on top of. |
| Comment by P Eger [ 13/Apr/12 ] |
|
Some related tickets: https://jira.mongodb.org/browse/SERVER-5170 |