Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why are items limited to 1 megabyte in size?

items limited megabyte size
0
Posted

Why are items limited to 1 megabyte in size?

0

Ahh, this is a popular question! Short answer: Because of how the memory allocator’s algorithm works. Long answer: Memcached’s memory storage engine (which will be pluggable/adjusted in the future…), uses a slabs approach to memory management. Memory is broken up into slabs chunks of varying sizes, starting at a minimum number and ascending by a factorial up to the largest possible value. Say the minimum value is 400 bytes, and the maximum value is 1 megabyte, and the factorial is 1.20: slab 1 – 400 bytes slab 2 – 480 bytes slab 3 – 576 bytes … etc. The larger the slab, the more of a gap there is between it and the previous slab. So the larger the maximum value the less efficient the memory storage is. Memcached also has to pre-allocate some memory for every slab that exists, so setting a smaller factorial with a larger max value will require even more overhead. There’re other reason why you wouldn’t want to do that… If we’re talking about a web page and you’re attempting to stor

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123