Unfortunately the test you are doing there is not likely going to give you results you are expecting. Memcached allocated 'slabs' of memory 1mb at a time. It allocates slabs for different sized data. The '-m 1' option you have specified will only allow it to create one slab of the data size of the first set you are giving it. In other words if the first set you do has a value that is 240 bytes long, a slab of 1mb will be created that can hold 4096 items of that size or smaller. If you tried to do a set with more than 256 bytes of data, then that set would fail because memcached wont be able to allocated any more memory.
Memcached is not built to work very well with a very low amount of memory allocated. I doubt anyone would recommend you use it with less than 32mb entered. I'm not sure what you are trying to determine here. On Thu, Nov 20, 2008 at 3:31 PM, Jitendra <[EMAIL PROTECTED]> wrote: > > Thanks to all for the suggestions. > I didn't have the idea that memcache uses the clean-up algorithm to > clean the items from the cache. > > Any way we are planning to store some historic data in the cache for > faster access. > I agree, we have to plan for the no of instances required and start > them based on the data type that we want to store. > > I know that using the memcache status binary (memstat) we can see the > bytes written and limit of max bytes. > To test this condition I executed one small program which will keep on > adding the items to memcache. Deliberately I started memcache server > to assign small amount of memory (./memcached -d -m 1 -l localhost -p > 11211). > The server allocate only 1048576 bytes of memory. But I found that the > bytes_written it not going above 910610 and it is deleting the items > from the cache. > So I can't know what is the actual limit where I have to stop. > > Appreciate any suggestions on this regard. > Thanks in advance. > > > > > Vipin Kalra wrote: > > I'll second with the opinion that other people have posted and will not > > recommend to add Memcache on the fly. Rather best practice would be > forecast > > your capacity and plan accordingly for the number of Memcached server > which > > will provide better scalability. > > > > To answer to your original question of how to check if memcahced is full > is > > by checking memcahed status and compare "bytes" with "limit_maxbytes". > Pls > > note that doing it this way can have performance implications depending > on > > how often you write into memcache. > > > > Displaying the cache stats: > > pid: 17476 > > uptime: 2950218 > > time: 1225921019 > > version: 1.2.5 > > pointer_size: 32 > > rusage_user: 0.185971 > > rusage_system: 5.735128 > > curr_items: 1321 > > total_items: 2964 > > bytes: 29910319 > > curr_connections: 6 > > total_connections: 59 > > connection_structures: 20 > > cmd_get: 3487 > > cmd_set: 2964 > > get_hits: 2535 > > get_misses: 952 > > evictions: 0 > > bytes_read: 33846167 > > bytes_written: 30810647 > > limit_maxbytes: 1073741824 > > threads: 1 > > > > > > On Wed, Nov 19, 2008 at 7:39 AM, Jose Celestino <[EMAIL PROTECTED]> wrote: > > > > > > > > Words by Jitendra [Wed, Nov 19, 2008 at 01:42:28AM -0800]: > > > > > > > > Hi, > > > > We are planning to implement memcached as part of our project.As the > > > > data is huge, we are expecting it will go beyond the size of cache. > So > > > > how can we know that the cache is full, hence we can start another > > > > instance of memcache. > > > > > > Look for the number of evictions growing when you to stats. > > > Evicions happening means memcached is removing active objects from > cache > > > to make space for new ones. > > > > > > -- > > > Jose Celestino | http://japc.uncovering.org/files/japc-pgpkey.asc > > > ---------------------------------------------------------------- > > > "One man's theology is another man's belly laugh." -- Robert A. > Heinlein > > > > -- "Be excellent to each other"
