SDS (Simple Dynamic string) memory pre-allocation optimization strategy

Source: Internet
Author: User


In the current version of redis,Sds_max_preallocIs1024*1024, That is, when the size is smaller1 MBWhen the append operation is performed,SdsmakeroomforAllocate more space than the required size. When the string size is greater1 MB, ThenSdsmakeroomforThey are allocated more1 MB.

ExecutedAppendThe command string carries additional pre-allocated space, which will not be released unless the key corresponding to the string is deleted, or after redis is disabled, no pre-allocated space will be allocated to the re-loaded string objects during restart.

Because executionAppendThe number of string keys in a command is usually not large, and the memory size is usually small. Therefore, this is generally not a problem.

On the other hand, ifAppendThere are many keys to operate, and if the string size is large, you may need to modify the redis server so that it can regularly release pre-allocated space for some string keys, so as to use the memory more effectively.




SDS (Simple Dynamic string) memory pre-allocation optimization strategy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.