Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-17 Thread Nicolas Martinez
Nice, thank you very much. Are you ok with : Example : •Key : test •Data : 90 bytes •Flags : 0 Size : (4+1) + (90+2) + (1+2+4) + 48 + 8 = 160 Bytes => Slab 4 (192 Bytes) Key (characters count) + 1 + Data (characters count) + 2 bytes ( \r\n ) + Header + Chunk Size + CAS Size Header

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-16 Thread dormando
key + 1b val + 2b item struct 48b [optional CAS] 8b then the suffix trailer printf: please read the manpage for snprintf: snprintf(suffix, 40, " %d %d\r\n", flags, nbytes - 2); there are four characters in there. two spaces, and then \r and \n. the two %d's change into: "0" for flags, and "90" fo

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-16 Thread Nicolas Martinez
The test was : •Key : test •Data : 90 bytes •Flags : 0 :( Le lundi 16 novembre 2015 19:01:50 UTC+1, Nicolas Martinez a écrit : > > Ok... i think i have understood what you say: > > Key (Characters Number) + 1 + Data (Characters Number) + Header + Chunk > Size + CAS Size > > Header = Flags (Char

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-16 Thread Nicolas Martinez
Ok... i think i have understood what you say: Key (Characters Number) + 1 + Data (Characters Number) + Header + Chunk Size + CAS Size Header = Flags (Characters Number) + Key (Characters Numbers) + 2 bytes ( \r\n ) + 4 bytes (2 spaces and 1 \r) Chunk Size = 48 bytes (default) CA

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-16 Thread Nicolas Martinez
Thank you very much for yours answers. Ok for CAS... i don't use -C so i have to add 8 bytes i still don"t understand these lines : >> 2b appended to data_bytes for an extra "\r\n" + So, \r\n == 2b ? >> + 4 bytes for spaces and \r\n which spaces? What is this \r\n ? Isn't already counted before

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-15 Thread dormando
Read carefully: item_size_ok(const size_t nkey, const int flags, const int nbytes) { passes: size_t ntotal = item_make_header(nkey + 1, flags, nbytes, prefix, &nsuffix); Then conditionally: if (settings.use_cas) { ntotal += sizeof(uint64_t);

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-15 Thread Nicolas Martinez
Hi, Is CAS always used? If yes, we have to always add 56 bytes to the KEY and VALUE ? you don't count FLAGS characters?? I've found that Flags's size (number of characters) impact the storage. Example: - Key : 2 characters = 2 bytes - Value : 28 characters = 28 bytes - FLAGS : 1 char

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-14 Thread dormando
The mysql docs don't speak for the main tree... that's their own thing. the "sizes" binary that comes with the source tree tells you how many bytes an item will use (though I intend to add this output to the 'stats' output somewhere). With CAS this is 56 bytes. 56 + 2 + 30 == 88. Class 1 by defau

Re: HELP ! How Memcached objects are stored in the good SLAB

2015-11-14 Thread Nicolas Martinez
Add: Memcached version : 1.4.4 (RedHat) Le samedi 14 novembre 2015 14:49:37 UTC+1, Nicolas Martinez a écrit : > > Hi, > few days i'm reading Memcached documentation and blogs... and i don't > understand how objects are stored. > > *My test* > > 3 slabs : > > >- 96.0 Bytes > - 120.0 By