Multi-layer embedded table updating method, device, equipment and medium based on hash table

Through the multi -layer embedded table renewal method based on hash tables, the global mapping table and cache level division rules are used, and the high -efficiency real -time update and visits performance of the oversized large -scale embedded tables are realized. And the problem of poor visits.

CN118885488BActive Publication Date: 2025-01-28BEIJING SUIYUAN INTELLIGENT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411365377.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-28
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

In large-scale recommendation systems or advertising systems, ultra-large-scale embedded tables are affected due to low storage and access efficiency, and the existing technology is difficult to effectively solve this problem.

Method used

Adopt a multi -layer embedded table update method based on the hash table, by receiving the user request instruction, using the pre -stored global mapping table to determine the basic address and target of the access information. Determine the target cache position and level, and update the embedded entry to the target cache position.

Benefits of technology

The efficient and real -time update of the embedded table has been achieved, the visits performance is improved, the consumption of computing resources is reduced, and the problem of low incoming table update efficiency and poor visits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885488B_ABST
    Figure CN118885488B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-layer embedded table update method, device, equipment and medium based on a hash table. The method includes: receiving a current request instruction containing current access information sent by the current user based on a target application; determining the base address corresponding to the current access information based on a pre-stored global mapping table, and determining the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address; determining the target cache position and target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rule, and updating the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level. Through the technical solution of the present invention, real-time updating of the embedded table can be achieved, the memory access performance of the embedded table is improved, and the consumption of computing resources is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a multi-layer embedded table updating method, device, equipment and medium based on a hash table. Background Art

[0002] In scenarios such as large-scale recommendation systems or advertising systems, the corresponding embedding tables often contain billions or even tens of billions of records. Therefore, how to efficiently store and access these ultra-large-scale embedding tables has become a severe challenge.

[0003] Existing technologies usually use single-machine storage or existing cache strategies to store ultra-large-scale embedding tables. However, if a single-machine storage is used to store ultra-large-scale embedding tables, the entire embedding table cannot be completely stored in the memory due to the limited memory of the single machine. If the embedding table is stored on a hard disk or a remote storage server, it will cause huge access delays, seriously affecting system performance. If the graphics processing unit (GPU) video memory is used to store the embedding table, due to the limited capacity of the GPU video memory, it is still impossible to store all the embedding vectors, and frequent data exchange between the GPU video memory and the host memory will bring huge bandwidth overhead.

[0004] If existing cache strategies, such as the Least Recently Used (LRU) algorithm, are used to store large-scale embedded tables, hot data cannot be reused and utilized well, resulting in an unsatisfactory cache hit rate. In addition, existing cache strategies usually manage and access embedded tables as a whole, and cannot effectively utilize the distribution characteristics within the embedded table, resulting in extremely uneven distribution of hot and unpopular data. Therefore, how to efficiently implement real-time updates of embedded tables, improve the memory access performance of embedded tables, and reduce computing resource consumption is a problem that needs to be solved urgently. Summary of the invention

[0005] The present invention provides a multi-layer embedded table updating method, device, equipment and medium based on a hash table, which can solve the problems of low real-time updating efficiency and poor memory access performance of the embedded table.

[0006] According to one aspect of the present invention, a multi-layer embedding table updating method based on a hash table is provided, comprising:

[0007] Receiving a current request instruction sent by a current user based on a target application; wherein the current request instruction includes current access information;

[0008] Determine a base address corresponding to the current access information based on a pre-stored global mapping table, and determine a target embedded entry corresponding to the current access information and a current cache level corresponding to the target embedded entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level, or a video memory cache level;

[0009] Based on the level type of the current cache level and the preset level division rules, determine the target cache position and target cache level corresponding to the target embedded entry, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level.

[0010] According to another aspect of the present invention, there is provided a multi-layer embedding table updating device based on a hash table, comprising:

[0011] A data acquisition module, used to receive a current request instruction sent by a current user based on a target application; wherein the current request instruction includes current access information;

[0012] A data mapping module, configured to determine a base address corresponding to the current access information based on a pre-stored global mapping table, and determine a target embedded entry corresponding to the current access information and a current cache level corresponding to the target embedded entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level, or a video memory cache level;

[0013] An entry update module is used to determine the target cache position and target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rules, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level.

[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0015] at least one processor; and

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the multi-layer embedded table updating method based on a hash table as described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-layer embedded table updating method based on a hash table as described in any embodiment of the present invention when executed.

[0019] According to another aspect of the present invention, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method for updating a multi-layer embedded table based on a hash table according to any embodiment of the present invention is implemented.

[0020] The technical solution of the embodiment of the present invention receives the current request instruction containing the current access information sent by the current user based on the target application, and then determines the base address corresponding to the current access information based on the pre-stored global mapping table, and determines the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address, and finally, determines the target cache position and target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rule, and updates the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level. Due to the introduction of a mapping table that supports high performance and high concurrency, a hierarchical embedded table storage is constructed to realize the real-time update of hotspot embedded data between multi-level storage. Therefore, the problems of low real-time update efficiency and poor memory access performance of the embedded table are solved, and the real-time update of the embedded table can be efficiently realized, the memory access performance of the embedded table is improved, and the consumption of computing resources is reduced.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 is a flowchart of a multi-layer embedded table updating method based on a hash table according to the first embodiment of the present invention;

[0024] Figure 2 is a flowchart of a multi-layer embedded table updating method based on a hash table according to Embodiment 2 of the present invention;

[0025] Figure 3is a schematic diagram of a global mapping table provided according to Embodiment 2 of the present invention;

[0026] Figure 4 is a schematic diagram of a current cache level determination process provided according to Embodiment 2 of the present invention;

[0027] Figure 5 is a flowchart of an optional multi-layer embedded table updating method based on a hash table provided according to Embodiment 2 of the present invention;

[0028] Figure 6 It is a structural diagram of a multi-layer embedded table updating device based on a hash table according to Embodiment 3 of the present invention;

[0029] Figure 7 It is a structural schematic diagram of an electronic device for implementing a multi-layer embedded table updating method based on a hash table according to an embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0031] It should be noted that the terms "first", "second", "target", "base", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] It is worth noting that the acquisition, storage, use and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations.

[0033] Embodiment 1

[0034] Figure 1The flowchart of a multi-layer embedded table update method based on a hash table is provided in the first embodiment of the present invention. This embodiment is applicable to the case of real-time update of ultra-large-scale embedded tables. The method can be executed by a multi-layer embedded table update device based on a hash table. The multi-layer embedded table update device based on a hash table can be implemented in the form of hardware and / or software. The multi-layer embedded table update device based on a hash table can be configured in an electronic device. Figure 1 As shown, the method includes:

[0035] S110, receiving a current request instruction sent by the current user based on the target application; wherein the current request instruction includes current access information.

[0036] The application may refer to a third-party application (Application, App) or web page for users. The target application may refer to an application corresponding to a large-scale scenario system. For example, the target application may be an application corresponding to a recommendation system or an application corresponding to an advertising system. The current user may refer to a user who is accessing the target application at the current moment.

[0037] The current request instruction may refer to an access request instruction to the target application initiated by the current user. For example, the current request instruction may be a request instruction input by the current user via a device such as a mouse or keyboard of the client. The current access information may refer to the access requirement information contained in the current request instruction. For example, it may be a search keyword or user login information.

[0038] Usually, there is only one embedding table for a target application. As long as there is a search action or access request for the target application, an embedding vector will be generated and stored in the embedding table.

[0039] S120. Determine a base address corresponding to the current access information based on a pre-stored global mapping table, and determine a target embedded entry corresponding to the current access information and a current cache level corresponding to the target embedded entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level or a video memory cache level.

[0040] Among them, the global mapping table may refer to a pre-built global-level embedded vector mapping table. Usually, the global mapping table contains mapping tables of multiple levels. The mapping table can store embedded vectors in the form of a hash table, providing an effective basis for subsequent embedded table updates. The embedded entry may refer to each embedded vector entry in the embedded table. Exemplarily, the embedded entry may include a specific unique code (Identification, ID) and a corresponding embedded vector. The target embedded entry may refer to the embedded vector entry corresponding to the current access information.

[0041] The base address may refer to the mapping address of the current access information in the global mapping table. For example, if the data structure of the global mapping table is<key,address> , the corresponding base address address can be determined by the current access information key. The current cache level can refer to the cache level where the target embedded entry is currently located. Generally, the current cache level can be a hard disk cache level, a memory cache level, or a video memory cache level.

[0042] Among them, the video memory cache hierarchy may refer to the hierarchy of embedded vectors whose storage access frequency meets the highest access frequency threshold. Exemplarily, the highest access frequency threshold may be configured as top-k%. For example, top 10%. Typically, the size of the video memory cache hierarchy is between several hundred megabytes (MB) and several gigabytes (GB). The hard disk cache hierarchy may refer to the hierarchy of embedded vectors whose storage access frequency meets the lowest access frequency threshold. Exemplarily, the lowest access frequency threshold may be configured as bottom-p%. For example, bottom 50%. Typically, the size of the hard disk cache hierarchy is between several hundred GB and several terabytes (TB). The memory cache hierarchy may refer to the hierarchy of embedded vectors whose storage access frequency is between the highest access frequency threshold and the lowest access frequency threshold. Typically, the memory cache hierarchy accounts for 20%-30% of the size of the entire global mapping table, and the size is between several GB and tens of GB.

[0043] S130. Based on the level type of the current cache level and the preset level division rule, determine the target cache position and target cache level corresponding to the target embedded entry, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level.

[0044] The preset level division rule may refer to a pre-set cache level division rule, for example, a rule for performing cache level division according to access frequency.

[0045] The target cache level may refer to the cache level to which the target embedded entry needs to be updated. For example, if the current cache level of the target embedded entry is the memory cache level, the target cache level corresponding to the target embedded entry may be the video memory cache level. The target cache location may refer to the storage location of the target embedded entry in the target cache level.

[0046] The technical solution of the embodiment of the present invention receives the current request instruction containing the current access information sent by the current user based on the target application, and then determines the base address corresponding to the current access information based on the pre-stored global mapping table, and determines the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address, and finally, determines the target cache position and target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rule, and updates the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level. Due to the introduction of a mapping table that supports high performance and high concurrency, a hierarchical embedded table storage is constructed to realize the real-time update of hotspot embedded data between multi-level storage. Therefore, the problems of low real-time update efficiency and poor memory access performance of the embedded table are solved, and the real-time update of the embedded table can be efficiently realized, the memory access performance of the embedded table is improved, and the consumption of computing resources is reduced.

[0047] Embodiment 2

[0048] Figure 2 A flowchart of a multi-layer embedded table update method based on a hash table is provided in the second embodiment of the present invention. This embodiment is refined based on the above embodiment. In this embodiment, the operation of determining the target cache position and the target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rule is specifically refined. Specifically, it may include: if the level type of the current cache level is the video memory level, then obtaining the current access frequency corresponding to the target embedded entry and the current cache position of the target embedded entry in the current cache level, taking the current cache level as the target cache level, determining a candidate cache position with a position number less than the current cache position according to the current access frequency, and taking the candidate cache position as the target cache position; if the level type of the current cache level is non-video memory level, then taking the candidate cache level with a level number less than the current cache level as the target cache level, and taking the head position of the target cache level as the target cache position. Figure 2 As shown, the method includes:

[0049] S210 , constructing a first hash table storing the highest priority embedded entries, and generating a first mapping table corresponding to the video memory cache hierarchy.

[0050] The highest priority embedding entry may refer to a hotspot embedding table entry whose access frequency meets the highest access frequency threshold, that is, hotspot data. The first hash table may refer to a high-performance and high-concurrency hash table. The first mapping table may refer to a hash table corresponding to a video memory cache level.

[0051] Since the size and data of the acceleration cache line in the GPU are local, the embodiment of the present invention adopts an efficient hash function and memory layout in the GPU. Thus, the GPU cache can be used to the maximum extent and the cache miss rate can be reduced. At the same time, a special hardware acceleration unit supporting the hash table is designed in the GPU, so that the hash table on the GPU can reach a bandwidth close to the upper limit of the GPU design, for example, up to 1TB.

[0052] S220 , construct a second hash table storing intermediate priority embedded entries, and generate a second mapping table corresponding to the memory cache level.

[0053] The intermediate priority embedding entry may refer to a medium-hot embedding table entry with an access frequency between a maximum access frequency threshold and a minimum access frequency threshold, i.e., secondary hot data. The second hash table may refer to a medium-sized hash table, i.e., a conventional hash table. The second mapping table may refer to a hash table corresponding to a memory cache level.

[0054] It is worth noting that the bandwidth performance of the second hash table implemented using a traditional central processing unit (CPU) is one order of magnitude lower than that of the first hash table, such as 10-50GB. However, since the data stored in the second hash table is secondary hot data, its performance will not affect the performance of the entire multi-layer embedded table update device based on the hash table.

[0055] S230 , obtaining a data storage list corresponding to the hard disk cache level as a third mapping table corresponding to the hard disk cache level.

[0056] The data storage list may refer to embedded table entries whose storage access frequency meets the minimum access frequency threshold, that is, a list of unpopular data. The third mapping table may refer to a storage list corresponding to a hard disk cache level.

[0057] S240: Combine and process the first mapping table, the second mapping table, and the third mapping table to generate a global mapping table.

[0058] Specifically, after the embedded table is hierarchically divided according to the hierarchical embedded table storage architecture, the first mapping table, the second mapping table and the third mapping table corresponding to the same target application are combined and processed to obtain a global mapping table corresponding to the target application.

[0059] Figure 3The figure shows a schematic diagram of a global mapping table provided by an embodiment of the present invention. Specifically, the global mapping table includes a first mapping table corresponding to the video memory cache level, a second mapping table corresponding to the memory cache level, and a third mapping table corresponding to the hard disk cache level. Among them, the first mapping table is a high-performance and high-concurrency hash table that maintains hot embedding table entries to ensure that hot data can be quickly accessed on the GPU; the second mapping table is a conventional hash table that maintains medium-heat embedding table entries; the third mapping table is a storage list on the hard disk that stores the remaining unpopular embedding table entries. Data is swapped in and out between each mapping table.

[0060] S250, receiving a current request instruction sent by the current user based on the target application; wherein the current request instruction includes current access information.

[0061] S260: Determine a base address corresponding to the current access information based on a pre-stored global mapping table, and determine a target embedded entry corresponding to the current access information and a current cache level corresponding to the target embedded entry based on the base address.

[0062] The current cache level includes a hard disk cache level, a memory cache level, or a video memory cache level.

[0063] In an optional embodiment, after determining the base address corresponding to the current access information based on the pre-stored global mapping table, it also includes: if the base address corresponding to the current access information does not exist in the global mapping table, matching the target free address for the current access information; initializing the embedded entry corresponding to the target free address to obtain a random embedded entry; obtaining the basic access frequency of the random embedded entry, and determining the target cache level corresponding to the random embedded entry based on the basic access frequency of the random embedded entry.

[0064] The target free address may refer to a new mapping address allocated for the current access information. The random embedding entry may refer to a new embedding vector obtained by random initialization. The basic access frequency may refer to the access frequency corresponding to the random embedding entry. Specifically, the data structure of the global mapping table is<key,address> For example, if the current access information key1 is not in the global mapping table, a new target free address address1 is allocated for the current access information key1, and then a new random embedding entry embedding1 is randomly initialized, and based on the basic access frequency of embedding1, it is selected to be stored in the memory cache level or the hard disk cache level. In this way, the problem that the embedding table cannot be updated when the current access information is a new key value is solved, making the embedding table update process more complete and improving the update efficiency of the embedding table.

[0065] In an alternative embodiment, after determining the target embedding entry corresponding to the current access information based on the base address, the method further includes: returning and processing the target embedding entry, and incrementing by one the current access frequency corresponding to the target embedding entry by a target access counter. The target access counter may refer to a preset access frequency counter. The access frequency may refer to the number of times the target application is accessed within a set period. Exemplarily, it may be the number of times the target application is accessed within a week. The current access frequency may refer to the access frequency of the target application at the current moment. Exemplarily, it may be the number of times the target application is accessed at the current moment within the current period. Specifically, after determining the target embedding entry corresponding to the current access information based on the base address, the target embedding entry may be returned and processed, and the current access frequency corresponding to the target embedding entry may be incremented by one, providing an effective basis for subsequent embedding table updates.

[0066] Figure 4 The figure shows a schematic diagram of a current cache level determination process provided by an embodiment of the present invention. Specifically, after the current user sends a current request instruction to the target application through a hierarchical embedding table access interface, such as a user login interface, the base address corresponding to the current access information may be determined in sequence in the video memory cache level, the memory cache level, and the hard disk cache level based on a pre-stored global mapping table, and the target embedding entry corresponding to the current access information and the current cache level corresponding to the target embedding entry may be determined based on the base address. The target embedding entry is returned and processed. At the same time, the current access frequency corresponding to the target embedding entry is incremented by one by a target access counter, providing an effective basis for subsequent data swapping operations.

[0067] S270. If the level type of the current cache level is the video memory level, obtain the current access frequency corresponding to the target embedding entry and the current cache position of the target embedding entry in the current cache level. Take the current cache level as the target cache level, determine candidate cache positions with position numbers less than the current cache position based on the current access frequency, and take the candidate cache positions as the target cache positions, and execute S290.

[0068] Among them, the current cache position may refer to the storage position of the target embedding entry in the current cache level. The candidate cache positions may refer to the cache positions in the current cache level with position numbers less than the current cache position. Exemplarily, taking the current cache level, i.e., the video memory cache level, which contains (q1, q2, …, q n ) a total of n embedding entries, and the target embedding entry is q i , where 1 < i < n as an example, the candidate cache positions may be any one of the cache positions from q1 to q i-1 , or may be the cache position q i-1 closest to the target embedding entry.

[0069] Specifically, if the level type of the current cache level is the video memory level, the current cache level can be used as the target cache level, and according to the current access frequency and the current cache position of the target embedded entry, the cache position with a position number smaller than the current cache position and an access frequency smaller than the current access frequency in the current cache level is determined as the candidate cache position, and then the candidate cache position is used as the target cache position. In this way, the target cache level and target cache position under the video memory level are determined, providing an effective update path for subsequent embedded table updates, improving the memory access performance of the embedded table, and reducing computing resource consumption.

[0070] S280: If the level type of the current cache level is non-graphics memory level, a candidate cache level with a level number smaller than the current cache level is used as a target cache level, and a head position of the target cache level is used as a target cache position.

[0071] Among them, the non-video memory layer may refer to the remaining cache layers except the video memory layer. Exemplarily, the non-video memory layer may be a hard disk cache layer or a memory cache layer. The selected cache layer may refer to a cache layer with a layer number less than the current cache layer. Generally, the layer numbers of each cache layer may be sorted according to the priority order of each cache layer. Exemplarily, if the cache layer includes three levels of cache layers, denoted as L1, L2 and L3, then L1 is the video memory cache layer with the highest priority, L2 is the memory cache layer, and L3 is the hard disk cache layer with the lowest priority. The head position may refer to the first cache position in the cache layer.

[0072] Specifically, if the current cache level is the hard disk cache level, the memory cache level is used as the target cache level; if the current cache level is the memory cache level, the video memory cache level is used as the target cache level. After that, the head position of the target cache level is used as the target cache position. In this way, the target cache level and target cache position under the non-video memory level are determined, providing an effective update path for subsequent embedded table updates, improving the memory access performance of the embedded table, and reducing computing resource consumption.

[0073] In an optional embodiment, before the candidate cache level with a level number less than the current cache level is used as the target cache level and the head position of the target cache level is used as the target cache position, it also includes: obtaining the current storage status of the target cache level, and if the current storage status is a full storage state, downgrading the tail data of the target cache level. Among them, the full storage state can refer to the state where the storage margin is empty, that is, the state where the cache level is full of data. The tail data can refer to the data of the last cache position in the cache level. Specifically, if the level type of the current cache level is a non-video memory level, but the target cache level is already full of data, the tail data of the target cache level can be inserted into the head position of the next cache level (that is, the current cache level). For example, if the target cache level is a memory cache level, the tail data of the memory cache level is inserted into the head position of the hard disk cache level; if the target cache level is a video memory cache level, the tail data of the video memory cache level is inserted into the head position of the memory cache level. Therefore, by downgrading the tail data of the target cache level to a less popular level, space can be provided for storing the target embedded entries, thereby improving the memory access performance of the embedded table.

[0074] S290: Update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level.

[0075] Specifically, after determining the target cache position and target cache level corresponding to the target embedded entry, the target embedded entry can be updated from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level, and the target embedded entry in the current cache level can be deleted to achieve the update of the target embedded entry.

[0076] In an optional embodiment, the method further includes: obtaining the space occupancy corresponding to the video memory cache level; if the space occupancy is a space surplus, determining a predicted embedded entry based on the historical access frequency of each embedded header through a first access predictor corresponding to the hard disk cache level or a second access predictor corresponding to the memory cache level, and updating the predicted embedded entry to the video memory cache level.

[0077] Among them, the access predictor may refer to a device that predicts embedded entries that may be accessed in a future time period. The first access predictor may refer to an access predictor deployed at the hard disk cache level. The second access predictor may refer to an access predictor deployed at the memory cache level. The historical access frequency may refer to the access frequency of each embedded entry in a historical time period. The predicted embedded entry may refer to the predicted embedded entry that may be accessed in a future time period.

[0078] Specifically, when there is excess space in the video memory cache layer, for example, some users have quit accessing. The first access predictor corresponding to the hard disk cache layer or the second access predictor corresponding to the memory cache layer can be used to determine the predicted embedding entries based on the historical access frequency of each embedding header, and the predicted embedding entries are updated to the video memory cache layer. In this way, the data of the second hot layer or the unpopular layer can be loaded into the hot data layer in advance, reducing the delay of future access.

[0079] The technical solution of the embodiment of the present invention is to generate a first mapping table corresponding to the video memory cache level by constructing a first hash table storing the highest priority embedded entries, construct a second hash table storing the middle priority embedded entries, generate a second mapping table corresponding to the memory cache level, obtain a data storage list corresponding to the hard disk cache level as a third mapping table corresponding to the hard disk cache level, and combine and process the first mapping table, the second mapping table and the third mapping table to generate a global mapping table. Afterwards, receive the current request instruction sent by the current user based on the target application, determine the base address corresponding to the current access information based on the pre-stored global mapping table, and determine the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address. Furthermore, if the level type of the current cache level is a video memory level, the current access frequency corresponding to the target embedded entry and the current cache position of the target embedded entry in the current cache level are obtained, the current cache level is used as the target cache level, and the candidate cache position with a position number less than the current cache position is determined according to the current access frequency, and the candidate cache position is used as the target cache position; if the level type of the current cache level is a non-video memory level, the candidate cache level with a level number less than the current cache level is used as the target cache level, and the head position of the target cache level is used as the target cache position. Finally, according to the target cache position and the target cache level, the target embedded entry is updated from the current cache level to the target cache position in the target cache level. Due to the introduction of a mapping table that supports high performance and high concurrency, a hierarchical embedded table storage is constructed to realize the real-time update of hotspot embedded data between multi-level storage. Therefore, the problems of low real-time update efficiency and poor memory access performance of the embedded table are solved, and the real-time update of the embedded table can be efficiently realized, the memory access performance of the embedded table is improved, and the consumption of computing resources is reduced.

[0080] Figure 5The flowchart of an optional multi-layer embedded table update method based on a hash table provided by an embodiment of the present invention is shown. Specifically, after receiving the current request instruction containing the current access information sent by the current user based on the target application, the base address corresponding to the current access information is determined based on the pre-stored global mapping table. If the base address corresponding to the current access information does not exist in the global mapping table, the target free address is matched for the current access information, and the embedded entry corresponding to the target free address is initialized to obtain a random embedded entry, and then the basic access frequency of the random embedded entry is obtained, and the target cache level corresponding to the random embedded entry is determined based on the basic access frequency of the random embedded entry. If the base address corresponding to the current access information exists in the global mapping table, the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry are determined in each cache level based on the base address, and the target cache position and target cache level corresponding to the target embedded entry are determined based on the level type of the current cache level and the preset level division rule. Finally, according to the target cache position and the target cache level, the target embedded entry is updated from the current cache level to the target cache position in the target cache level. In this way, data swapping in or out is realized, and the update of the multi-layer embedded table is completed.

[0081] Embodiment 3

[0082] Figure 6 A schematic diagram of a multi-layer embedded table updating device based on a hash table is provided in the third embodiment of the present invention. Figure 6 As shown, the device includes: a data acquisition module 310, a data mapping module 320 and an entry update module 330;

[0083] The data acquisition module 310 is used to receive a current request instruction sent by the current user based on the target application; wherein the current request instruction includes current access information;

[0084] The data mapping module 320 is used to determine the base address corresponding to the current access information based on a pre-stored global mapping table, and determine the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level or a video memory cache level;

[0085] The entry update module 330 is used to determine the target cache position and target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rules, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level.

[0086] The technical solution of the embodiment of the present invention receives the current request instruction containing the current access information sent by the current user based on the target application, and then determines the base address corresponding to the current access information based on the pre-stored global mapping table, and determines the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address, and finally, determines the target cache position and target cache level corresponding to the target embedded entry based on the level type of the current cache level and the preset level division rule, and updates the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level. Due to the introduction of a mapping table that supports high performance and high concurrency, a hierarchical embedded table storage is constructed to realize the real-time update of hotspot embedded data between multi-level storage. Therefore, the problems of low real-time update efficiency and poor memory access performance of the embedded table are solved, and the real-time update of the embedded table can be efficiently realized, the memory access performance of the embedded table is improved, and the consumption of computing resources is reduced.

[0087] Optionally, the multi-layer embedded table updating device based on hash tables may also include: a global mapping table construction module, which is used to construct a first hash table to store the highest priority embedded entries, and generate a first mapping table corresponding to the video memory cache level before receiving the current request instruction sent by the current user based on the target application; construct a second hash table to store the intermediate priority embedded entries, and generate a second mapping table corresponding to the memory cache level; obtain a data storage list corresponding to the hard disk cache level as a third mapping table corresponding to the hard disk cache level; and combine and process the first mapping table, the second mapping table and the third mapping table to generate a global mapping table.

[0088] Optionally, the entry updating module 330 may specifically include: a first position determining unit and a second position determining unit;

[0089] The first position determination unit is used for obtaining the current access frequency corresponding to the target embedded entry and the current cache position of the target embedded entry in the current cache level if the level type of the current cache level is the video memory level, taking the current cache level as the target cache level, determining a candidate cache position having a position number smaller than the current cache position according to the current access frequency, and taking the candidate cache position as the target cache position;

[0090] The second position determination unit is used to, if the level type of the current cache level is non-graphics memory level, use a candidate cache level with a level number smaller than the current cache level as a target cache level, and use a head position of the target cache level as a target cache position.

[0091] Optionally, the multi-layer embedded table updating device based on hash table may further include: a downgrade processing module, which is used to obtain the current storage status of the target cache level before taking the candidate cache level with a level number smaller than the current cache level as the target cache level and taking the head position of the target cache level as the target cache position, and if the current storage status is a full storage state, downgrade the tail data of the target cache level.

[0092] Optionally, the multi-layer embedded table updating device based on a hash table may also include: a cache level determination module, which is used to match the target free address for the current access information after the base address corresponding to the current access information is determined based on the pre-stored global mapping table, if the base address corresponding to the current access information does not exist in the global mapping table; initialize the embedded entry corresponding to the target free address to obtain a random embedded entry; obtain the basic access frequency of the random embedded entry, and determine the target cache level corresponding to the random embedded entry based on the basic access frequency of the random embedded entry.

[0093] Optionally, the multi-layer embedded table updating device based on the hash table may also include: a counting module, which is used to return to process the target embedded entry after determining the target embedded entry corresponding to the current access information based on the base address, and add one to the current access frequency corresponding to the target embedded entry through the target access counter.

[0094] Optionally, the multi-layer embedding table updating device based on hash table may also include: a prediction module, used to obtain the space occupancy corresponding to the video memory cache level; if the space occupancy is a space surplus, a first access predictor corresponding to the hard disk cache level or a second access predictor corresponding to the memory cache level is used to determine the predicted embedding entry based on the historical access frequency of each embedding head, and the predicted embedding entry is updated to the video memory cache level.

[0095] The multi-layer embedded table updating device based on hash table provided in the embodiment of the present invention can execute the multi-layer embedded table updating method based on hash table provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0096] Embodiment 4

[0097] Figure 7A schematic diagram of the structure of an electronic device 410 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0098] like Figure 7 As shown, the electronic device 410 includes at least one processor 420, and a memory connected to the at least one processor 420 in communication, such as a read-only memory (ROM) 430, a random access memory (RAM) 440, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 420 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 430 or the computer program loaded from the storage unit 490 to the random access memory (RAM) 440. In the RAM 440, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 420, the ROM 430, and the RAM 440 are connected to each other through the bus 450. The input / output (I / O) interface 460 is also connected to the bus 450.

[0099] Multiple components in the electronic device 410 are connected to the I / O interface 460, including: an input unit 470, such as a keyboard, a mouse, etc.; an output unit 480, such as various types of displays, speakers, etc.; a storage unit 490, such as a disk, an optical disk, etc.; and a communication unit 4100, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 4100 allows the electronic device 410 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0100] The processor 420 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 420 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 420 performs the various methods and processes described above, such as a multi-layer embedding table update method based on a hash table.

[0101] The method includes:

[0102] Receiving a current request instruction sent by a current user based on a target application; wherein the current request instruction includes current access information;

[0103] Determine a base address corresponding to the current access information based on a pre-stored global mapping table, and determine a target embedded entry corresponding to the current access information and a current cache level corresponding to the target embedded entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level, or a video memory cache level;

[0104] Based on the level type of the current cache level and the preset level division rules, determine the target cache position and target cache level corresponding to the target embedded entry, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level.

[0105] In some embodiments, the multi-layer embedding table update method based on a hash table may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 490. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 410 via the ROM 430 and / or the communication unit 4100. When the computer program is loaded into the RAM 440 and executed by the processor 420, one or more steps of the multi-layer embedding table update method based on a hash table described above may be performed. Alternatively, in other embodiments, the processor 420 may be configured to perform the multi-layer embedding table update method based on a hash table in any other appropriate manner (e.g., by means of firmware).

[0106] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0107] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0108] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0109] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0110] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0111] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0112] The present application also discloses a computer program product, which includes a computer program. When the computer program is executed by a processor, the multi-layer embedded table update method based on a hash table provided in any embodiment of the present application is implemented. The program product and the multi-layer embedded table update method based on a hash table disclosed in each embodiment of the present application belong to the same inventive concept, so it will not be described here.

[0113] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0114] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A multi-layer embedded table updating method based on a hash table, characterized in that: The method is applied to a scenario where a very large embedded table is updated in real time, including: Receiving a current request instruction sent by a current user based on a target application; wherein the current request instruction includes current access information; Determine the base address corresponding to the current access information based on a pre-stored global mapping table, and determine the target embedding entry corresponding to the current access information and the current cache level corresponding to the target embedding entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level or a video memory cache level; wherein the embedding entry refers to each embedding vector entry in the embedding table, including a unique code and a corresponding embedding vector; Determine a target cache position and a target cache level corresponding to the target embedded entry based on the level type of the current cache level and a preset level division rule, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level; Before receiving the current request instruction sent by the current user based on the target application, the method further includes: Constructing a first hash table storing the highest priority embedded entries, and generating a first mapping table corresponding to a video memory cache hierarchy; wherein the video memory cache hierarchy includes a hardware acceleration unit supporting the hash table; Construct a second hash table storing intermediate priority embedded entries, and generate a second mapping table corresponding to the memory cache level; Obtain a data storage list corresponding to the hard disk cache level as a third mapping table corresponding to the hard disk cache level; The first mapping table, the second mapping table and the third mapping table are combined and processed to generate a global mapping table.

2. The method according to claim 1, characterized in that The determining, based on the level type of the current cache level and a preset level division rule, a target cache location and a target cache level corresponding to the target embedded entry includes: If the level type of the current cache level is a video memory level, obtaining a current access frequency corresponding to the target embedded entry and a current cache position of the target embedded entry in the current cache level, taking the current cache level as the target cache level, determining a candidate cache position whose position number is smaller than the current cache position according to the current access frequency, and taking the candidate cache position as the target cache position; If the level type of the current cache level is non-graphics memory level, the candidate cache level with a level number smaller than the current cache level is used as the target cache level, and the head position of the target cache level is used as the target cache position.

3. The method according to claim 2, characterized in that Before taking the candidate cache level whose level number is smaller than the current cache level as the target cache level and taking the head position of the target cache level as the target cache position, the method further includes: The current storage status of the target cache level is obtained, and if the current storage status is a full storage state, the tail data of the target cache level is downgraded.

4. The method according to claim 1, characterized in that: After determining the base address corresponding to the current access information based on the pre-stored global mapping table, the method further includes: If the base address corresponding to the current access information does not exist in the global mapping table, matching the target idle address for the current access information; Initialize and process the embedded entry corresponding to the target free address to obtain a random embedded entry; A basic access frequency of the random embedded entry is obtained, and based on the basic access frequency of the random embedded entry, a target cache level corresponding to the random embedded entry is determined.

5. The method according to claim 1, characterized in that After determining the target embedded entry corresponding to the current access information based on the base address, the method further includes: Return to process the target embedded entry, and add one to the current access frequency corresponding to the target embedded entry through the target access counter.

6. The method according to claim 1, characterized in that The method further comprises: Get the space usage of the video memory cache level; If the space occupancy is a space surplus, a predicted embedding entry is determined based on the historical access frequency of each embedded header through a first access predictor corresponding to the hard disk cache level or a second access predictor corresponding to the memory cache level, and the predicted embedding entry is updated to the video memory cache level.

7. A multi-layer embedded table updating device based on a hash table, characterized in that: The device is applied to a scenario where a super-large-scale embedded table is updated in real time, and includes: A data acquisition module, used to receive a current request instruction sent by a current user based on a target application; wherein the current request instruction includes current access information; A data mapping module, used to determine the base address corresponding to the current access information based on a pre-stored global mapping table, and determine the target embedded entry corresponding to the current access information and the current cache level corresponding to the target embedded entry based on the base address; wherein the current cache level includes a hard disk cache level, a memory cache level or a video memory cache level; wherein the embedded entry refers to each embedded vector entry in the embedding table, including a unique code and a corresponding embedded vector; An entry updating module, configured to determine a target cache position and a target cache level corresponding to the target embedded entry based on the level type of the current cache level and a preset level division rule, and update the target embedded entry from the current cache level to the target cache position in the target cache level according to the target cache position and the target cache level; Among them, the multi-layer embedded table updating device based on hash table also includes: a global mapping table construction module, which is used to construct a first hash table storing the highest priority embedded entries before receiving the current request instruction sent by the current user based on the target application, and generate a first mapping table corresponding to the video memory cache level; wherein the video memory cache level includes a hardware acceleration unit supporting hash tables; construct a second hash table storing intermediate priority embedded entries, and generate a second mapping table corresponding to the memory cache level; obtain a data storage list corresponding to the hard disk cache level as a third mapping table corresponding to the hard disk cache level; and combine and process the first mapping table, the second mapping table and the third mapping table to generate a global mapping table.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the multi-layer embedded table updating method based on a hash table according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-layer embedding table updating method based on a hash table according to any one of claims 1 to 6 when executed.

Citation Information

Patent Citations

  • Data access method and device, equipment and computer storage medium

    CN111125583A

  • Method, device and equipment for embedding parameter cache and storage medium

    CN114428797A

  • Cloud data caching method and device, equipment and storage medium

    CN114840140A

  • Statistical method, system and device for cache data access frequency, equipment and medium

    CN117632795A

  • Cloud data caching method and apparatus, device and storage medium

    WO2023185770A1