# Memcached portion restriction

Why exists a hardcoded portion restriction (.5 meg after compression) in memcached? Has any person recompiled their own to up it? I recognize I need to not be sending out large portions like that around, yet these added hefty portions take place for me periodically and also create chaos.

0
2019-05-13 02:42:42
Source Share

This inquiry made use of to be in the official FAQ

To price estimate:

The straightforward restrictions you will possibly see with memcache are the key and also thing dimension restrictions. Keys are limited to 250 personalities. Saved information can not go beyond 1 megabyte in dimension, because that is the biggest regular piece dimension."

The FAQ has actually currently been changed and also there are currently 2 different inquiries covering this:

The maximum dimension of a key is 250 personalities. Note this value will certainly be much less if you are making use of customer "prefixes" or comparable attributes, given that the prefix is added onto the front of the initial key. Much shorter keys are usually much better given that they conserve memory and also make use of much less transmission capacity.

Ahh, this is a preferred inquiry!

Brief solution: Because of just how the memory allocator is algorithm jobs.

Lengthy solution: Memcached is memory storage space engine (which will certainly be pluggable/adjusted in the future ...), makes use of a pieces approach to memory monitoring. Memory is separated right into pieces portions of differing dimensions, beginning at a minimum number and also rising by a factorial approximately the biggest feasible value.

Claim the minimum value is 400 bytes, and also the maximum value is 1 megabyte, and also the factorial is 1.20:

piece 1 - 400 bytes piece 2 - 480 bytes piece 3 - 576 bytes ... etc

The bigger the piece, the even more of a void there is in between it and also the previous piece. So the bigger the maximum value the much less reliable the memory storage space is. Memcached additionally needs to pre - allocate some memory for every single piece that exists, so establishing a smaller sized factorial with a bigger max value will certainly call for a lot more overhanging.

There are various other reason that you would not intend to do that ... If we are speaking about a website and also you are trying to store/load values that huge, you are possibly doing glitch. At that dimension it'll take a recognizable quantity of time to load and also unbox the data structure right into memory, and also your website will likely not execute quite possibly.

If you actually do intend to store things bigger than 1MB, you can recompile memcached with a modified slabs.c:POWER_BLOCK value, or make use of the ineffective malloc/free backend. Various other pointers include a data source, MogileFS, etc

0
2019-05-22 12:15:19
Source