Stupid offhand idea: If your data tends to fit into different size buckets (ie: sessions are always this large, other things are always that large), memcached internally has an LRU bucket per chunk size. You can use slab rebalance to adjust how much memory each bucket has available. Could force this via padding objects to certain sizes.
Total hack, but eh :p On Fri, 14 Feb 2014, StormByte wrote: > Thank you, I though on that, but that will add a bit more of complexity. > Despite it is a good aproach. > I've already implemented namespaces (lib publicly available via github) and > will look at a simpler way to do that, but again thanks for pointing me > in that direction :) > > On Friday, February 14, 2014 7:20:54 PM UTC+1, Ryan McElroy wrote: > As far as I'm aware, memcached itself does not provide any way to do > this. The way Facebook accomplishes something similar (as > discussed in our NSDI paper: > https://www.facebook.com/publications/459945140743614/) is to divide our > memcached boxes into pools of > servers for different use cases. For example, you could create a > "session" pool where you store all your session data, and give it more > memcached boxes than the "data" pool which stores non-session data. > Using memcached in this way allos you to guarantee a certain "quality of > service" for the more important session data by ensuring that only > new session data (and never any other kind of data) will push out old session > data. > > As for alternative ideas, we at Facebook have considered adding "arenas" to > memcached that would partition data inside of a memcached box > based on key type, but pools work well so this has never turned out to be a > priority. > > Hope this helps, > > ~Ryan > > > On Fri, Feb 14, 2014 at 9:56 AM, David Carlos Manuelda <[email protected]> > wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I am wondering if there is any option (or any idea to implement it) to > somehow set an eviction order when memory is full. > > That would be useful, for example, to store session data in PHP + > memcached. > > If I could set that any other data rather than session data should be > evicted BEFORE them (if possible) to allocate new items would be a > very good benefit. > > Of course, there may be other useful usecases. > > For example, if can be set as a parameter when setting the key-value, > along with the expire time. > > Can it be done or does it already exists? > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.22 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQIcBAEBAgAGBQJS/i6JAAoJEKJX2y/M0f1vZowQAKmepEYFl8In7c/d4/+PsAYn > Kr+81kK0F4AU9rJzdMwvq6FKG/ohu0MNdlzjNtb5die5UkSip+nzzTwQkKol3s8k > UFys/rW+enpH8tVW4Uhv8w1ui8WnZmz5m8IyPSCmwQHyvf/f2bQ+XEbGLQOG+lyR > 7Of2tFxv9X1ewBDZ4gvL/FCyUrdtJ02d/avKZLhsjfuMhooA/sGrdAyyNtcMTMrh > inbap7vYVaWCY8eXFaKem1T19OVGIaOiRwZ0tLXONQg4tIZ+AFxRqIhlXv9b+F6c > mjCfjVHpbRa5EqSk7sYRH9u+Evb1wW+K4doHLbWjS3UU0uhtIjiPWZLuwyxJiG8p > 89boXr1S/DDKdaF/7UbPqFkOm0GjKvjaOksVpxdE9MITb3eHsQhWXGuXZkCC1ksb > PuArach5ry+tzKzaXv6vC4vI7SuP9Lgdxcb8bezsDU6SicCWnuxelQJkV9+KQB/F > kPZMTrEXMItV1xjKiTtwKeCFi8XcNwL0uZSxV5EdWicSFX6X8iItMefGtIBSoZd7 > TBvj6Va/xxXgyAg/4NYrGdjtP9gxUKfPMczNsVoe0Zkflxr9Y4bqWmOaXf/+ZNuE > DAQPyGeCNkEzBqB5uzJ0MLykmEO2gHORlTqDpJdQnB1WR++TQCgQn7jPox5luohb > TesgtXPq99h7qxEq+8t+ > =Vmbd > -----END PGP SIGNATURE----- > > -- > > --- > You received this message because you are subscribed to the Google > Groups "memcached" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "memcached" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- --- You received this message because you are subscribed to the Google Groups "memcached" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
