Cache method, device, system, server and storage medium
By receiving service requests, obtaining relevant information and determining cache decisions in edge devices, the problem of limited cache space is solved, cache utilization and device performance are improved, and effective cache of high-frequency call task resources is ensured.
Patent Information
- Application Number
- CN202111555581.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2041-12-17
AI Technical Summary
Edge devices have limited cache space, making it difficult to determine which data resources should be cached to maximize cache space utilization and edge device performance.
By receiving service requests, obtaining trigger distance information, determining the request frequency within the request time window, executing service requests, and obtaining execution time and cache occupancy, the cache decision information of the task resources corresponding to the service request is determined based on these factors.
Improve the utilization of cache space, optimize the performance of edge devices, and ensure cache storage of task resources that are frequently called in the subsequently and can improve response efficiency.
Smart Images

Figure CN114237893B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cache technology, and in particular to a cache method, device, system, server, and computer-readable storage medium (storage medium for short). Background Art
[0002] With the development of mobile networks, mobile network traffic is also growing. Traditional networks deploy data resources in data centers, which has problems such as long end-to-end delay in obtaining data resources, limited backhaul bandwidth, and inefficient redundant transmission. In order to solve the above problems, edge devices are deployed to perform calculations and data caching based on mobile edge network caching technology, which can reduce end-to-end delays, improve network transmission efficiency, and respond to service requests efficiently. However, the cache space of edge devices is limited. Which data resources should be cached to maximize the utilization of cache space and maximize the performance of edge devices is a technical problem that needs to be solved urgently. Summary of the invention
[0003] Based on this, it is necessary to provide a caching method, device, system, server and storage medium to address the above technical problems, so as to determine the caching decision information of task resources to improve the utilization of cache space.
[0004] In a first aspect, the present application provides a caching method, comprising:
[0005] Receive a service request and obtain trigger distance information associated with the service request;
[0006] Determine a request time window corresponding to the request time according to the request time corresponding to the service request, and obtain the request frequency within the request time window;
[0007] Execute the service request, obtain the execution time of the service request and the cache occupancy rate of the task resources corresponding to the service request;
[0008] Based on request frequency, trigger distance information, execution time, and cache occupancy, the cache decision information of the task resources corresponding to the service request is determined.
[0009] In some embodiments of the present application, based on the request frequency, trigger distance information, execution time, and cache occupancy rate, the cache decision information of the task resource corresponding to the service request is determined, including:
[0010] Determine the cache priority of the task resources corresponding to the service request based on the request frequency, trigger distance information, execution time, and cache occupancy rate;
[0011] The task resources corresponding to the service request are stored in the cache area according to the cache priority.
[0012] In some embodiments of the present application, the cache priority of the task resource corresponding to the service request is determined according to the request frequency, trigger distance information, execution time and cache occupancy rate, including:
[0013] Obtain the trigger distance level corresponding to the trigger distance information, the request frequency level corresponding to the request frequency, the execution duration level corresponding to the execution duration, and the cache occupancy level corresponding to the cache occupancy rate;
[0014] The cache priority of the task resources corresponding to the service request is obtained according to the request frequency level, trigger distance level, execution time level and cache occupancy level.
[0015] In some embodiments of the present application, the cache priority of the task resource corresponding to the service request is obtained according to the request frequency level, the trigger distance level, the execution time level and the cache occupancy level, including:
[0016] If at least two of the trigger distance level, execution time level, and cache occupancy level are high, the cache priority of the task resource corresponding to the service request is set to a low level;
[0017] If one of the trigger distance level, execution time level, and cache occupancy level is high, the cache priority of the task resource corresponding to the service request is set to medium;
[0018] If the trigger distance level, execution time level, and cache occupancy level are all low and the request frequency level is low or medium, the cache priority of the task resource corresponding to the service request is set to medium;
[0019] If the trigger distance level, execution time level, and cache occupancy level are all low and the request frequency level is high, the cache priority of the task resource corresponding to the service request is set to a high level.
[0020] In some embodiments of the present application, obtaining the request frequency within the request time window includes:
[0021] Count the total number of service requests within the request time window and the historical number of service requests within the historical time window;
[0022] Determine the request frequency based on the ratio between the total number of service requests and the historical number.
[0023] In some embodiments of the present application, obtaining the execution time of executing the service request includes:
[0024] Obtain resource data volume of task resources corresponding to the service request and data processing speed of the processor;
[0025] Get the ratio between the resource data volume and the data processing speed to obtain the execution time of the service request.
[0026] In some embodiments of the present application, obtaining the cache occupancy rate of the task resource corresponding to the service request includes:
[0027] Get the remaining space in the cache and the resource data volume of the task resources corresponding to the service request;
[0028] Get the ratio between the amount of resource data and the amount of remaining space to get the cache occupancy rate.
[0029] In a second aspect, the present application provides a cache system, the cache system comprising an edge server and a terminal connected in communication;
[0030] The terminal is used to obtain a real-time distance value to a target object, and obtain trigger distance information of a service request according to the real-time distance value and a signal reception distance value;
[0031] The terminal is used to generate a service request and send the service request and trigger distance information to the edge server;
[0032] The edge server is used for receiving a service request sent by a terminal, obtaining trigger distance information associated with the service request; determining a request time window corresponding to the request time according to a request time corresponding to the service request, and obtaining a request frequency within the request time window; executing the service request, obtaining an execution time of executing the service request and a cache occupancy rate of a task resource corresponding to the service request; determining a cache decision information of a task resource corresponding to the service request based on the request frequency, trigger distance information, execution time and cache occupancy rate.
[0033] In a third aspect, the present application provides a cache device, the device comprising:
[0034] An information receiving module, used to receive a service request and obtain trigger distance information associated with the service request;
[0035] A frequency information acquisition module, used to determine a request time window corresponding to the request time according to the request time corresponding to the service request, and obtain the request frequency within the request time window;
[0036] An execution information acquisition module is used to execute a service request, obtain the execution time of the service request and the cache occupancy rate of the task resources corresponding to the service request;
[0037] The cache decision generation module is used to determine the cache decision information of the task resources corresponding to the service request based on the request frequency, trigger distance information, execution time and cache occupancy rate.
[0038] In a fourth aspect, the present application further provides a server, the server comprising:
[0039] one or more processors;
[0040] Memory; and
[0041] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the cache method.
[0042] In a fifth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the caching method.
[0043] In a sixth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in the first aspect above.
[0044] The above-mentioned cache method, device, system, server and storage medium receive a service request, obtain the trigger distance information associated with the service request, determine the request time window corresponding to the request time according to the request time corresponding to the service request, and obtain the request frequency within the request time window. After executing the service request, the execution time of executing the service request and the cache occupancy rate of the task resource corresponding to the service request are obtained, and then based on the request frequency, trigger distance information, execution time and cache occupancy rate, the cache decision information of the task resource corresponding to the service request is determined. By adding the request frequency corresponding to the request time window, the trigger distance information, the execution time of the service request and the cache occupancy rate of the task resource corresponding to the service request to the decision process of the edge server to determine whether to cache the task resource corresponding to the service request, both the probability of the service request being triggered again and the server performance related to the edge server are considered, so as to make full use of the cache space, store the task resources that have a high probability of being called in the future and can effectively improve the efficiency of the edge server in responding to server requests in the cache area, and improve the utilization efficiency of the cache space. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 is a schematic diagram of a scenario of a caching method in an embodiment of the present application;
[0047] Figure 2It is a flowchart of the caching method in an embodiment of the present application;
[0048] Figure 3 It is a flowchart of the cache decision information acquisition step in the embodiment of the present application;
[0049] Figure 4 It is a flowchart of the cache priority acquisition step in an embodiment of the present application;
[0050] Figure 5 is a flow chart of a caching method in a caching system in an embodiment of the present application;
[0051] Figure 6 is a schematic diagram of the structure of the cache system in an embodiment of the present application;
[0052] Figure 7 is a schematic diagram of the structure of a cache device in an embodiment of the present application;
[0053] Figure 8 It is a schematic diagram of the structure of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0055] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0056] In the description of the present application, the word "for example" is used to mean "used as an example, illustration or explanation". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0057] In the embodiments of the present application, it should be noted that since the caching method provided in the present application is executed in a computer device, the processing objects of each computer device exist in the form of data or information, such as time, which is actually time information. It can be understood that if frequency, duration, occupancy rate, etc. are mentioned in subsequent embodiments, they are all corresponding data for processing by the computer device, and the details will not be repeated here.
[0058] In the embodiment of the present application, it should also be noted that the caching method provided in the embodiment of the present application can be applied to Figure 1 In the cache system shown. The cache system includes a terminal 100 and an edge server 200. The terminal 100 can be a device that includes both receiving and transmitting hardware, that is, a device with receiving and transmitting hardware that can perform two-way communication on a two-way communication link. The terminal 100 can specifically be a desktop terminal or a mobile terminal. The terminal 100 can also specifically be one of a mobile phone, a tablet computer, a laptop computer, etc., or a smart terminal such as a smart speaker or a smart TV. The edge server 200 refers to a server set at an edge node, which can be an independent server or a server network or server cluster composed of servers, including but not limited to computers, network hosts, a single network server, a plurality of network server sets or a cloud server composed of multiple servers. Among them, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing).
[0059] Specifically, the user operates the terminal 100 to trigger the terminal 100 to generate a service request and send the service request to the edge server 200. After the edge server 200 receives the service request, the edge server 200 responds to the service request and returns the corresponding task resources to the terminal 100, or the edge server 200 sends the service request to the server of the upper-level node, and the service request is executed by the server of the upper-level node to obtain the corresponding task resources.
[0060] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or less computer equipment as shown in Figure 1 Only one edge server 200 is shown. It can be understood that the cache system may also include one or more other servers, which are not specifically limited here.
[0061] It should also be noted that Figure 1 The scenario diagram of the cache system shown is only an example. The cache system and scenario described in the embodiment of the present invention are intended to more clearly illustrate the technical solution of the embodiment of the present invention, and do not constitute a limitation on the technical solution provided by the embodiment of the present invention. Ordinary technicians in this field can know that with the evolution of the cache system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present invention is also applicable to similar technical problems.
[0062] See also Figure 2 The present application embodiment provides a caching method, which is mainly applied to the above Figure 1 Taking the edge server 200 in FIG. 1 as an example, the method includes steps S210 to S240, which are specifically as follows:
[0063] S210: Receive a service request, and obtain trigger distance information associated with the service request.
[0064] The service request may be sent from the terminal to the edge server. It is understandable that after receiving the service request, the edge server responds to the service request and returns corresponding task resources to the terminal. The task resources are data to be cached.
[0065] The trigger distance information includes the distance information between the target object and the terminal that sends the service request when the service request is triggered, wherein the target object may specifically refer to a user who operates the terminal to cause the terminal to send the service request. Specifically, the trigger distance information may be the ratio of the actual distance between the target object and the terminal to the signal receiving distance of the terminal.
[0066] It is understandable that the trigger distance information can reflect the probability of the service request being triggered again. When the distance between the target object identified by the trigger distance information and the terminal is larger, the probability that the target object operates the terminal again to trigger the service request is smaller. When the distance between the target object identified by the trigger distance information and the terminal is smaller, the probability that the target object operates the terminal again to trigger the service request is larger. For example, in the application scenario of smart home, the service request of smart home appliances is often triggered by the user's operation instructions or voice instructions. When the distance between the user (i.e., the target object) and the smart home appliance is larger, the probability that the target object operates the smart home appliance again to trigger the service request is smaller. When the distance between the user and the smart home appliance is smaller, the probability that the target object operates the smart home appliance again to trigger the service request is larger.
[0067] Among them, the trigger distance information is the ratio of the actual distance between the target object and the terminal to the terminal signal reception distance. When the trigger distance information is less than 1, the smaller the trigger distance information, the closer the target object is to the terminal, and the higher the probability that the target object will operate the terminal again to trigger a service request. The larger the trigger distance information (the closer to 1), the farther the target object is from the terminal, and the lower the probability that the target object will operate the terminal again to trigger a service request. When the trigger distance information is greater than 1, the target object leaves the signal reception range of the terminal, and the terminal cannot receive the trigger operation of the target object.
[0068] Specifically, the user operates the terminal to trigger the terminal to generate a service request. At the same time, the terminal obtains the distance between the terminal and the target user and generates trigger distance information based on the distance. Then, the terminal sends the service request and the trigger distance information associated with the service request to the edge server.
[0069] For example, if the terminal is a smart speaker, the user can issue a voice command "What time is Beijing time now?" After the smart speaker receives the voice command "What time is Beijing time now?", it triggers a time query request to be sent to the edge server. At the same time, the smart speaker can predict the distance information between the user and the smart speaker based on the volume information of the received voice command, and then generate trigger distance information based on the distance information, and send the trigger distance information to the edge server. The edge server can then execute the time query request to obtain the corresponding query result, that is, the current Beijing time, and return the query result to the smart terminal, which will play the current Beijing time.
[0070] S220, determining a request time window corresponding to the request time according to the request time corresponding to the service request, and obtaining a request frequency within the request time window.
[0071] Among them, the request time refers to the time when the edge server receives the service request; the request time window corresponding to the request time refers to the time period based on the request time, specifically, it can be a historical time period with the request time as the starting time and the duration as the preset window length; for example, if the request time is 2:35 pm, the request time window can be the time period from 1:35 pm to 2:35 pm.
[0072] Among them, the request frequency is used to reflect the amount of service requests in the time period corresponding to the request time window. The larger the request frequency, the more service requests there are in the request time window, and the smaller the request frequency, the fewer service requests there are in the request time window. Specifically, the request frequency can be the ratio of the total number of service requests in the request time window to the total number of service requests in the historical time window. It should be noted that the larger the request frequency, the more service requests there are in the request time window, and the greater the probability that the current service request will be triggered again.
[0073] Specifically, the edge server determines the request time of the received service request, further determines the corresponding request time window according to the request time, and obtains the request frequency within the request time window.
[0074] Further, in one embodiment, obtaining the request frequency within the request time window includes: counting the total number of service requests within the request time window and the historical number of service requests within the historical time window; and determining the request frequency based on the ratio between the total number of service requests and the historical number.
[0075] Among them, the total number of service requests refers to the sum of all service requests within the request time window; the historical time window refers to the historical time period based on the request time window or the request time; for example, the past 24 hours based on the request time can be used as the historical time window, and for another example, the same time period within the past 24 hours based on the request time window can be used as the historical time window.
[0076] Among them, the request frequency within the request service window is measured by combining the total number of service requests within the historical time window. Specifically, the edge server obtains the total number of service requests within the request time window and the historical number of service requests within the historical time window, and determines the ratio between the total number of service requests and the historical number as the request frequency within the request time window.
[0077] For example, taking the request time as 2:35 p.m., the request time window as 1:35 p.m. to 2:35 p.m., and the historical time window as 2:35 p.m. the previous day to 2:35 p.m. currently, the request frequency within the request time window is the ratio of the number of service requests within the time period from 1:35 p.m. to 2:35 p.m. to the number of service requests within the time period from 2:35 p.m. the previous day to 2:35 p.m. currently.
[0078] It can be understood that when the total amount of service requests corresponding to the request time window accounts for a larger proportion of the historical amount corresponding to the historical time window, it means that the increment of service requests in the request time window is large and the number is large, and the request time window is a time period when service requests are frequent. For example, in the application scenario of smart home, users (i.e., target objects) often use smart appliances within a fixed time period, so smart appliances (i.e., terminals) often send a large number of service requests to the server in a certain time window. The number of service requests in the request time window is characterized by the request frequency, which can reflect that the probability of the service request being triggered again is high.
[0079] S230, executing the service request, obtaining the execution time of the service request and the cache occupancy rate of the task resources corresponding to the service request.
[0080] The execution duration of a service request refers to the time taken to execute the task corresponding to the service request, which can be measured during the execution of the service request, or calculated and predicted based on the resource data volume of the task resources corresponding to the service request.
[0081] It can be understood that the execution time of the service request can reflect the speed of executing the service request to obtain the corresponding task resources, and can represent the difference in efficiency between directly executing the service request to obtain the corresponding task resources and calling the corresponding task resources from the cache area compared to caching the task resources in the cache area; for example, the smaller the execution time of the service request, that is, the faster the speed of executing the service request to obtain the corresponding task resources, compared to caching the task resources in the cache area, the efficiency of directly executing the service request to obtain the corresponding task resources and the efficiency of calling the corresponding task resources from the cache area are not much different; conversely, the longer the execution time of the service request, the efficiency of calling the corresponding task resources from the cache area is higher than the efficiency of directly executing the service request to obtain the corresponding task resources.
[0082] Specifically, the execution time of the service request is related to the processing speed of the processor of the edge server. Therefore, in one embodiment, obtaining the execution time of executing the service request includes: obtaining the resource data volume of the task resource corresponding to the service request and the data processing speed of the processor; obtaining the ratio between the resource data volume and the data processing speed to obtain the execution time of the service request.
[0083] The task resource of the service request refers to the data resource related to the execution result obtained after executing the task corresponding to the service request. For example, if the service request is to query "what time is it in Beijing now", the task resource of the service request refers to the voice data corresponding to the real-time Beijing time obtained by the query, and the voice data is used to instruct the terminal to play the real-time Beijing time. The resource data volume refers to the size of the task resource.
[0084] Specifically, after the edge server obtains the task resources corresponding to the service request, it determines the resource data volume corresponding to the task resources and the processing speed of its own processor, and then obtains the ratio between the resource data volume and the processing speed of the processor to determine the execution time of executing the service request.
[0085] The task resource corresponding to the service request refers to the data resource related to the execution result obtained after executing the task corresponding to the service request, and is also the data to be stored in the cache area. The cache occupancy rate refers to the size information of the cache space used by the task resource corresponding to the cache service request, which can be the ratio of the task resource corresponding to the service request to the total cache space of the cache area, or the ratio of the task resource corresponding to the service request to the remaining cache space of the cache area.
[0086] Specifically, in one embodiment, obtaining the cache occupancy rate of the task resource corresponding to the service request includes: obtaining the remaining space amount of the cache area and the resource data amount of the task resource corresponding to the service request; obtaining the ratio between the resource data amount and the remaining space amount to obtain the cache occupancy rate.
[0087] The edge server obtains the remaining space in the current cache area and the resource data volume of the task resource corresponding to the service request, and then determines the cache occupancy rate of the task resource corresponding to the service request based on the ratio between the resource data volume and the remaining space.
[0088] It is understandable that since the cache space of the cache area corresponding to the edge server is limited, whether to cache the task resources corresponding to the service request needs to consider the size of the space occupied by the cached task resources. The larger the cache occupancy rate of the task resources corresponding to the current service request, the edge server is more inclined not to cache the task resources corresponding to the current service request to avoid the cache space in the cache area being consumed and causing other important cached data to be deleted.
[0089] S240, determining cache decision information of task resources corresponding to the service request based on request frequency, trigger distance information, execution time, and cache occupancy rate.
[0090] Among them, the request frequency corresponding to the request time window, the trigger distance information, the execution time of the service request and the cache occupancy rate of the task resources corresponding to the service request are determined as the decision factors for the edge server to decide whether to cache the task resources of the service request, and then the cache decision information of the task resources corresponding to the service request can be output according to the value of the decision factor.
[0091] It can be understood that the request frequency and trigger distance information corresponding to the request time window are decision factors based on the probability of predicting the service request to be triggered again; wherein, the request frequency is the ratio between the total number of service requests in the request time window and the historical number in the historical time window, which characterizes the probability of the service request being triggered again; the trigger distance information characterizes the probability of the service request being triggered again through the distance information between the target object and the terminal. However, the execution time of the service request and the cache occupancy rate of the task resources corresponding to the service request are decision factors based on the server performance of the edge server; wherein, the execution time of the service request indicates the speed of executing the service request to obtain the corresponding task resources, which can reflect the efficiency difference of directly calling the execution service request to obtain the corresponding task resources compared to caching the task resources in the cache area; the cache occupancy rate of the task resources corresponding to the service request can reflect the utilization efficiency of the cache area when caching the task resources. Therefore, the above four decision factors take into account both the probability of the service request being triggered again and the server performance related to the edge server, so as to make full use of the storage resources of the cache area, store the task resources with a high probability of being called later and can effectively improve the efficiency of the edge server responding to the server request in the cache area, and improve the utilization efficiency of the cache area.
[0092] Specifically, in one embodiment, step S240 includes: S310, determining the cache priority of the task resources corresponding to the service request according to the request frequency, trigger distance information, execution time and cache occupancy rate; S320, storing the task resources corresponding to the service request in the cache area according to the cache priority.
[0093] Among them, after the edge server obtains the corresponding values of the four decision factors, namely, the request frequency corresponding to the request time window, the trigger distance information of the service request, the execution time of the service request, and the cache occupancy rate of the task resources corresponding to the service request, it can determine the cache priority of the task resources corresponding to the service request according to the corresponding values of these four decision factors.
[0094] Specifically, the cache priority of the task resources corresponding to the current service request can be queried in a preset cache priority decision table through a table lookup operation based on the values of the four decision factors, wherein the cache priority decision table stores the cache priority of the task resources corresponding to the service request when the values of the four decision factors are within different value ranges; the cache priority can also be calculated based on the values of the four decision factors, and then the cache priority of the task resources corresponding to the service request can be determined based on the cache priority. For example, the values of the four decision factors can be weighted and summed, and the weighted sum result is the cache priority.
[0095] Further, in one embodiment, step S310 includes: S410, obtaining a trigger distance level corresponding to the trigger distance information, a request frequency level corresponding to the request frequency, an execution time level corresponding to the execution time, and a cache occupancy level corresponding to the cache occupancy rate; S420, obtaining the cache priority of the task resources corresponding to the service request according to the request frequency level, the trigger distance level, the execution time level, and the cache occupancy level.
[0096] Among them, the edge server can determine the level corresponding to the value of each decision factor according to the value range of the four decision factors: the request frequency corresponding to the request time window, the trigger distance information of the service request, the execution time of the service request, and the cache occupancy rate of the task resources corresponding to the service request.
[0097] Specifically, when the distance between the target object identified by the trigger distance information and the terminal is larger, the trigger distance level is larger, and when the distance between the target object identified by the trigger distance information and the terminal is smaller, the trigger distance level is smaller. Among them, the trigger distance information can be the ratio of the real distance between the target object and the terminal to the terminal signal reception distance. When the ratio of the real distance between the target object and the terminal to the terminal signal reception distance is larger, the trigger distance level is larger, and when the ratio of the real distance between the target object and the terminal to the terminal signal reception distance is smaller, the trigger distance level is smaller. For example, when the ratio of the real distance between the target object and the terminal to the terminal signal reception distance (i.e., the trigger distance information) is between 0 and 0.3, the trigger distance level is set to a low level, when the ratio of the real distance between the target object and the terminal to the terminal signal reception distance is between 0.3 and 0.6, the trigger distance level is set to a medium level, and when the ratio of the real distance between the target object and the terminal to the terminal signal reception distance is between 0.6 and 1, the trigger distance level is set to a high level.
[0098] Similarly, when the request frequency is greater, the request frequency level is higher, and when the request frequency is smaller, the request frequency level is smaller; specifically, the request frequency can be the ratio of the total number of service requests in the request time window to the historical number of service requests in the historical time window. When the ratio is greater, the request frequency level is higher, and when the ratio is smaller, the request frequency level is lower. For example, when the ratio of the total number of service requests in the request time window to the historical number of service requests in the historical time window (i.e., the request frequency) is between 0 and 0.3, the request frequency level is set to a low level, when the ratio of the total number of service requests in the request time window to the historical number of service requests in the historical time window is between 0.3 and 0.6, the request frequency level is set to a medium level, and when the ratio of the total number of service requests in the request time window to the historical number of service requests in the historical time window is between 0.6 and 1, the request frequency level is set to a high level.
[0099] In addition, the execution time level and occupancy level of the service request are determined in the same manner as the request frequency level or the trigger distance level; the longer the execution time, the higher the execution time level, and the shorter the execution time, the shorter the execution time level; specifically, the execution time can be the ratio between the amount of resource data and the data processing speed, and the larger the ratio, the higher the execution time level, and the smaller the ratio, the lower the execution time level. The larger the cache occupancy rate, the higher the cache occupancy level, and the smaller the cache occupancy rate, the lower the cache occupancy level; specifically, the cache occupancy rate can be the ratio between the task resources corresponding to the service request and the remaining cache space in the cache area, and the larger the ratio, the higher the execution cache occupancy level, and the smaller the ratio, the lower the cache occupancy level.
[0100] After determining the corresponding levels of the four decision factors, namely, the request frequency corresponding to the request time window, the trigger distance information of the service request, the execution time of the service request, and the cache occupancy rate of the task resources corresponding to the service request, the cache priority of the task resources corresponding to the service request is determined according to the combination of the levels of each decision factor.
[0101] In one embodiment, the cache priority of the task resources corresponding to the service request is obtained according to the request frequency level, the trigger distance level, the execution time level and the cache occupancy level, including: if at least two of the trigger distance level, the execution time level and the cache occupancy level are high, the cache priority of the task resources corresponding to the service request is set to a low level; if one of the trigger distance level, the execution time level and the cache occupancy level is high, the cache priority of the task resources corresponding to the service request is set to a medium level; if the trigger distance level, the execution time level and the cache occupancy level are all low and the request frequency level is low or medium, the cache priority of the task resources corresponding to the service request is set to a medium level; if the trigger distance level, the execution time level and the cache occupancy level are all low and the request frequency level is high, the cache priority of the task resources corresponding to the service request is set to a high level.
[0102] Among them, after determining the cache priority of the task resources corresponding to the service request, the edge server can store the task resources corresponding to the service request in the cache area according to the cache priority; specifically, when the cache space in the cache area is greater than or equal to the task resources corresponding to the service request, the task resources with a high cache priority are stored, and the task resources with a medium or low cache priority are ignored; when the cache space in the cache area is greater than or equal to the task resources corresponding to the service request, and there are multiple task resources corresponding to the service request, the task resources corresponding to the service request are stored in order from high to low cache priority; by giving priority to storing high-priority task resources in the cache area, low-priority task resources will not be stored in the cache area, thereby ensuring the cache quality of the task resources stored in the cache area, making full use of the storage resources of the cache area, and avoiding waste of cache space.
[0103] In the above caching method, a service request is received, and the trigger distance information associated with the service request is obtained; the request time window corresponding to the request time is determined according to the request time corresponding to the service request, and the request frequency within the request time window is obtained; the service request is executed, and the execution time of the service request and the cache occupancy rate of the task resource corresponding to the service request are obtained; based on the request frequency, trigger distance information, execution time and cache occupancy rate, the cache decision information of the task resource corresponding to the service request is determined. By adding the request frequency corresponding to the request time window, the trigger distance information of the service request, the execution time of the service request and the cache occupancy rate of the task resource corresponding to the service request to the decision process of the edge server to determine whether to cache the task resource corresponding to the service request, both the probability of the service request being triggered again and the server performance related to the edge server are considered, so as to make full use of the storage resources of the cache area, store the task resources with a high probability of being called in the future and which can effectively improve the efficiency of the edge server in responding to server requests in the cache area, and improve the utilization efficiency of the cache space.
[0104] In one embodiment, see Figure 5 The present application also discloses a cache system, including an edge server 510 and a terminal 520 that are communicatively connected; wherein:
[0105] Terminal 520 is used to obtain a real-time distance value to a target object, and obtain trigger distance information of a service request according to the real-time distance value and a signal reception distance value;
[0106] Terminal 520, used to generate a service request, and send the service request and trigger distance information to the edge server;
[0107] The edge server 510 is used to receive the service request sent by the terminal and the trigger distance information of the service request; count the request frequency of the terminal sending the service request in the current time window; execute the service request, obtain the execution time of the service request and the cache occupancy rate of the task resource corresponding to the service request; based on the request frequency, trigger distance information, execution time and cache occupancy rate, determine the cache decision information of the task resource corresponding to the service request.
[0108] The terminal 520 may be, but is not limited to, various smart terminals, such as a smart speaker or a smart TV in a mobile environment.
[0109] The real-time distance value refers to the distance value between the terminal 520 and the target object, and the target object refers to the object on which the terminal 520 is operated; specifically, the terminal 520 may obtain the real-time distance value through different sensors.
[0110] For example, in the application scenario of smart home, taking the terminal as a smart speaker, when the smart speaker receives a voice command issued by a target object (such as a user), it can generate a service request according to the control command and measure the distance to the target object according to the voice signal strength of the received voice command; for another example, the smart speaker can be configured with an image sensor, through which the smart speaker obtains environmental images in real time and predicts the distance to the target object through environmental image recognition.
[0111] Specifically, after the terminal 520 obtains the real-time distance value to the target object, it can obtain the trigger distance information of the service request according to the real-time distance value and the signal reception distance value, and send the trigger distance information to the edge server 510. The edge server 510 obtains the cache decision information based on the trigger distance information. Among them, the specific method of each step in the edge server 510 has been described in detail in the above embodiment, and will not be elaborated here.
[0112] See also Figure 6 , Figure 6 The schematic diagram of the cache system includes an input layer, a fuzzy layer, and an output layer. The input layer is used to obtain decision factors such as request frequency, trigger distance information, execution time of service requests, and cache occupancy rate of service requests within the request time window, and fuzzify each decision factor to obtain the level value corresponding to each decision factor. The level values corresponding to these decision factors serve as input information for the subsequent fuzzy layer; the fuzzy layer is used to make fuzzy decisions based on the level values of the input decision factors. Specifically, fuzzy rule processes can be set for different decision factors as the basis for judgment; the output layer is used to obtain the final cache decision information through the decision results of the fuzzy layer.
[0113] In order to better implement the caching method provided in the embodiment of the present application, on the basis of the caching method provided in the embodiment of the present application, a caching device is also provided in the embodiment of the present application, such as Figure 7 As shown, the cache device 700 includes:
[0114] The information receiving module 710 is used to receive a service request and obtain trigger distance information associated with the service request;
[0115] The frequency information acquisition module 720 is used to determine the request time window corresponding to the request time according to the request time corresponding to the service request, and obtain the request frequency within the request time window;
[0116] An execution information acquisition module 730 is used to execute a service request, obtain the execution time of the service request and the cache occupancy rate of the task resources corresponding to the service request;
[0117] The cache decision generation module 740 is used to determine the cache decision information of the task resources corresponding to the service request based on the request frequency, trigger distance information, execution time and cache occupancy rate.
[0118] In some embodiments of the present application, the cache decision generation module 740 is used to determine the cache priority of the task resources corresponding to the service request based on the request frequency, trigger distance information, execution time and cache occupancy rate; and store the task resources corresponding to the service request in the cache area according to the cache priority.
[0119] In some embodiments of the present application, the cache decision generation module 740 is used to obtain the trigger distance level corresponding to the trigger distance information, the request frequency level corresponding to the request frequency, the execution time level corresponding to the execution time, and the cache occupancy level corresponding to the cache occupancy rate; according to the request frequency level, the trigger distance level, the execution time level and the cache occupancy level, the cache priority of the task resources corresponding to the service request is obtained.
[0120] In some embodiments of the present application, the cache decision generation module 740 is used to set the cache priority of the task resources corresponding to the service request to a low level when at least two of the trigger distance level, the execution time level and the cache occupancy level are high levels; to set the cache priority of the task resources corresponding to the service request to a medium level when one of the trigger distance level, the execution time level and the cache occupancy level is high; to set the cache priority of the task resources corresponding to the service request to a medium level when the trigger distance level, the execution time level and the cache occupancy level are all low levels and the request frequency level is low or medium; to set the cache priority of the task resources corresponding to the service request to a high level when the trigger distance level, the execution time level and the cache occupancy level are all low levels and the request frequency level is high.
[0121] In some embodiments of the present application, the frequency information acquisition module 720 is used to count the total number of service requests within the request time window and the historical number of service requests within the historical time window; and determine the request frequency based on the ratio between the total number of service requests and the historical number.
[0122] In some embodiments of the present application, the execution information acquisition module 730 is used to obtain the resource data volume of the task resources corresponding to the service request and the data processing speed of the processor; obtain the ratio between the resource data volume and the data processing speed to obtain the execution time of the service request.
[0123] In some embodiments of the present application, the execution information acquisition module 730 is used to obtain the remaining space amount of the cache area and the resource data amount of the task resources corresponding to the service request; obtain the ratio between the resource data amount and the remaining space amount to obtain the cache occupancy rate.
[0124] For the specific definition of the cache device, please refer to the definition of the cache method above, which will not be repeated here. Each module in the above cache device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0125] In some embodiments of the present application, the cache device 700 may be implemented in the form of a computer program. The computer program may be implemented in Figure 8 The memory of the computer device may store various program modules constituting the cache device 700, for example, Figure 7 The information receiving module 710, the frequency information obtaining module 720, the execution information obtaining module 730 and the cache decision generating module 740 are shown. The computer program composed of various program modules enables the processor to execute the steps of the cache method of each embodiment of the present application described in this specification.
[0126] For example, Figure 8 The computer device shown can be Figure 7 The information receiving module 710 in the cache device 700 shown executes step S210. The computer device can execute step S220 through the frequency information acquisition module 720. The computer device can execute step S230 by executing the information acquisition module 730. The computer device can execute step S240 through the cache decision generation module 740. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device through a network connection. When the computer program is executed by the processor, a cache method is implemented.
[0127] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0128] In some embodiments of the present application, an edge server is provided, comprising one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor in the above-mentioned caching method. The steps of the caching method here may be the steps of the caching method in each of the above-mentioned embodiments.
[0129] In some embodiments of the present application, a computer-readable storage medium is provided, which stores a computer program, and the computer program is loaded by a processor, so that the processor executes the steps of the above-mentioned caching method. The steps of the caching method here can be the steps of the caching method in each of the above-mentioned embodiments.
[0130] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0131] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0132] The above is a detailed introduction to a caching method, device, computer equipment and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A caching method, characterized in that: Applied to edge servers, including: Receiving a service request, and obtaining trigger distance information associated with the service request; Determine a request time window corresponding to the request time according to the request time corresponding to the service request, and obtain a request frequency within the request time window; Execute the service request, and obtain the execution time of executing the service request and the cache occupancy rate of the task resources corresponding to the service request; Determine cache decision information of the task resources corresponding to the service request based on the request frequency, the trigger distance information, the execution time, and the cache occupancy rate; The determining, based on the request frequency, the trigger distance information, the execution time, and the cache occupancy rate, cache decision information of the task resource corresponding to the service request includes: Determining a cache priority of a task resource corresponding to the service request according to the request frequency, the trigger distance information, the execution time, and the cache occupancy rate; The task resources corresponding to the service request are stored in a cache area according to the cache priority.
2. The method according to claim 1, characterized in that The determining, according to the request frequency, the trigger distance information, the execution time, and the cache occupancy rate, of the cache priority of the task resource corresponding to the service request includes: Obtaining a trigger distance level corresponding to the trigger distance information, a request frequency level corresponding to the request frequency, an execution duration level corresponding to the execution duration, and a cache occupancy level corresponding to the cache occupancy rate; The cache priority of the task resource corresponding to the service request is obtained according to the request frequency level, the trigger distance level, the execution time level and the cache occupancy level.
3. The method according to claim 2, characterized in that The acquiring, according to the request frequency level, the trigger distance level, the execution time level, and the cache occupancy level, the cache priority of the task resource corresponding to the service request includes: If at least two of the trigger distance level, the execution time level, and the cache occupancy level are high, setting the cache priority of the task resource corresponding to the service request to a low level; If one of the trigger distance level, the execution time level and the cache occupancy level is a high level, setting the cache priority of the task resource corresponding to the service request to a medium level; If the trigger distance level, the execution time level, and the cache occupancy level are all low levels and the request frequency level is low or medium, the cache priority of the task resource corresponding to the service request is set to medium level; If the trigger distance level, the execution duration level, and the cache occupancy level are all low levels and the request frequency level is high, the cache priority of the task resource corresponding to the service request is set to a high level.
4. The method according to claim 1, characterized in that: The obtaining the request frequency within the request time window includes: Counting the total number of service requests within the request time window and the historical number of service requests within the historical time window; The request frequency is determined according to a ratio between the total number of service requests and the historical number.
5. The method according to claim 1, characterized in that The obtaining the execution time of executing the service request includes: Obtaining the resource data volume of the task resources corresponding to the service request and the data processing speed of the processor; The ratio between the resource data volume and the data processing speed is obtained to obtain the execution time of the service request.
6. The method according to claim 1, characterized in that Obtaining the cache occupancy rate of the task resource corresponding to the service request, including: Obtaining the remaining space in the cache and the resource data volume of the task resources corresponding to the service request; The ratio between the resource data amount and the remaining space amount is obtained to obtain the cache occupancy rate.
7. A cache system, characterized in that: Including edge servers and terminals for communication connection; The terminal is used to obtain a real-time distance value to a target object, and obtain trigger distance information of a service request according to the real-time distance value and a signal reception distance value; The terminal is used to generate a service request, and send the service request and the trigger distance information to the edge server; The edge server is used to receive a service request sent by a terminal and obtain trigger distance information associated with the service request; Determine a request time window corresponding to the request time according to the request time corresponding to the service request, and obtain a request frequency within the request time window; Execute the service request, and obtain the execution time of executing the service request and the cache occupancy rate of the task resources corresponding to the service request; Based on the request frequency, the trigger distance information, the execution time, and the cache occupancy rate, cache decision information of the task resources corresponding to the service request is determined.
8. A cache device, characterized in that: The device comprises: An information receiving module, used to receive a service request and obtain trigger distance information associated with the service request; A frequency information acquisition module, used to determine a request time window corresponding to the request time according to the request time corresponding to the service request, and obtain the request frequency within the request time window; An execution information acquisition module, used to execute the service request, obtain the execution time of executing the service request and the cache occupancy rate of the task resources corresponding to the service request; A cache decision generation module, used to determine cache decision information of the task resources corresponding to the service request based on the request frequency, the trigger distance information, the execution time and the cache occupancy rate; The cache decision generation module is specifically used for: Determining a cache priority of a task resource corresponding to the service request according to the request frequency, the trigger distance information, the execution time, and the cache occupancy rate; The task resources corresponding to the service request are stored in a cache area according to the cache priority.
9. A server, characterized in that: The server comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the cache method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the cache method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for managing multilevel caches of edge server in cdn
CN102439934A
File caching method and device and electronic equipment
CN111917882A