Cache updating method and device, electronic equipment and computer readable storage medium
By sampling the cache update method, the simulation of popularity changes is reduced, which solves the CPU resource consumption problem caused by the LRU algorithm, improves processing efficiency and reduces latency.
Patent Information
- Application Number
- CN202211066779.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-09-01
AI Technical Summary
The existing LRU algorithm needs to simulate changes in the popularity of requested content when updating the cache, which leads to excessive CPU resource consumption and affects processing efficiency.
By obtaining the first identifier table corresponding to the query request, sampling is performed to obtain the second identifier table, and the table is sent to the server cluster to update the local embedded parameter cache, reducing the simulation of popularity changes.
It reduces CPU overhead, improves processing efficiency, and lowers end-to-end latency.
Smart Images

Figure CN115495681B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a cache updating method and device, electronic equipment, computer readable storage medium and computer program product. BACKGROUND
[0002] With the development of computer technology, the scenarios of mass information transmission and storage are increasing. Since the cache can realize efficient searching and updating, it is widely used in the recommendation system.
[0003] In the related art, after receiving a user recommendation request, the recommendation system generally searches the requested content from the local cache first, searches the content from the remote server again for the content that cannot be found, and updates the local cache after the searching is completed. However, since the cache space is limited, it is necessary to decide how to delete the content in the cache when updating the cache. The current classic eviction algorithm such as the Least Recently Used (LRU) algorithm preferentially evicts the requested content that has not appeared recently.
[0004] However, since the LRU algorithm needs to simulate the popularity change of the requested content and needs to frequently perform write operations, the updating will occupy a large amount of CPU resources of the system, so that the number of requests that can be processed per unit time is reduced, thereby seriously affecting the processing efficiency. SUMMARY
[0005] The present disclosure provides a cache updating method, device, electronic equipment, computer readable storage medium and computer program product to at least solve the problem of low processing efficiency caused by updating the cache by the LRU algorithm in the related art. The technical solutions of the present disclosure are as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a cache updating method is provided, comprising:
[0007] obtaining a first identification table corresponding to a query request of an embedding parameter, the first identification table comprising at least one to-be-queried embedding parameter identification;
[0008] sampling the first identification table to obtain a sampled second identification table, the second identification table comprising at least one target embedding parameter identification sampled from the first identification table;
[0009] sending the second identification table to a server, the second identification table being used to instruct the server to query a target embedding parameter matching the target embedding parameter identification in the second identification table;
[0010] receiving the target embedding parameter returned by the server and matching the target embedding parameter identifier in the second identification table, and updating the embedding parameter cache according to the second identification table and the matching target embedding parameter.
[0011] In one of the embodiments, the sampling processing of the first identification table to obtain the sampled second identification table comprises: for each first identification table corresponding to the query request, extracting the embedding parameter identifier satisfying the first sampling strategy from the first identification table by using the preset first sampling strategy; taking the embedding parameter identifier satisfying the first sampling strategy as the target embedding parameter identifier, and generating the second identification table for sampling the first identification table according to the target embedding parameter identifier.
[0012] In one of the embodiments, the sampling processing of the first identification table to obtain the sampled second identification table comprises: when the query request satisfies the preset second sampling strategy, taking the embedding parameter identifier in the first identification table corresponding to the query request as the target embedding parameter identifier, and generating the second identification table according to the target embedding parameter identifier.
[0013] In one of the embodiments, the embedding parameter cache comprises a first embedding information table and a second embedding information table, each node of the first embedding information table is used to store the embedding parameter identifier and the corresponding embedding parameter, and the second embedding information table is used to record the corresponding relationship between the embedding parameter identifier and the node position, and the node position is used to represent the position of the embedding parameter identifier in the first embedding information table; the updating of the embedding parameter cache according to the second identification table and the matching target embedding parameter comprises: when the second embedding information table has the embedding parameter identifier matching the target embedding parameter identifier in the second identification table, determining the first target node position corresponding to the matching embedding parameter identifier, and updating the embedding parameter of the corresponding node in the first embedding information table according to the first target node position and the target embedding parameter corresponding to the target embedding parameter identifier.
[0014] In one of the embodiments, after the updating of the embedding parameter of the corresponding node in the first embedding information table, the method further comprises: adjusting the updated node in the first embedding information table to a second target node position, and the second target node position is located at the head or tail of the first embedding information table; and updating the second embedding information table according to the second target node position of the updated node.
[0015] In one of the embodiments, the method further comprises: when there is no embedding parameter identifier matching the target embedding parameter identifier in the second embedding information table, creating a new node in the first embedding information table, the new node being used to store the target embedding parameter identifier and the corresponding target embedding parameter; and updating the second embedding information table according to the new node.
[0016] In one of the embodiments, after the updating of the second embedding information table according to the new node, the method further comprises: obtaining the current storage amount of the first embedding information table; and when the storage amount reaches a storage threshold, deleting the nodes at target positions in the first embedding information table until the storage amount is less than the storage threshold, obtaining the first embedding information table after the deleted nodes.
[0017] In one of the embodiments, the method further comprises: updating the second embedding information table according to the deleted nodes in the first embedding information table.
[0018] In one of the embodiments, the embedding parameter cache comprises two third embedding information tables and a search pointer and an update pointer each pointing to one of the third embedding information tables, and the two third embedding information tables are each used to store embedding parameter identifiers and corresponding embedding parameters; and the updating of the embedding parameter cache according to the second identifier table and the matching target embedding parameter comprises: when there is an embedding parameter identifier matching the target embedding parameter identifier in the third embedding information table currently pointed to by the update pointer, updating the embedding parameter corresponding to the matching embedding parameter identifier in the third embedding information table currently pointed to by the update pointer according to the target embedding parameter corresponding to the target embedding parameter identifier.
[0019] In one of the embodiments, the method further comprises: when there is no embedding parameter identifier matching the target embedding parameter identifier in the third embedding information table currently pointed to by the update pointer, writing the target embedding parameter identifier and the corresponding target embedding parameter into the third embedding information table currently pointed to by the update pointer.
[0020] In one of the embodiments, after the writing into the third embedding information table currently pointed to by the update pointer, the method further comprises: obtaining the storage amount of the third embedding information table currently pointed to by the update pointer; and when the storage amount reaches a storage threshold, exchanging the third embedding information tables currently respectively pointed to by the update pointer and the search pointer, and performing emptying processing on the third embedding information table pointed to by the update pointer after the exchange.
[0021] In one of the embodiments, the method further comprises: when the stored amount does not reach a storage amount threshold, obtaining a switching time closest to a current time in the switching time record of the update pointer and the search pointer; when a time interval between the switching time and the current time reaches a set time threshold, switching a third embedded information table currently pointed to by the update pointer and the search pointer respectively, and performing emptying processing on the third embedded information table pointed to by the update pointer after the switching.
[0022] In one of the embodiments, the method further comprises: obtaining a third identification table, the third identification table comprising at least one to-be-searched embedded parameter identification remaining in the first identification table after sampling the second identification table; when there is a target embedded parameter identification matching the to-be-searched embedded parameter identification in the third identification table in the embedded parameter cache, obtaining a first embedded parameter corresponding to the target embedded parameter identification from the embedded parameter cache; when there is no target embedded parameter identification matching the to-be-searched embedded parameter identification in the third identification table in the embedded parameter cache, sending the to-be-searched embedded parameter identification in the third identification table to the server; receiving a second embedded parameter corresponding to the to-be-searched embedded parameter identification in the third identification table returned by the server; and obtaining a search result of the search request according to the first embedded parameter, the second embedded parameter, and a target embedded parameter matching the target embedded parameter identification in the second identification table.
[0023] According to a second aspect of the embodiments of the present disclosure, a cache updating apparatus is provided, comprising:
[0024] The request obtaining module is configured to perform obtaining a first identification table corresponding to a search request of an embedded parameter, the first identification table comprising at least one to-be-searched embedded parameter identification;
[0025] The sampling module is configured to perform sampling processing on the first identification table to obtain a sampled second identification table, the second identification table comprising at least one target embedded parameter identification sampled from the first identification table;
[0026] The sending module is configured to perform sending the second identification table to a server, the second identification table being used to instruct the server to search a target embedded parameter matching the target embedded parameter identification in the second identification table;
[0027] The cache updating module is configured to perform receiving a target embedded parameter matching the target embedded parameter identification in the second identification table returned by the server, and updating an embedded parameter cache according to the second identification table and the matching target embedded parameter.
[0028] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the cache updating method according to the first aspect.
[0029] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, when instructions in the computer readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the cache updating method according to the first aspect.
[0030] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, the computer program product comprises instructions, when the instructions are executed by a processor of an electronic device, the electronic device is enabled to perform the cache updating method according to the first aspect.
[0031] The embodiments of the present disclosure provide at least the following beneficial effects: by obtaining a first identification table corresponding to the query request with the embedded parameter, performing sampling processing on the first identification table to obtain a second identification table, and sending the second identification table to the server cluster, and then receiving the target embedded parameter returned by the server cluster which matches the target embedded parameter identification in the second identification table, and updating the local embedded parameter cache according to the second identification table and the matched target embedded parameter. Compared with the traditional LRU update, the cache is updated by sampling, and since the popularity change of the request content does not need to be simulated, the CPU overhead can be reduced during updating, and the processing efficiency can be improved.
[0032] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0033] The accompanying drawings, which are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification serve to explain the principles of the present disclosure, and do not constitute an improper limitation on the present disclosure.
[0034] Figure 1 is an application environment diagram of a cache updating method according to an exemplary embodiment.
[0035] Figure 2 is a flowchart of a cache updating method according to an exemplary embodiment.
[0036] Figure 3 is a schematic diagram of a sampling step according to an exemplary embodiment.
[0037] Figure 4 is a schematic diagram of a cache updating step according to an exemplary embodiment.
[0038] Figure 5 is a schematic diagram of a cache update procedure according to an example embodiment.
[0039] Figure 6 is a schematic diagram of a cache update procedure according to an example embodiment.
[0040] Figure 7 is a schematic diagram of a cache update procedure according to an example embodiment.
[0041] Figure 8 is a schematic diagram of a cache update procedure according to an example embodiment.
[0042] Figure 9 is a schematic diagram of a cache update procedure according to an example embodiment.
[0043] Figure 10 is a schematic diagram of a cache update procedure according to an example embodiment.
[0044] Figure 11 is a schematic diagram of a query procedure according to an example embodiment.
[0045] Figure 12 is a schematic diagram of a query scenario according to an example embodiment.
[0046] Figure 13 is a block diagram of a cache update apparatus according to an example embodiment.
[0047] Figure 14 is a block diagram of an electronic device according to an example embodiment. DETAILED DESCRIPTION
[0048] In order for those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings.
[0049] It should be noted that the terms "first", "second", and the like in the specification and claims of the present disclosure and the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation described in the following example embodiments does not represent all implementations consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0050] It should be further noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties.
[0051] As the recommendation system can recommend the content of interest to different users. Generally, to achieve this goal, the recommendation system uses a large number of sparse features to characterize user interest and content characteristics. Each sparse feature corresponds to a binary group <Key, Value>, wherein Key represents the signature of the sparse feature, usually an integer, and Value represents the embedding vector (Embedding) corresponding to the feature, usually a dense vector, which is obtained by training. The number of sparse features in an industrial-level recommendation system can reach hundreds of billions, and the corresponding embedding vector needs TB-level storage. And in order to support real-time query, it can only be stored through memory RAM (random-access memory). These factors lead to the inability to use a single server to store embedding vectors, so industrial-level recommendation systems use a special cluster to provide storage and query services for embedding vectors (referred to as Embedding services). After receiving a user recommendation request, the recommendation system extracts the Key corresponding to the sparse feature from the request, then requests the service, obtains the corresponding embedding vector, and calculates the recommendation list according to the embedding vector. And finding and transmitting Embedding from the Embedding service needs to occupy a large amount of network bandwidth. At the same time, since each recommendation request needs to request the Embedding service, the Embedding service itself also needs to occupy a large amount of machine resources.
[0052] Moreover, through the analysis of online service data, it is found that there is an obvious uneven phenomenon in the sparse features, some features will appear in many requests, while some other features will only appear in a few requests. And by caching the Embedding corresponding to the hot sparse features, the number of keys that need to be found from the Embedding service can be greatly reduced, and the machine resources required by the Embedding service and the network bandwidth resources occupied by the transmission of Embedding can be reduced.
[0053] However, since the LRU algorithm is used directly at present, the popularity change of the request content needs to be simulated, which causes a large amount of CPU resources to be occupied during updating and searching, and further causes the number of requests that can be processed per unit time to decrease, and the delay of finding the embedding vector from the cache is high, which will greatly increase the end-to-end delay of processing requests, thereby seriously affecting the processing efficiency.
[0054] Based on this, the present disclosure provides a cache updating method, which can be applied to, for example Figure 1The application environment shown. Among them, the recommendation system server 102 communicates with the server 104 through the network. The data storage system can store the data required by the recommendation system server 102 to process. The data storage system can be integrated on the recommendation system server 102, or placed on the cloud or other network servers. Among them, the recommendation system server 102 can be various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices that can provide recommendation services. The server 104 can be implemented by a server cluster composed of multiple servers.
[0055] Specifically, the recommendation system server 102 can be a server that provides recommendation services, wherein the recommendation services include but are not limited to shopping recommendation services, live broadcast recommendation services, short video recommendation services, etc. In this embodiment, these recommendation services can all recommend content of interest to different users, and sparse features can characterize user interests and content characteristics. Each sparse feature can correspond to a binary tuple<Key, Value>, wherein Key represents the signature of the sparse feature, that is, the identification of the sparse feature, and Value represents the embedding vector corresponding to this feature, that is, the embedding parameter, and Key can also represent the identification of the embedding parameter.
[0056] In this embodiment, when the recommendation system server obtains a query request for the embedding parameter, the query request can be sampled to obtain a sampled second identification, and the server cluster is sent the second identification table, and then the target embedding parameter corresponding to the second identification table returned by the server cluster is received, so as to update the cache according to the second identification table and the corresponding target embedding parameter. By updating the cache in this way, compared with the traditional LRU update method, since it is not necessary to simulate the popularity change of the request content, the CPU overhead can be reduced when updating, and the processing efficiency can be improved.
[0057] In one embodiment, as Figure 2 shown, a cache updating method is provided, and this embodiment takes the method applied to the recommendation system server as an example. In this embodiment, the method can include the following steps:
[0058] In step S210, a first identification table corresponding to a query request for an embedding parameter is obtained.
[0059] The query request can be a query instruction or a query command for querying the embedding parameter. The first identification table includes at least one to-be-queried embedding parameter identification, and therefore, the first identification table corresponds to the query request of the embedding parameter. In this embodiment, the embedding parameter identification can be an identification corresponding to the embedding parameter that needs to be queried (i.e., a Key corresponding to a sparse feature), and each embedding parameter identification has a corresponding embedding parameter (i.e., an embedding vector Value of a sparse feature) in the embedding table.
[0060] Specifically, the query request can be obtained by the recommendation system server from a received user recommendation request, and the first identification table can be directly carried in the user recommendation request. In one scenario, the first identification table can also be calculated by the recommendation system server according to the user recommendation request. In this embodiment, when the recommendation system server receives the user recommendation request, the Key corresponding to the sparse feature can be extracted, and the query request of the embedding parameter can be generated.
[0061] In step S220, the first identification table is sampled to obtain a sampled second identification table.
[0062] The second identification table includes at least one target embedding parameter identification sampled from the first identification table. In this embodiment, sampling can be performed based on each first identification table, that is, part of the embedding parameter identifications in the first identification table corresponding to each query request can be sampled as the second identification table. Alternatively, sampling can also be performed based on a request granularity, that is, part of the first identification tables corresponding to the query requests can be sampled from the first identification tables corresponding to the plurality of query requests, and the first identification table corresponding to the query request sampled can be taken as the second identification table. In this embodiment, the recommendation system server can obtain the second identification table by sampling the query request.
[0063] In step S230, the second identification table is sent to the server.
[0064] The second identification table is used to instruct the server to query a target embedding parameter matching a target embedding parameter identification in the second identification table. Specifically, the target embedding parameter identification is an embedding parameter identification sampled from the first identification table. The target embedding parameter is an embedding parameter corresponding to the target embedding parameter identification. The server refers to a server cluster.
[0065] In this embodiment, the recommendation system server sends the second identification table to the server cluster, so that the server cluster can query the target embedding parameter matching the target embedding parameter identification in the second identification table.
[0066] In step S240, the receiving server returns the target embedding parameter matching the target embedding parameter identifier in the second identifier table, and the embedding parameter cache is updated according to the second identifier table and the matching target embedding parameter.
[0067] The embedding parameter cache can be an embedding table locally cached by the recommendation system server, which includes the correspondence between the embedding parameter identifier and the embedding parameter. In this embodiment, the recommendation system server can receive the target embedding parameter returned by the server cluster and matching the target embedding parameter identifier in the second identifier table, and then update the local embedding parameter cache according to the second identifier table and the matching target embedding parameter.
[0068] In the above cache updating method, the recommendation system server obtains the first identifier table corresponding to the query request of the embedding parameter, performs sampling processing on the first identifier table to obtain the sampled second identifier table, sends the second identifier table to the server cluster, and then receives the target embedding parameter returned by the server cluster and matching the target embedding parameter identifier in the second identifier table, and updates the local embedding parameter cache according to the second identifier table and the matching target embedding parameter. By updating the embedding parameter cache through sampling, compared with the traditional LRU update, since the popularity change of the request content does not need to be simulated, the CPU overhead can be reduced during updating, and the processing efficiency can be improved.
[0069] In an exemplary embodiment, as shown in FIG. 2, in step S220, the first identifier table is sampled to obtain a sampled second identifier table, which can be implemented by the following steps: Figure 3
[0070] In step S222, for each first identifier table corresponding to a query request, a preset first sampling strategy is used to extract the embedding parameter identifier satisfying the first sampling strategy from the first identifier table.
[0071] The sampling strategy includes but is not limited to the corresponding sampling ratio and sampling method. Specifically, the sampling method includes but is not limited to random sampling, stratified sampling, whole sampling, systematic sampling, etc. The sampling ratio can be configured according to the actual scene. In this embodiment, the strategy of sampling the embedding parameter identifier in the first identifier table corresponding to the query request is defined as the first sampling strategy.
[0072] In the embodiment, the recommendation system server can adopt a preset first sampling strategy to extract the embedding parameter identifiers satisfying the first sampling strategy from the first identifier table corresponding to each query request. For example, if the sampling method corresponding to the first sampling strategy is random sampling and the sampling ratio is 5%, the recommendation system server can randomly extract 5% of the embedding parameter identifiers from the first identifier table corresponding to each query request, and the 5% of the embedding parameter identifiers randomly extracted are the embedding parameter identifiers satisfying the first sampling strategy.
[0073] In step S224, the embedding parameter identifiers satisfying the first sampling strategy are taken as target embedding parameter identifiers, and a second identifier table for sampling the first identifier table is generated according to the target embedding parameter identifiers.
[0074] Specifically, the recommendation system server takes the embedding parameter identifiers satisfying the first sampling strategy obtained by sampling as target embedding parameter identifiers, and generates a second identifier table for sampling the first identifier table according to the target embedding parameter identifiers. That is, the second identifier table stores at least one target embedding parameter identifier obtained by sampling.
[0075] In the above embodiment, the recommendation system server can adopt a preset first sampling strategy to extract the embedding parameter identifiers satisfying the first sampling strategy from the first identifier table corresponding to each query request, and take the embedding parameter identifiers satisfying the first sampling strategy as target embedding parameter identifiers, so as to generate a second identifier table for sampling the first identifier table according to the target embedding parameter identifiers. By sampling the embedding parameter identifiers in the first identifier table corresponding to each query request, the second identifier table obtained by sampling is obtained, and the cache is updated based on the second identifier table obtained by sampling. Compared with the traditional LRU update, the CPU overhead can be reduced and the processing efficiency can be improved.
[0076] In an exemplary embodiment, in step S220, the first identifier table is sampled to obtain a second identifier table obtained by sampling, and the following steps can also be implemented: when the query request satisfies a preset second sampling strategy, the embedding parameter identifiers in the first identifier table corresponding to the query request are taken as target embedding parameter identifiers, and a second identifier table is generated according to the target embedding parameter identifiers.
[0077] The second sampling strategy is a sampling strategy for sampling the query request based on the request granularity. In the embodiment, in order to distinguish the sampling strategies of different sampling granularities, the sampling strategy based on the embedding parameter identifier granularity is defined as the first sampling strategy, and the sampling strategy based on the request granularity is defined as the second sampling strategy.
[0078] For example, if the sampling method corresponding to the second sampling strategy is system sampling with a sampling ratio of 10%, then for each query request received by the recommendation system server, it determines whether the query request satisfies the corresponding second sampling strategy. When the query request satisfies the corresponding second sampling strategy, the embedding parameter identifier in the first identifier table corresponding to the query request is used as the target embedding parameter identifier, that is, the first identifier table corresponding to the query request is used as the sampled second identifier table. This embodiment samples query requests at the request granularity to obtain the sampled second identifier table, and then updates the cache based on the sampled second identifier table. Since sampling and updating are not required for every request, the cache update frequency is reduced, which can effectively reduce the CPU overhead of the recommendation system server in updating the cache.
[0079] In an exemplary embodiment, the embedding parameter cache may include a first embedding information table and a second embedding information table, wherein the first embedding information table may be a linked list, and the second embedding information table may be a MAP lookup table. Specifically, each node in the first embedding information table is used to store an embedding parameter identifier and its corresponding embedding parameter. The second embedding information table is used to record the correspondence between embedding parameter identifiers and node positions, wherein the node position is used to characterize the specific node position of the corresponding embedding parameter identifier in the first embedding information table. For example, if the Xth node in the first embedding information table stores an embedding parameter identifier A and its corresponding embedding parameter a, then the second embedding information table contains a record of the correspondence between embedding parameter identifier A and the Xth node.
[0080] like Figure 4 As shown, in step S240, the embedding parameter cache is updated according to the second identifier table and the matching target embedding parameters. This can be achieved through the following steps:
[0081] In step S410, when there is an embedding parameter identifier in the second embedding information table that matches the target embedding parameter identifier in the second identifier table, the position of the first target node corresponding to the matching embedding parameter identifier is determined.
[0082] The first target node position refers to the node position corresponding to the matching embedding parameter identifier in the second embedding information table.
[0083] Specifically, since the second identification table and the corresponding target embedding parameter are sampled to update the content of the embedding parameter cache, and the second embedding information table of the embedding parameter cache records the correspondence between the embedding parameter identifier and the node position. Therefore, when the recommendation system server updates the embedding parameter cache, it first checks whether there is an embedding parameter identifier in the second embedding information table of the embedding parameter cache that matches the target embedding parameter identifier in the second identification table. The match can be the same, that is, whether there is the same embedding parameter identifier in the second embedding information table as in the second identification table. When there is the same embedding parameter identifier in the second embedding information table as in the second identification table, it means that the corresponding parameter record already exists in the embedding parameter cache. Therefore, the first target node position corresponding to the matching embedding parameter identifier is further determined from the second embedding information table.
[0084] In step S420, the embedding parameter of the corresponding node in the first embedding information table is updated based on the target embedding parameter corresponding to the target embedding parameter identifier according to the first target node position.
[0085] Since each node in the first embedding information table is used to store the embedding parameter identifier and the corresponding embedding parameter, after the recommendation system server determines the first target node position corresponding to the matching embedding parameter identifier, it can also update the content of the corresponding node position in the first embedding information table according to the first target node position. Specifically, the embedding parameter corresponding to the node position is updated to the target embedding parameter corresponding to the matching embedding parameter identifier, thereby updating the embedding parameter cache.
[0086] In the above embodiment, when it is determined that there is an embedding parameter identifier in the second embedding information table that matches the target embedding parameter identifier in the second identification table, the first target node position corresponding to the matching embedding parameter identifier is determined, and the embedding parameter of the corresponding node in the first embedding information table is updated based on the target embedding parameter corresponding to the target embedding parameter identifier according to the first target node position, thereby updating part of the existing content in the embedding parameter cache. Since the update logic is relatively simple compared to LRU, the update efficiency can be improved. Since this method does not modify the linked list and MAP table during lookup, it can also reduce the CPU overhead caused by the lookup process.
[0087] In an exemplary embodiment, as shown in FIG. 4, after the embedding parameter of the corresponding node in the first embedding information table is updated in step S420, the method can further include: Figure 5
[0088] In step S510, the updated node in the first embedding information table is adjusted to the second target node position.
[0089] The second target node position can be a predefined relative position of the updated node in the linked list. Specifically, the second target node position can be located at the head of the first embedded information table or at the tail of the first embedded information table.
[0090] In this embodiment, to avoid mistakenly deleting the latest updated data when the cache reaches storage saturation and data deletion occurs, after updating the first embedding information table of the embedding parameter cache, the corresponding updated node is moved to the head or tail of the linked list, and data deletion is performed in the reverse direction of the linked list. For example, if the updated node is moved to the head of the linked list, data deletion starts from the tail of the linked list; if the updated node is moved to the tail of the linked list, data deletion starts from the head of the linked list.
[0091] In step S520, the second embedded information table is updated according to the updated second target node position of the node.
[0092] Furthermore, since the second embedding information table records the correspondence between embedding parameter identifiers and node positions, when a node position in the first embedding information table changes, the recommendation system server can automatically update the second embedding information table in the embedding parameter cache based on the corresponding change. That is, it automatically updates the correspondence between embedding parameter identifiers and node positions recorded in the second embedding information table, thereby achieving synchronization with the data in the first embedding information table and ensuring the correctness of the data in the embedding parameter cache.
[0093] In one exemplary embodiment, such as Figure 6 As shown, in step S240, the embedding parameter cache is updated according to the second identifier table and the corresponding target embedding parameters. This can be further implemented through the following steps:
[0094] In step S610, when there is no embedding parameter identifier in the second embedding information table that matches the target embedding parameter identifier in the second identifier table, a new node is created in the first embedding information table.
[0095] Specifically, when updating the embedded parameter cache, the recommendation system server first checks if there is an embedded parameter identifier in the second embedded information table of the embedded parameter cache that matches the target embedded parameter identifier in the second identifier table. A match can be an identical identifier; that is, it checks if there is an identical embedded parameter identifier in the second embedded information table of the embedded parameter cache. If there is no identical embedded parameter identifier in the second embedded information table, it means that there is no corresponding parameter record in the embedded parameter cache. Therefore, the recommendation system server can create a new node in the first embedded information table. This new node is used to store the target embedded parameter identifier and the corresponding target embedded parameter to update the embedded parameter cache.
[0096] In step S620, the second embedding information table is updated according to the newly created node.
[0097] Since the second embedding information table is used to record the correspondence between the embedding parameter identifier and the node position, when the newly created node for storing the target embedding parameter identifier and the corresponding target embedding parameter is added in the first embedding information table, the recommendation system server can also update the second embedding information table according to the newly created node. That is, the correspondence between the newly created node and the target embedding parameter identifier is added in the second embedding information table, so as to realize the synchronization of the data in the first embedding information table and ensure the correctness of the data in the embedding parameter cache.
[0098] In an exemplary embodiment, as shown in FIG. 6, after the second embedding information table is updated according to the newly created node in step S620, the above method can further include: Figure 7
[0099] In step S710, the current storage amount of the first embedding information table is obtained.
[0100] The storage amount can be the space capacity of the embedding parameter cache currently occupied by the first embedding information table, or the number of nodes currently stored by the first embedding information table.
[0101] In this embodiment, after the recommendation system server updates the second embedding information table according to the newly created node, the current storage amount of the first embedding information table can also be obtained for subsequent processing, so as to avoid buffer overflow.
[0102] In step S720, when the storage amount reaches the storage threshold, the node at the target position in the first embedding information table is deleted.
[0103] The target position can be a position opposite to the above-mentioned second target node position. Specifically, when the second target node position is a position at the head of the first embedding information table, the target position is a position at the tail of the first embedding information table. When the second target node position is a position at the tail of the first embedding information table, the target position is a position at the head of the first embedding information table.
[0104] The storage threshold can be the upper limit of the storage amount of the first embedding information table based on the maximum storage amount of the embedding parameter cache. Specifically, the storage threshold can be a corresponding space capacity threshold, or a corresponding node number threshold, i.e., an embedding parameter identifier number threshold.
[0105] In this embodiment, when the current stored amount of the first embedded information table obtained by the recommendation system server reaches the storage threshold, the node at the target position in the first embedded information table is deleted until the stored amount is less than the storage threshold, thus obtaining the first embedded information table after the deletion of the node, thereby avoiding cache overflow. For example, if the target position is located at the end of the first embedded information table, then when the current stored amount of the first embedded information table reaches the storage threshold, the node at the end of the first embedded information table is deleted until the stored amount of the first embedded information table is less than the storage threshold, thus obtaining the updated first embedded information table.
[0106] In an exemplary embodiment, since the second embedding information table is used to record the correspondence between embedding parameter identifiers and node positions, the second embedding information table is updated synchronously when the data in the first embedding information table changes. Specifically, the recommendation system server can delete the corresponding node correspondence in the second embedding information table based on the nodes that have been deleted from the first embedding information table, thereby updating the second embedding information table and synchronizing it with the data in the first embedding information table to ensure the correctness of the data in the embedding parameter cache.
[0107] In an exemplary embodiment, the embedding parameter cache may further include two third embedding information tables, and a lookup pointer and an update pointer, each pointing to one of the third embedding information tables. Both third embedding information tables are used to store embedding parameter identifiers and corresponding embedding parameters. For example, the embedding parameter cache may include third embedding information tables T1 and T2, where the lookup pointer can point to one of the third embedding information tables, and the update pointer can point to the other. Specifically, when the lookup pointer points to T1, the update pointer points to T2. In this case, if a lookup request is received, a lookup is performed in T1; if an update request is received, T2 is updated. Conversely, when the lookup pointer points to T2, the update pointer points to T1. In this case, if a lookup request is received, a lookup is performed in T2; if an update request is received, T1 is updated.
[0108] Then as Figure 8 As shown, in step S240, the embedding parameter cache is updated according to the second identifier table and the matching target embedding parameters. This can be achieved through the following steps:
[0109] In step S810, when there is an embedding parameter identifier in the third embedding information table that the update pointer currently points to that table that matches the target embedding parameter identifier in the second identifier table, the first update is performed.
[0110] The first updating is a process of updating the embedding parameter corresponding to the matching embedding parameter identifier in the third embedding information table currently pointed by the updating pointer according to the target embedding parameter identifier.
[0111] Specifically, since the second identification table and the corresponding target embedding parameter are the contents that need to update the embedding parameter cache, and the third embedding information table currently pointed by the updating pointer is the table currently used for updating in the embedding parameter cache. Therefore, when updating the cache, the recommendation system server first searches the third embedding information table currently pointed by the updating pointer in the embedding parameter cache to determine whether there is an embedding parameter identifier matching the target embedding parameter identifier in the second identification table. The matching can be the same, that is, whether there is the same embedding parameter identifier in the third embedding information table currently pointed by the updating pointer in the embedding parameter cache. When there is the same embedding parameter identifier in the third embedding information table currently pointed by the updating pointer, it indicates that there is a corresponding parameter record in the embedding parameter cache. Therefore, the parameter record can be directly updated. For example, the embedding parameter corresponding to the matching embedding parameter identifier in the third embedding information table currently pointed by the updating pointer is updated according to the target embedding parameter corresponding to the matching embedding parameter identifier, so as to update the embedding parameter cache.
[0112] In step S820, when there is no embedding parameter identifier matching the target embedding parameter identifier in the second identification table in the third embedding information table currently pointed by the updating pointer, the second updating is performed.
[0113] The second updating is a process of writing the target embedding parameter identifier and the corresponding target embedding parameter into the third embedding information table currently pointed by the updating pointer.
[0114] Specifically, when updating the embedding parameter cache, the recommendation system server first searches the third embedding information table currently pointed by the updating pointer in the embedding parameter cache to determine whether there is an embedding parameter identifier matching the target embedding parameter identifier in the second identification table. The matching can be the same, that is, whether there is the same embedding parameter identifier in the third embedding information table currently pointed by the updating pointer in the embedding parameter cache. When there is no same embedding parameter identifier in the third embedding information table currently pointed by the updating pointer, it indicates that there is no corresponding parameter record in the embedding parameter cache. Therefore, the recommendation system server writes the target embedding parameter identifier and the corresponding target embedding parameter into the third embedding information table currently pointed by the updating pointer, so as to update the embedding parameter cache.
[0115] In the above embodiments, when the third embedding information table currently pointed to by the update pointer has an embedding parameter identifier matching the target embedding parameter identifier in the second identifier table, the first update is performed, and when the third embedding information table currently pointed to by the update pointer does not have an embedding parameter identifier matching the target embedding parameter identifier in the second identifier table, the second update is performed, so that the embedding parameter cache is updated. Since the update logic is simpler than LRU, the update efficiency can be improved.
[0116] In an example embodiment, as shown in FIG. 8B, after the second update is performed in step S820, i.e., after the third embedding information table currently pointed to by the update pointer is written, the method can further include: Figure 9
[0117] In step S910, the stored amount of the third embedding information table currently pointed to by the update pointer is obtained.
[0118] Similarly, the stored amount can be the space capacity of the cache occupied by the third embedding information table currently pointed to by the update pointer, or the number of embedding parameter identifiers currently stored in the third embedding information table.
[0119] In this embodiment, after the second update is performed by the recommendation system server, i.e., after the third embedding information table currently pointed to by the update pointer is written, the current stored amount of the third embedding information table can also be obtained for subsequent processing, so as to avoid cache overflow.
[0120] In step S920, when the stored amount reaches the storage amount threshold, the third embedding information tables currently pointed to by the update pointer and the search pointer are exchanged, and the third embedding information table pointed to by the updated update pointer is emptied.
[0121] The storage amount threshold can be the upper limit of the storage amount of the third embedding information table pointed to by the update pointer based on the maximum storage amount of the cache. Specifically, the storage amount threshold can be a corresponding space capacity threshold, or a corresponding number threshold of stored embedding parameter identifiers.
[0122] In the embodiment, when the stored amount of the third embedding information table pointed to by the update pointer reaches the storage amount threshold, the third embedding information table currently pointed to by the update pointer and the third embedding information table currently pointed to by the search pointer can also be exchanged. For example, when the third embedding information table currently pointed to by the update pointer is T1, the third embedding information table currently pointed to by the search pointer is T2, and it is determined that the stored amount of T1 reaches the storage amount threshold at a certain time, the update pointer is adjusted to point to T2, and the search pointer is adjusted to point to T1, that is, the third embedding information table currently pointed to by the update pointer and the third embedding information table currently pointed to by the search pointer are exchanged. Meanwhile, the third embedding information table pointed to by the update pointer after the exchange is emptied, for example, if the third embedding information table pointed to by the update pointer after the exchange is T2, T2 is emptied, so that there is enough cache space for the next update of the embedding parameter cache.
[0123] In an example embodiment, as shown in Figure 10 the above method can further include:
[0124] In step S1010, when the stored amount does not reach the storage amount threshold, the exchange time closest to the current time in the exchange time record of the update pointer and the search pointer is obtained.
[0125] The exchange time record can be specific exchange time information recorded based on the exchange between the update pointer and the search pointer. Specifically, the exchange time record can be obtained based on the corresponding log. In the computer field, each operation event of the system is usually recorded in the log. The exchange time closest to the current time can be the exchange time of the last exchange of the update pointer and the search pointer in the log.
[0126] Therefore, in the embodiment, when the stored amount of the third embedding information table pointed to by the update pointer does not reach the storage amount threshold, the recommendation system server can also obtain the exchange time closest to the current time based on the exchange time record of the update pointer and the search pointer.
[0127] In step S1020, when the time interval between the exchange time and the current time reaches the set time threshold, the third embedding information table currently pointed to by the update pointer and the third embedding information table currently pointed to by the search pointer are exchanged, and the third embedding information table pointed to by the update pointer after the exchange is emptied.
[0128] The time threshold refers to the maximum time interval for the exchange between the update pointer and the search pointer, indicating that the next exchange needs to be performed at most after the time threshold after the last exchange.
[0129] Specifically, when the recommendation system server obtains the exchange time in the exchange time record of the update pointer and the lookup pointer closest to the current time, it is further determined whether the time interval between the exchange time and the current time reaches the set time threshold. If so, the third embedding information table currently pointed to by the update pointer and the lookup pointer is exchanged, and the third embedding information table pointed to by the update pointer after the exchange is emptied, thereby ensuring that there is enough cache space when updating the cache next time.
[0130] In an exemplary embodiment, as shown in Figure 11 The cache updating method of the present disclosure can further include the following steps:
[0131] In step S1110, the third identification table is obtained.
[0132] The third identification table includes at least one to-be-queried embedding parameter identifier remaining after the second identification table is sampled from the first identification table.
[0133] Specifically, as shown in Figure 12 The recommendation system server obtains a query request for the embedding parameter, which carries the first identification table L1 including at least one to-be-queried embedding parameter identifier. The recommendation system server first performs sampling processing on the query request to obtain the sampled second identification table L2. The second identification table L2 is used to update the embedding parameter cache, so it will not be queried in the embedding parameter cache, but will be queried through the server cluster, i.e., the second identification table L2 is sent to the server cluster, the server cluster queries the latest data, and the cache is updated based on the target embedding parameter corresponding to the second identification table L2 returned by the server cluster by the method as shown in Figure 2
[0134] After the recommendation system server samples the second identification table L2 from the first identification table L1, the remaining to-be-queried embedding parameter identifier constitutes the third identification table L3. In this embodiment, the third identification table L3 is used for querying in the cache.
[0135] In step S1120, when the embedding parameter cache contains a target embedding parameter identifier matching the to-be-queried embedding parameter identifier in the third identification table, the first embedding parameter corresponding to the target embedding parameter identifier is obtained from the embedding parameter cache.
[0136] Since the embedding parameter cache is the embedding table including the correspondence between the embedding parameter identifier and the embedding parameter locally cached by the recommendation system server, querying in the embedding parameter cache can improve the query efficiency.
[0137] In this embodiment, the recommendation system server queries the embedding parameter corresponding to the third identification table L3 in the embedding parameter cache. When there is a target embedding parameter identifier matching the embedding parameter identifier to be queried in the third identification table L3 in the embedding parameter cache, the recommendation system server obtains the first embedding parameter corresponding to the target embedding parameter identifier from the embedding parameter cache, that is, obtains the embedding parameter corresponding to the hit embedding parameter identifier from the embedding parameter cache. As shown in Figure 12
[0138] In step S1130, when there is no target embedding parameter identifier matching the embedding parameter identifier to be queried in the third identification table in the embedding parameter cache, the embedding parameter identifier to be queried in the third identification table is sent to the server.
[0139] Specifically, the recommendation system server can filter out the above-mentioned L3_0 hit from the third identification table L3 in the third identification table cache, thereby obtaining the remaining embedding parameter identifier to be queried, and defining it as L3_1. That is, the embedding parameter identifier corresponding to L3_1 is the embedding parameter identifier to be queried in the third identification table L3 that is not hit in the third identification table cache. Therefore, the embedding parameter corresponding to L3_1 can be continuously queried in the server cluster. In this embodiment, the recommendation system server sends the embedding parameter identifier L3_1 to be queried in the third identification table to the server cluster, so that the server cluster can query accordingly.
[0140] In step S1140, the second embedding parameter corresponding to the embedding parameter identifier to be queried in the third identification table returned by the server is received.
[0141] Specifically, the recommendation system server sends L3_1 to the server cluster, so that the server cluster can query accordingly, and then the server cluster returns the second embedding parameter corresponding to L3_1 queried, and the recommendation system server receives the second embedding parameter corresponding to L3_1 returned by the server cluster.
[0142] In step S1150, the query result of the query request is obtained according to the first embedding parameter, the second embedding parameter, and the target embedding parameter matching the target embedding parameter identifier in the second identification table.
[0143] Since the second identification table L2 is sampled from the first identification table L1 corresponding to the query request, and the target embedding parameter is queried from the server cluster matching the second identification table L2, the first embedding parameter is the third identification table L3 composed of the remaining embedding parameter identifiers after sampling, and the embedding parameter corresponding to the hit L3_0 is queried in the embedding parameter cache; the second embedding parameter is the third identification table L3 composed of the remaining embedding parameter identifiers after sampling, and the embedding parameter corresponding to the non-hit L3_1 is queried in the embedding parameter cache. Therefore, the recommendation system server obtains the query result of the query request by merging the first embedding parameter, the second embedding parameter, and the target embedding parameter matching the second identification table, that is, obtaining the embedding parameter corresponding to the first identification table L1.
[0144] In the above embodiment, the recommendation system server obtains the third identification table, when the target embedding parameter identifier matching the embedding parameter identifier to be queried in the third identification table exists in the embedding parameter cache, obtains the first embedding parameter corresponding to the target embedding parameter identifier from the embedding parameter cache, when the target embedding parameter identifier matching the embedding parameter identifier to be queried in the third identification table does not exist in the embedding parameter cache, sends the embedding parameter identifier to be queried in the third identification table to the server cluster, and receives the second embedding parameter corresponding to the embedding parameter identifier to be queried in the third identification table returned by the server cluster, so as to obtain the query result of the query request according to the first embedding parameter, the second embedding parameter, and the target embedding parameter corresponding to the second identification table. Since this embodiment only performs read operation on the content in the embedding parameter cache when querying, and does not update the content in the embedding parameter cache system, not only the delay of finding the embedding parameter from the embedding parameter cache can be reduced, but also the CPU overhead of the embedding parameter cache can be reduced, thereby improving the query efficiency.
[0145] It should be understood that, although Figures 1-12 the steps in the flowchart of the method are shown in sequence according to the arrows, these steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, Figures 1-12 at least part of the steps in the method can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0146] It can be understood that the same / similar parts between each embodiment of the above method in the specification can be referred to each other, and each embodiment focuses on the difference from other embodiments, and the related part can be referred to the description of other method embodiments.
[0147] Figure 13 is a cache updating apparatus block diagram according to an exemplary embodiment. Referring to Figure 13 , the apparatus includes a request acquisition module 1302, a sampling module 1304, a sending module 1306 and a cache updating module 1308.
[0148] The request acquisition module 1302 is configured to perform acquisition of a first identification table corresponding to a query request of an embedded parameter, the first identification table including at least one embedded parameter identification to be queried;
[0149] The sampling module 1304 is configured to perform sampling processing on the first identification table to obtain a second identification table, the second identification table including at least one target embedded parameter identification sampled from the first identification table;
[0150] The sending module 1306 is configured to perform sending of the second identification table to a server, the second identification table being used to instruct the server to query a target embedded parameter matching the target embedded parameter identification in the second identification table;
[0151] The cache updating module 1308 is configured to perform receiving of a target embedded parameter returned by the server and matching the target embedded parameter identification in the second identification table, and updating of an embedded parameter cache according to the second identification table and the matching target embedded parameter.
[0152] In an exemplary embodiment, the sampling module is further configured to perform: for each first identification table corresponding to the query request, using a preset first sampling strategy to extract an embedded parameter identification satisfying the first sampling strategy from the first identification table; taking the embedded parameter identification satisfying the first sampling strategy as a target embedded parameter identification, and generating a second identification table for sampling of the first identification table according to the target embedded parameter identification.
[0153] In an exemplary embodiment, the sampling module is further configured to perform: when the query request satisfies a preset second sampling strategy, taking an embedded parameter identification in the first identification table corresponding to the query request as a target embedded parameter identification, and generating a second identification table according to the target embedded parameter identification.
[0154] In an example embodiment, the embedding parameter cache comprises a first embedding information table and a second embedding information table, each node of the first embedding information table is configured to store an embedding parameter identifier and a corresponding embedding parameter, and the second embedding information table is configured to record a corresponding relationship between the embedding parameter identifier and a node position, the node position being used to represent a position of the embedding parameter identifier in the first embedding information table; and the cache updating module is configured to perform: when there is an embedding parameter identifier in the second embedding information table that matches a target embedding parameter identifier in the second identifier table, determining a first target node position corresponding to the matching embedding parameter identifier; and updating an embedding parameter of a corresponding node in the first embedding information table based on a target embedding parameter corresponding to the target embedding parameter identifier according to the first target node position.
[0155] In an example embodiment, the cache updating module is further configured to perform: adjusting the updated node in the first embedding information table to a second target node position, the second target node position being located at a head or a tail of the first embedding information table; and updating the second embedding information table according to the second target node position of the updated node.
[0156] In an example embodiment, the cache updating module is further configured to perform: when there is no embedding parameter identifier in the second embedding information table that matches a target embedding parameter identifier in the second identifier table, creating a new node in the first embedding information table, the new node being configured to store the target embedding parameter identifier and a corresponding target embedding parameter; and updating the second embedding information table according to the new node.
[0157] In an example embodiment, the cache updating module is further configured to perform: obtaining a current storage amount of the first embedding information table; and when the storage amount reaches a storage amount threshold, deleting a node at a target position in the first embedding information table until the storage amount is less than the storage amount threshold, to obtain the first embedding information table after the deleted node.
[0158] In an example embodiment, the cache updating module is further configured to perform: updating the second embedding information table according to the deleted node in the first embedding information table.
[0159] In an example embodiment, the embedding parameter cache comprises two third embedding information tables, and a search pointer and an update pointer each pointing to one of the third embedding information tables, and each of the two third embedding information tables is configured to store embedding parameter identifiers and corresponding embedding parameters; and the cache update module is further configured to perform: when there is an embedding parameter identifier matching a target embedding parameter identifier in the second identifier table in the third embedding information table currently pointed to by the update pointer, updating the embedding parameter corresponding to the matching embedding parameter identifier in the third embedding information table currently pointed to by the update pointer according to a target embedding parameter corresponding to the target embedding parameter identifier.
[0160] In an example embodiment, the cache update module is further configured to perform: when there is no embedding parameter identifier matching a target embedding parameter identifier in the second identifier table in the third embedding information table currently pointed to by the update pointer, writing the target embedding parameter identifier and a corresponding target embedding parameter into the third embedding information table currently pointed to by the update pointer.
[0161] In an example embodiment, the cache update module is further configured to perform: obtaining a stored amount of the third embedding information table currently pointed to by the update pointer; when the stored amount reaches a storage threshold, swapping the third embedding information tables currently pointed to by the update pointer and the search pointer respectively, and performing emptying processing on the third embedding information table pointed to by the update pointer after the swapping.
[0162] In an example embodiment, the cache update module is further configured to perform: when the stored amount does not reach the storage threshold, obtaining a swap time closest to a current time in a swap time record of the update pointer and the search pointer; when a time interval between the swap time and the current time reaches a set time threshold, swapping the third embedding information tables currently pointed to by the update pointer and the search pointer respectively, and performing emptying processing on the third embedding information table pointed to by the update pointer after the swapping.
[0163] In an example embodiment, the apparatus further includes a querying module configured to perform: obtaining a third identification table, the third identification table including at least one to-be-queried embedded parameter identification remaining after sampling the second identification table from the first identification table; when there is a target embedded parameter identification in the embedded parameter cache matching the to-be-queried embedded parameter identification in the third identification table, obtaining a first embedded parameter corresponding to the target embedded parameter identification in the embedded parameter cache; when there is no target embedded parameter identification in the embedded parameter cache matching the to-be-queried embedded parameter identification in the third identification table, sending the to-be-queried embedded parameter identification in the third identification table to a server; receiving a second embedded parameter corresponding to the to-be-queried embedded parameter identification in the third identification table returned by the server; and obtaining a query result of the query request according to the first embedded parameter, the second embedded parameter, and a target embedded parameter matching the target embedded parameter identification in the second identification table.
[0164] With regard to the apparatus in the above-described embodiments, specific manners in which various modules perform operations have been described in detail in embodiments of the method, and thus will not be described in detail here.
[0165] Figure 14 FIG. 1 is a block diagram illustrating an electronic device 100 according to an example embodiment. The electronic device 100 can be a mobile phone, a computer, a digital broadcasting terminal, a message transmitting / receiving device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and / or the like.
[0166] Referring to FIG. 1, Figure 14 The electronic device 100 can include one or more of the following components: a processing component 102, a memory 104, a power supply component 106, a multimedia component 108, an audio component 110, an input / output (I / O) interface 112, a sensor component 114, and a communication component 116.
[0167] The processing component 102 generally controls the overall operations of the electronic device 100, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 102 can include one or more processors 120 to execute instructions to complete all or part of steps of the above-described methods. In addition, the processing component 102 can include one or more modules to facilitate the interaction between the processing component 102 and other components. For example, the processing component 102 can include a multimedia module to facilitate the interaction between the multimedia component 108 and the processing component 102.
[0168] The memory Z04 is configured to store various types of data to support the operation of the electronic device Z00. Examples of such data include instructions for any application programs or methods operating on the electronic device Z00, contact data, phonebook data, messages, pictures, videos, etc. The memory Z04 can be implemented by any type of volatile or nonvolatile memory devices or a combination thereof such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disc, optical disc, or graphene memory.
[0169] The power supply component Z06 supplies power to various components of the electronic device Z00. The power supply component Z06 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device Z00.
[0170] The multimedia component Z08 includes a screen providing an output interface between the electronic device Z00 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swiping, and gestures on the touch panel. The touch sensor can not only sense a boundary of a touching or swiping action, but also detect duration and pressure related to the touching or swiping action. In some embodiments, the multimedia component Z08 includes a front camera and / or a rear camera. The front and / or rear camera can receive external multimedia data when the electronic device Z00 is in an operating mode, such as a photographing mode or a video mode. Each of the front and rear cameras can be a fixed optical lens system or have a focal length and optical zoom capability.
[0171] The audio component Z10 is configured to output and / or input audio signals. For example, the audio component Z10 includes a microphone (MIC) configured to receive external audio signals when the electronic device Z00 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory Z04 or transmitted via the communication component Z16. In some embodiments, the audio component Z10 also includes a speaker for outputting audio signals.
[0172] The I / O interface Z12 provides an interface between the processing component Z02 and peripheral interface modules, which can be a keyboard, a click wheel, a button, etc. These buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0173] The sensor component Z14 includes one or more sensors for providing status assessments for various aspects of the electronic device Z00. For example, the sensor component Z14 can detect an open / closed position of the electronic device Z00, relative positioning of components, such as a display and a keypad of the electronic device Z00, a change in position of the electronic device Z00 or a component of the electronic device Z00, the presence or absence of user contact with the electronic device Z00, the orientation or acceleration / deceleration of the device Z00, and a temperature change of the electronic device Z00. The sensor component Z14 can include an optical sensor for detecting ambient light, a proximity sensor configured to detect the presence of nearby objects without any physical contact, and a CMOS or CCD image sensor for use in imaging applications. In some embodiments, the sensor component Z14 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0174] The communication component Z16 is configured to facilitate wired or wireless communication between the electronic device Z00 and another device. The electronic device Z00 can access a wireless network based on a corresponding communication standard, such as WiFi, a cellular network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In an example embodiment, the communication component Z16 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component Z16 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) techniques, infrared data association (IrDA) techniques, ultra-wideband (UWB) techniques, Bluetooth (BT) techniques, and other techniques.
[0175] In an example embodiment, the electronic device Z00 can be implemented using one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements, to perform the above-described methods.
[0176] In an example embodiment, a computer-readable storage medium, such as the memory Z04 including instructions, is also provided, which can be executed by the processor Z20 of the electronic device Z00 to perform the above-described methods. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.
[0177] In an example embodiment, there is also provided a computer program product comprising instructions executable by the processor Z20 of the electronic device Z00 to perform the above method.
[0178] It should be noted that the above apparatus, electronic device, computer readable storage medium, computer program product and the like according to the description of the method embodiments can also include other implementation manners, and the specific implementation manners can be referred to the description of the related method embodiments, which will not be repeated here.
[0179] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the concepts disclosed herein. The disclosure is intended to cover any variations, uses or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice in the art to which the disclosure pertains. The specification and examples are to be regarded as illustrative only, and the true scope and spirit of the disclosure are indicated by the appended claims.
[0180] It should be understood that the present disclosure is not limited to the precise structures herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims that follow.
Claims
1. A cache update method characterized by comprising: The method comprises: obtaining a first identification table corresponding to a query request of an embedded parameter, the first identification table comprising at least one embedded parameter identification to be queried; sampling the first identification table to obtain a second identification table, the second identification table comprising at least one target embedded parameter identification sampled from the first identification table; sending the second identification table to a server, the second identification table being used to instruct the server to query target embedded parameters matching the target embedded parameter identification in the second identification table; receiving the target embedded parameters matching the target embedded parameter identification in the second identification table returned by the server, and updating an embedded parameter cache according to the second identification table and the matching target embedded parameters.
2. The method of claim 1, wherein, The sampling of the first identification table to obtain the second identification table comprises: for each first identification table corresponding to a query request, using a preset first sampling strategy to extract embedded parameter identifications satisfying the first sampling strategy from the first identification table; using the embedded parameter identifications satisfying the first sampling strategy as target embedded parameter identifications, and generating a second identification table for sampling the first identification table according to the target embedded parameter identifications.
3. The method of claim 1, wherein, The sampling of the first identification table to obtain the second identification table comprises: when the query request satisfies a preset second sampling strategy, using the embedded parameter identifications in the first identification table corresponding to the query request as target embedded parameter identifications, and generating a second identification table according to the target embedded parameter identifications.
4. The method of claim 1, wherein, The embedded parameter cache comprises a first embedded information table and a second embedded information table, each node of the first embedded information table is used to store an embedded parameter identification and a corresponding embedded parameter, and the second embedded information table is used to record a correspondence between the embedded parameter identification and a node position, the node position being used to represent a position of the embedded parameter identification in the first embedded information table. The updating of the embedded parameter cache according to the second identification table and the matching target embedded parameters comprises: when there is an embedded parameter identification matching the target embedded parameter identification in the second identification table in the second embedded information table, determining a first target node position corresponding to the matching embedded parameter identification; updating the embedded parameter of a corresponding node in the first embedded information table based on the target embedded parameter corresponding to the target embedded parameter identification according to the first target node position.
5. The method of claim 4, wherein, After the updating of the embedded parameter of the corresponding node in the first embedded information table, the method further comprises: adjusting the updated node in the first embedded information table to a second target node position, the second target node position being at a table head or a table tail of the first embedded information table; updating the second embedded information table according to the second target node position of the updated node.
6. The method of claim 5, wherein, The method further comprises: when there is no embedded parameter identification matching the target embedded parameter identification in the second identification table in the second embedded information table, creating a new node in the first embedded information table, the new node being used to store the target embedded parameter identification and a corresponding target embedded parameter; According to the new node, the second embedding information table is updated.
7. The method of claim 6, wherein, After the second embedding information table is updated according to the new node, the method further comprises: Obtaining the current stored amount of the first embedding information table; When the stored amount reaches a storage threshold, the nodes at target positions in the first embedding information table are deleted until the stored amount is less than the storage threshold, and the first embedding information table after the nodes are deleted is obtained.
8. The method of claim 7, wherein, The method further comprises: According to the deleted nodes in the first embedding information table, the second embedding information table is updated.
9. The method of claim 1, wherein, The embedding parameter cache comprises two third embedding information tables, and a search pointer and an update pointer each pointing to one of the third embedding information tables, and the two third embedding information tables are each used to store an embedding parameter identifier and a corresponding embedding parameter; According to the second identifier table and the matching target embedding parameter, the embedding parameter cache is updated, which comprises: When the third embedding information table currently pointed to by the update pointer has an embedding parameter identifier matching the target embedding parameter identifier in the second identifier table, According to the target embedding parameter corresponding to the target embedding parameter identifier, the embedding parameter in the third embedding information table currently pointed to by the update pointer and corresponding to the matching embedding parameter identifier is updated.
10. The method of claim 9, wherein, The method further comprises: When the third embedding information table currently pointed to by the update pointer does not have an embedding parameter identifier matching the target embedding parameter identifier in the second identifier table, the target embedding parameter identifier and the corresponding target embedding parameter are written into the third embedding information table currently pointed to by the update pointer.
11. The method of claim 10, wherein, After the target embedding parameter identifier and the corresponding target embedding parameter are written into the third embedding information table currently pointed to by the update pointer, the method further comprises: Obtaining the stored amount of the third embedding information table currently pointed to by the update pointer; When the stored amount reaches a storage threshold, the third embedding information tables currently respectively pointed to by the update pointer and the search pointer are exchanged, and the third embedding information table pointed to by the update pointer after the exchange is emptied.
12. The method of claim 11, wherein, The method further comprises: When the stored amount does not reach the storage threshold, the exchange time closest to the current time in the exchange time record of the update pointer and the search pointer is obtained; When the time interval between the exchange time and the current time reaches a set time threshold, the third embedding information tables currently respectively pointed to by the update pointer and the search pointer are exchanged, and the third embedding information table pointed to by the update pointer after the exchange is emptied.
13. The method according to any one of claims 1 to 12, characterized in that, The method further comprises: Obtaining a third identifier table, the third identifier table comprising at least one to-be-queried embedding parameter identifier remaining after the second identifier table is sampled from the first identifier table; When the embedding parameter cache has a target embedding parameter identifier matching the to-be-queried embedding parameter identifier in the third identifier table, a first embedding parameter corresponding to the target embedding parameter identifier is obtained from the embedding parameter cache. when the target embedded parameter identifier matching the embedded parameter identifier to be queried in the third identifier table does not exist in the embedded parameter cache, sending the embedded parameter identifier to be queried in the third identifier table to a server; receiving a second embedded parameter corresponding to the embedded parameter identifier to be queried in the third identifier table returned by the server; obtaining a query result of the query request according to the first embedded parameter, the second embedded parameter, and the target embedded parameter matching the target embedded parameter identifier in the second identifier table.
14. A cache updating apparatus characterized by comprising: comprising: a request obtaining module configured to obtain a first identifier table corresponding to a query request of an embedded parameter, the first identifier table comprising at least one embedded parameter identifier to be queried; a sampling module configured to perform sampling processing on the first identifier table to obtain a sampled second identifier table, the second identifier table comprising at least one target embedded parameter identifier sampled from the first identifier table; a sending module configured to send the second identifier table to a server, the second identifier table being used to instruct the server to query a target embedded parameter matching the target embedded parameter identifier in the second identifier table; a cache updating module configured to receive a target embedded parameter matching the target embedded parameter identifier in the second identifier table returned by the server, and update an embedded parameter cache according to the second identifier table and the matching target embedded parameter.
15. An electronic device, comprising: comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the cache updating method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that, when the instructions in the computer readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the cache updating method according to any one of claims 1 to 13.
Citation Information
Patent Citations
LRU and LFU united cache update method and network based on location variation
CN106973088A
Adaptive cache prefetching based on competing dedicated prefetch policies in dedicated cache sets to reduce cache pollution
US20150286571A1