Memory compression method and device based on large memory, electronic equipment and storage medium

By identifying and compressing memory blocks that point to the same object value within large memory blocks, combined with invalid object cleanup, the performance issues caused by large memory usage and frequent updates in e-commerce systems are resolved, achieving lightweight memory compression and resource optimization.

CN116126741BActive Publication Date: 2026-03-03VIPSHOP (GUANGZHOU) SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211696107.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2026-03-03
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

In e-commerce, where the amount of product data stored is large and the number of products is large enough, existing technologies require a large amount of memory space for each product information item, and the frequent dynamic updates of product listing and delisting increase the time complexity, leading to a decrease in system performance.

Method used

By obtaining object information and addresses from large memory blocks, identifying identical object values ​​and pointing them to the same address in compressed memory blocks, and combining object types to clean up invalid objects, compressed memory blocks are generated to reduce memory usage.

Benefits of technology

While maintaining service response speed, lightweight compressed storage of large memory was achieved, reducing memory usage and optimizing resource scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116126741B_ABST
    Figure CN116126741B_ABST
Patent Text Reader

Abstract

This invention provides a memory compression method, apparatus, electronic device, and storage medium based on large memory. The method includes: obtaining multiple object information and multiple first addresses from each memory object in a large memory block, wherein the multiple object information includes multiple corresponding object values; generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses; and generating a compressed memory block based on the multiple object information and the multiple second addresses. By pointing object information with the same value but different addresses in the memory object to the same compressed information in the compressed memory, lightweight restorage of large memory is achieved through compressed memory blocks while maintaining service response speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of memory compression, and in particular to a memory compression method, apparatus, electronic device, and storage medium based on large memory. Background Technology

[0002] With the development of internet applications, the performance efficiency, data memory requirements, and CPU utilization demands of network application services are increasing, leading to a significant increase in the amount of memory used for network application services. Memory is a crucial system resource, serving as an intermediary between the hard drive and CPU, supporting the real-time operation of the operating system and applications, and providing high service timeliness. In the product search service, where rapid response and information delivery are desired, data needs to be loaded into memory. For applications with large storage spaces and real-time search scenarios, reliable and efficient lightweight storage compression technologies are required to reduce the complexity of product data usage in memory, decrease memory consumption, and adapt to more storage scenarios, thereby ensuring the quality of application services.

[0003] In existing technologies, each product data item has corresponding information such as brand, category, merchant, various tags, and product keywords. Since the system needs to quickly retrieve information for each product, it needs to be loaded into memory. Therefore, for large-memory storage methods, the database source (Redis / MySQL / Tair, etc.) is converted into (Java / C++, etc.) objects and loaded into memory. The memory format is key-value, where the key is the product ID and the value is a detailed product information object, including fields such as brand, category, merchant, various tags, and product keywords.

[0004] In e-commerce systems with large volumes of product data and a sufficiently large number of products, all information needs to be stored, resulting in extremely high memory consumption. Each product information corresponds to a separate object, and each object uses a different memory address, occupying a memory block. With each product's listing and delisting dynamically updates, the product list needs to be dynamically maintained, significantly increasing time complexity. As the number of products increases and changes frequently, it becomes a system of scalable complexity. Summary of the Invention

[0005] Therefore, it is necessary to provide a memory compression method, apparatus, electronic device, and storage medium based on large memory that can reduce service resource scheduling and perform lightweight compressed storage of memory objects while maintaining service response speed.

[0006] Firstly, a memory compression method based on large memory is provided, the method comprising:

[0007] Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0008] Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0009] A compressed memory block is generated based on the multiple object information and the multiple second addresses.

[0010] In one embodiment, generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes:

[0011] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0012] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0013] In one embodiment, the step of modifying the plurality of first target addresses corresponding to the plurality of target object information from the plurality of first addresses to a second target address from the plurality of second addresses and determining whether there are any other identical target object values ​​among the plurality of object values ​​includes:

[0014] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0015] In one embodiment, generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes:

[0016] An object compression information is generated based on the multiple target object information and the second target address;

[0017] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0018] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0019] In one embodiment, generating object compression information based on the plurality of target object information and the second target address includes:

[0020] Determine the number of target information items corresponding to the multiple target object information items;

[0021] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0022] In one embodiment, the plurality of object information includes corresponding plurality of object values, and the step of obtaining the plurality of object information and plurality of first addresses from each memory object from the large memory block includes:

[0023] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0024] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0025] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0026] In one embodiment, determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes:

[0027] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0028] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0029] If not, then stop cleaning.

[0030] On the other hand, a memory compression device based on large memory is provided, the device comprising:

[0031] The acquisition module is used to acquire multiple object information and multiple first addresses in each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0032] The address generation module is used to generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0033] A memory generation module is used to generate compressed memory blocks based on the multiple object information and the multiple second physical addresses.

[0034] In one embodiment, the address generation module generates multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses, including:

[0035] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0036] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0037] In one embodiment, the address generation module modifies multiple first target addresses corresponding to multiple target object information from the multiple first addresses to second target addresses from the multiple second addresses, and determines whether there are any other identical target object values ​​among the multiple object values, including:

[0038] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0039] In one embodiment, the memory generation module generates compressed memory blocks based on the plurality of object information and the plurality of second addresses, including:

[0040] An object compression information is generated based on the multiple target object information and the second target address;

[0041] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0042] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0043] In one embodiment, the memory generation module generates object compression information based on the plurality of target object information and the second target address, including:

[0044] Determine the number of target information items corresponding to the multiple target object information items;

[0045] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0046] In one embodiment, the plurality of object information includes corresponding plurality of object values, and the acquisition module acquires the plurality of object information and plurality of first addresses from each memory object from the large memory block, including:

[0047] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0048] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0049] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0050] In one embodiment, the acquisition module determines the target memory object among all objects based on the target object type and cleans up invalid objects in the target memory object, including:

[0051] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0052] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0053] If not, then stop cleaning.

[0054] In another aspect, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0055] Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0056] Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0057] A compressed memory block is generated based on the multiple object information and the multiple second addresses.

[0058] In one embodiment, the processor performs the following steps when executing the computer program:

[0059] The step of generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes:

[0060] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0061] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0062] In one embodiment, the processor performs the following steps when executing the computer program:

[0063] The step of modifying the multiple first target addresses corresponding to the multiple target object information from the multiple first addresses to the second target address from the multiple second addresses and determining whether there are any other target object values ​​that are the same among the multiple object values ​​includes:

[0064] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0065] In one embodiment, the processor performs the following steps when executing the computer program:

[0066] The step of generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes:

[0067] An object compression information is generated based on the multiple target object information and the second target address;

[0068] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0069] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0070] In one embodiment, the processor performs the following steps when executing the computer program:

[0071] The step of generating object compression information based on the plurality of target object information and the second target address includes:

[0072] Determine the number of target information items corresponding to the multiple target object information items;

[0073] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0074] In one embodiment, the processor performs the following steps when executing the computer program:

[0075] The multiple object information includes multiple corresponding object values, and the step of obtaining multiple object information and multiple first addresses from each memory object from the large memory block includes:

[0076] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0077] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0078] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0079] In one embodiment, the processor performs the following steps when executing the computer program:

[0080] The step of determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes:

[0081] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0082] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0083] If not, then stop cleaning.

[0084] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0085] Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0086] Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0087] A compressed memory block is generated based on the multiple object information and the multiple second addresses.

[0088] In one embodiment, the computer program performs the following steps when executed by a processor:

[0089] The step of generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes:

[0090] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0091] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0092] In one embodiment, the computer program performs the following steps when executed by a processor:

[0093] The step of modifying the multiple first target addresses corresponding to the multiple target object information from the multiple first addresses to the second target address from the multiple second addresses and determining whether there are any other target object values ​​that are the same among the multiple object values ​​includes:

[0094] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0095] In one embodiment, the computer program performs the following steps when executed by a processor:

[0096] The step of generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes:

[0097] An object compression information is generated based on the multiple target object information and the second target address;

[0098] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0099] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0100] In one embodiment, the computer program performs the following steps when executed by a processor:

[0101] The step of generating object compression information based on the plurality of target object information and the second target address includes:

[0102] Determine the number of target information items corresponding to the multiple target object information items;

[0103] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0104] In one embodiment, the computer program performs the following steps when executed by a processor:

[0105] The multiple object information includes multiple corresponding object values, and the step of obtaining multiple object information and multiple first addresses from each memory object from the large memory block includes:

[0106] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0107] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0108] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0109] In one embodiment, the computer program performs the following steps when executed by a processor:

[0110] The step of determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes:

[0111] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0112] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0113] If not, then stop cleaning.

[0114] By retrieving multiple object information and multiple first addresses from each memory object in a large memory block, wherein the multiple object information includes multiple corresponding object values; generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses; and generating a compressed memory block based on the multiple object information and the multiple second addresses, lightweight restorage of large memory is achieved by pointing object information with the same value but different addresses in the memory object to the same compressed information in the compressed memory, while maintaining service response speed. Attached Figure Description

[0115] Figure 1This is a flowchart illustrating a memory compression method based on large memory.

[0116] Figure 2 This is a schematic diagram illustrating the steps of a memory compression method based on large memory.

[0117] Figure 3 This is a schematic diagram of a memory compression device based on large memory.

[0118] Figure 4 This is an internal structural diagram of a computer device in an embodiment of the present invention. Detailed Implementation

[0119] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description, in conjunction with the accompanying drawings and embodiments, further illustrates this application. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0120] The method provided in this application can be applied to, for example... Figure 1 The flowchart of the memory compression method based on large memory is shown below. First, the target memory object is determined among all objects based on the target object type, and invalid objects in the large memory block are cleaned up. Then, multiple object information and multiple first addresses are obtained from each target memory object. Next, the same target object value is determined from the multiple object values, and multiple target object information is determined from the multiple object information based on the target object value. Then, the first addresses corresponding to the object information with the same object value are all modified to second addresses. Finally, object compression information is generated based on the multiple object information and the second addresses. Finally, a compressed memory block is generated based on the object compression information.

[0121] In one embodiment, such as Figure 2 As shown, this invention provides a memory compression method based on large memory, the method comprising:

[0122] S201. Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0123] S202. Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0124] S203. Generate a compressed memory block based on the multiple object information and the multiple second addresses.

[0125] Specifically, for example, multiple object information is first retrieved from a large memory location that primarily stores a large number of product objects. Each memory object contains multiple object information entries and corresponding first addresses. The object information includes brand, category, color, tag, time, etc. Taking memory object A and memory object B as examples, A contains three object information entries: "Brand: 118", with its corresponding first address [0x4cfb4b5]; "Category: 100", with its corresponding first address [0x4ea9484]; and "Tag: 999", with its corresponding first address [0x3rqa2c3]. B contains three object information entries: "Brand: 118", with its corresponding first address [0x4cfb4b6]; "Category: 102", with its corresponding first address [0x6fa7q3]; and "Tag: 999", with its corresponding first address [0x3rqa2c4]. Object A contains three object values: "100", "118", and "999", while object B contains three object values: "118", "102", and "999". Then, the first address corresponding to each of the multiple object values ​​is modified to the compressed address (second address) in the compressed memory block, and the multiple object values ​​are compressed and stored in the compressed memory block.

[0126] In one embodiment, generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes:

[0127] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0128] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0129] Specifically, the process involves finding the same target object value among multiple object values ​​in multiple memory objects. For example, if memory objects A, B, and D all have the same object value "118", then it is determined from the large memory that multiple memory objects A, B, and D all contain the same target object information ("Brand: 118"). At this point, the multiple first addresses corresponding to the multiple target object information, including [0x4cfb4b5] and [0x4cfb4b6], are all modified to second addresses (compressed addresses), such as [0x001]. This is used to point the multiple identical object information in the large memory to compressed information in a compressed memory block. After all modifications are completed, it is further determined whether there are other identical object values ​​among the multiple memory objects in the large memory.

[0130] In one embodiment, the step of modifying the plurality of first target addresses corresponding to the plurality of target object information from the plurality of first addresses to a second target address from the plurality of second addresses and determining whether there are any other identical target object values ​​among the plurality of object values ​​includes:

[0131] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0132] Specifically, when it is determined that there are other identical object values, such as "999", in the large memory, the corresponding other target object information ("tag: 999") is found from multiple memory objects, such as A, B, and C. At this time, the multiple first other addresses in the multiple other target object information, including [0x3rqa2c3] and [0x3rqa2c4], are uniformly modified to the second other target address (compressed address), such as [0x002]. After the modification is completed, it is determined whether there are other identical object values ​​in the large memory. If so, the modification continues until the first address corresponding to all identical object values ​​has been modified.

[0133] In one embodiment, generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes:

[0134] Generate the compressed memory block and generate object compression information based on the multiple target object information and the second target address;

[0135] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0136] The compression information of one object and the compression information of the remaining objects are written into the compressed memory block.

[0137] Specifically, after all the first addresses corresponding to the aforementioned target object information have been modified, a compressed memory block is generated. This compressed memory block can be a small area within the large memory block, or it can be any other memory block connected to the large memory block as configured by the user. The generated compressed memory block contains multiple compressed addresses, namely the second target address and the second other target address. Then, multiple identical object information strings, such as multiple identical strings of "Brand: 118", are compressed to generate one object compressed information string. Finally, multiple identical other object information strings, such as "Label: 999", are compressed to generate one or more other object compressed information strings.

[0138] In one embodiment, generating the compressed memory block and generating object compression information based on the plurality of target object information and the second target address includes:

[0139] Generate the compression information of the object based on the information of the multiple target objects;

[0140] Determine the number of target information corresponding to the multiple target object information and write the number of target information and the second target address into the object compression information.

[0141] Specifically, as described above, duplicate characters in multiple identical object information are compressed and recorded in the object compression information. Then, multiple first addresses in the large memory are normalized—that is, different first addresses of multiple identical object values ​​are modified to the same second address—and the corresponding memory objects are then directed to the object compression information. For example, based on the multiple identical object information "Brand: 118" in memory objects A, B, and D, the target information number and the corresponding second target address are written, ultimately generating a single object compression information, such as "Brand: 118, Number of Duplicate Characters (Target Information Number): 3," with the corresponding address [0x001]. After modifying the corresponding first addresses, including [0x4cfb4b5] and [0x4cfb4b6], to [0x001], memory objects A, B, and D in the large memory can point to the object compression information in the compressed memory block. This allows for quick retrieval of a specific memory object within the large memory block based on multiple object compression information, and also allows for quick retrieval of multiple object information for a specific memory object from the compressed memory block.

[0142] In one embodiment, the plurality of object information includes corresponding plurality of object values, and the step of obtaining the plurality of object information and plurality of first addresses from each memory object from the large memory block includes:

[0143] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0144] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0145] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0146] Specifically, the process involves iterating through all object types in a large memory block and determining the target object type that appears most frequently. Taking a large memory block used for e-commerce purposes as an example, it primarily stores data related to a large number of product (object type) objects, as well as data related to objects such as logistics (object type) and customers (object type). At this point, it is necessary to determine the target object type that appears most frequently based on all object types, i.e., to determine the main purpose of the large memory block (for product objects). Then, after cleaning up invalid objects in the product objects, the process retrieves multiple object information and multiple first addresses corresponding to all product objects (A, B, C, D, etc. mentioned above) in the large memory block from the valid product objects.

[0147] In one embodiment, determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes:

[0148] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0149] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0150] If not, then stop cleaning.

[0151] Specifically, as mentioned above, after determining that the large memory block is mainly used for product objects, i.e., that product objects occupying most of the memory in the large memory block need to be compressed, the idea of ​​optimal storage is adopted to first determine whether the total number of product objects exceeds the user-set threshold for the number of objects, or whether the number of product objects exceeds the memory ratio set in the large memory block. If not, there is no need to clean up invalid product objects; if so, clean up the product objects with the fewest accesses (invalid objects) until the object number threshold requirement or memory ratio requirement is met.

[0152] The proposed solution has the following beneficial effects:

[0153] 1) By pointing object information with the same value but different addresses in memory objects to the same compressed information in compressed memory, lightweight restorage of large memory can be achieved by compressing memory blocks while maintaining service response speed.

[0154] 2) By setting a threshold for object storage in large memory and periodically cleaning up invalid objects in large memory, the idea of ​​object storage optimization is realized, reducing the scheduling of service resources in large memory.

[0155] It should be understood that, although Figure 2The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0156] In one embodiment, such as Figure 3 As shown, a memory compression device based on large memory is provided, the device comprising:

[0157] The acquisition module 301 is used to acquire multiple object information and multiple first addresses in each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0158] Address generation module 302 is used to generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0159] The memory generation module 303 is used to generate compressed memory blocks based on the multiple object information and the multiple second physical addresses.

[0160] In one embodiment, the address generation module generates multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses, including:

[0161] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0162] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0163] In one embodiment, the address generation module modifies multiple first target addresses corresponding to multiple target object information from the multiple first addresses to second target addresses from the multiple second addresses, and determines whether there are any other identical target object values ​​among the multiple object values, including:

[0164] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0165] In one embodiment, the memory generation module generates compressed memory blocks based on the plurality of object information and the plurality of second addresses, including:

[0166] An object compression information is generated based on the multiple target object information and the second target address;

[0167] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0168] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0169] In one embodiment, the memory generation module generates object compression information based on the plurality of target object information and the second target address, including:

[0170] Determine the number of target information items corresponding to the multiple target object information items;

[0171] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0172] In one embodiment, the plurality of object information includes corresponding plurality of object values, and the acquisition module acquires the plurality of object information and plurality of first addresses from each memory object from the large memory block, including:

[0173] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0174] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0175] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0176] In one embodiment, the acquisition module determines the target memory object among all objects based on the target object type and cleans up invalid objects in the target memory object, including:

[0177] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0178] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0179] If not, then stop cleaning.

[0180] Specific limitations regarding memory compression devices based on large memory can be found in the limitations of memory compression methods based on large memory described above, and will not be repeated here. Each module in the aforementioned memory compression device based on large memory can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0181] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an alarm information processing method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0182] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0183] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0184] Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0185] Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0186] A compressed memory block is generated based on the multiple object information and the multiple second addresses.

[0187] In one embodiment, the processor performs the following steps when executing the computer program:

[0188] The step of generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes:

[0189] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0190] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0191] In one embodiment, the processor performs the following steps when executing the computer program:

[0192] The step of modifying the multiple first target addresses corresponding to the multiple target object information from the multiple first addresses to the second target address from the multiple second addresses and determining whether there are any other target object values ​​that are the same among the multiple object values ​​includes:

[0193] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0194] In one embodiment, the processor performs the following steps when executing the computer program:

[0195] The step of generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes:

[0196] An object compression information is generated based on the multiple target object information and the second target address;

[0197] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0198] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0199] In one embodiment, the processor performs the following steps when executing the computer program:

[0200] The step of generating object compression information based on the plurality of target object information and the second target address includes:

[0201] Determine the number of target information items corresponding to the multiple target object information items;

[0202] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0203] In one embodiment, the processor performs the following steps when executing the computer program:

[0204] The multiple object information includes multiple corresponding object values, and the step of obtaining multiple object information and multiple first addresses from each memory object from the large memory block includes:

[0205] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0206] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0207] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0208] In one embodiment, the processor performs the following steps when executing the computer program:

[0209] The step of determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes:

[0210] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0211] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0212] If not, then stop cleaning.

[0213] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0214] Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values;

[0215] Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses;

[0216] A compressed memory block is generated based on the multiple object information and the multiple second addresses.

[0217] In one embodiment, the computer program performs the following steps when executed by a processor:

[0218] The step of generating multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes:

[0219] Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value;

[0220] From the plurality of first addresses, modify the plurality of first target addresses corresponding to the plurality of target object information to the second target address from the plurality of second addresses, and determine whether there are any other target object values ​​that are the same among the plurality of object values.

[0221] In one embodiment, the computer program performs the following steps when executed by a processor:

[0222] The step of modifying the multiple first target addresses corresponding to the multiple target object information from the multiple first addresses to the second target address from the multiple second addresses and determining whether there are any other target object values ​​that are the same among the multiple object values ​​includes:

[0223] If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses.

[0224] In one embodiment, the computer program performs the following steps when executed by a processor:

[0225] The step of generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes:

[0226] An object compression information is generated based on the multiple target object information and the second target address;

[0227] Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address;

[0228] The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

[0229] In one embodiment, the computer program performs the following steps when executed by a processor:

[0230] The step of generating object compression information based on the plurality of target object information and the second target address includes:

[0231] Determine the number of target information items corresponding to the multiple target object information items;

[0232] The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

[0233] In one embodiment, the computer program performs the following steps when executed by a processor:

[0234] The multiple object information includes multiple corresponding object values, and the step of obtaining multiple object information and multiple first addresses from each memory object from the large memory block includes:

[0235] Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects;

[0236] Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object;

[0237] After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

[0238] In one embodiment, the computer program performs the following steps when executed by a processor:

[0239] The step of determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes:

[0240] The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold.

[0241] If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up;

[0242] If not, then stop cleaning.

[0243] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0244] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0245] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A memory compression method based on large memory, the method comprising: Obtain multiple object information and multiple first addresses from each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values; Generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses; A compressed memory block is generated based on the multiple object information and the multiple second addresses; The generation of multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses includes: Determine the same target object value from the plurality of object values, and determine multiple target object information from the plurality of object information based on the target object value; Modifying the multiple first target addresses corresponding to the multiple target object information from the multiple first addresses to the second target address from the multiple second addresses, and determining whether there are any other target object values ​​that are the same among the multiple object values, includes: If the remaining target object value exists among the plurality of object values, then multiple remaining target object information is determined from the plurality of object information based on the remaining target object value, and the first remaining target address corresponding to the multiple remaining target object information is modified from the plurality of first addresses to the second remaining target address among the plurality of second addresses; The step of generating a compressed memory block based on the plurality of object information and the plurality of second addresses includes: An object compression information is generated based on the multiple target object information and the second target address; Generate compression information for the remaining objects based on the information of the plurality of remaining target objects and the second remaining target address; The compressed memory block is generated based on the compression information of one object and the compression information of the remaining objects.

2. The method according to claim 1, characterized in that, The step of generating object compression information based on the plurality of target object information and the second target address includes: Determine the number of target information items corresponding to the multiple target object information items; The object compression information is generated based on the multiple target object information, the number of target information, and the second target address.

3. The method according to claim 1, characterized in that, The multiple object information includes multiple corresponding object values, and the step of obtaining multiple object information and multiple first addresses from each memory object from the large memory block includes: Iterate through all objects in the large memory block and determine the target object type that has the most occurrences of the same type from all object types corresponding to all objects; Based on the target object type, determine the target memory object among all objects and clean up the invalid objects in the target memory object; After the invalid objects are cleaned up, multiple object information and multiple first addresses in each memory object are obtained from the target memory object.

4. The method according to claim 3, characterized in that, The step of determining the target memory object among all objects based on the target object type and cleaning up invalid objects in the target memory object includes: The target memory object is determined based on the target object type, and it is determined whether the total number of the target memory objects exceeds the user-set object number threshold. If so, then the object with the fewest accesses is identified as the invalid object and the invalid object is cleaned up; If not, then stop cleaning.

5. A memory compression apparatus for implementing the memory compression method based on large memory according to any one of claims 1-4, the apparatus comprising: The acquisition module is used to acquire multiple object information and multiple first addresses in each memory object from a large memory block, wherein the multiple object information includes multiple corresponding object values; The address generation module is used to generate multiple second addresses corresponding to the multiple object information based on the multiple object values ​​and the multiple first addresses; A memory generation module is used to generate compressed memory blocks based on the multiple object information and the multiple second addresses.

6. An electronic device, characterized in that, include: One or more processors; And a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the method as described in any one of claims 1 to 4.

7. A computer storage medium, characterized in that, It stores a computer program, which, when executed by a processor, implements the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Compression method, device and equipment

    CN105204781A

  • Data processing method, device and equipment

    CN115242251A