Request back-to-source method and device, equipment and storage medium

By querying the target cache index in the local cache and dynamically selecting the source return method according to the characteristics of the access request, the problem of rigid presetting the source return method in the existing technology is solved, and more efficient resource utilization and user experience improvement is achieved.

CN119814874APending Publication Date: 2025-04-11CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411782571.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The rigid preset source return method in the prior art seems to be unscrupulous when facing changing customer needs and source station responses, and the cost of switching between the two is greater.

Method used

By querying the target cache index in the local cache and dynamically selecting the source return method based on whether the access request carries the range request header, a flexible source return strategy is achieved.

Benefits of technology

It improves response speed, reduces the number of direct accesses to the source server, optimizes resource utilization efficiency, improves user experience, and effectively reduces latency in high concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814874A_ABST
    Figure CN119814874A_ABST
Patent Text Reader

Abstract

The invention provides a request back-to-source method and device, equipment and a storage medium. The request back-to-source method comprises the steps of receiving an access request sent by a client; querying a target cache index corresponding to the access request in a preset local cache; and when the target cache index cannot be queried in the preset local cache, judging whether the access request carries a range request header or not, and returning the access request to the source according to a judgment result. According to the embodiment of the invention, the target cache index is queried in the local cache, so that the request of the client can be quickly responded, the number of direct accesses to the source server is reduced, the overall response speed is remarkably improved, and the back-to-source operation can be carried out according to the specific demand of the request by judging whether the access request carries the range request header or not.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of robotics technology, and in particular to a method, device, equipment and storage medium for requesting a return to the source. Background Art

[0002] The core principle of the content distribution network (CDN) is to cache the content resources of the remote source station to the node closer to the user through its nodes at various levels. When the resource that the user tries to access does not hit in the local cache, the cache server will go back to the source to pull the resource and respond accordingly. Therefore, in order to reduce the load of the source station and improve the user's access speed at the same time, in related technologies, the method usually adopted is that when it is detected that the resource accessed by the user does not hit in the local cache, the CDN service provider usually adopts a back-to-source strategy for back-to-source processing.

[0003] However, the rigidly preset back-to-source method in related technologies is unable to cope with the changing customer demands and source station responses, and switching between the two will also bring great costs. Summary of the invention

[0004] Embodiments of the present application provide a method, device, system, electronic device, and computer-readable storage medium for requesting a return to the source.

[0005] In a first aspect, an embodiment of the present application provides a method for requesting a return to the source, the method comprising:

[0006] Receive access requests sent by clients;

[0007] Querying a preset local cache for a target cache index corresponding to the access request;

[0008] When the target cache index cannot be found in the preset local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result.

[0009] Optionally, returning the access request to the source according to the judgment result includes:

[0010] If the access request carries a range request header, the access request is forwarded as at least one shard back-to-source request, and at least one shard back-to-source request is sent to the source station, and the file information and / or resource information returned by the source station for at least one shard back-to-source request is received.

[0011] Optionally, returning the access request to the source according to the judgment result includes:

[0012] If the access request does not carry a range request header, the access request is forwarded to a source station corresponding to the access request, and file information and / or resource information for the access request returned by the source station is received.

[0013] Optionally, the target cache index includes a first cache index, and after the step of querying the target cache index corresponding to the access request in a preset local cache, the method includes:

[0014] When a first cache index corresponding to the access request exists in the preset local cache, the first cache index is searched for file information and / or resource information for the access request.

[0015] Optionally, the target cache index includes a second cache index, and after the step of querying the target cache index corresponding to the access request in the preset local cache, the method includes:

[0016] When a second cache index corresponding to the access request exists in the preset local cache, the second cache index is searched for file information and / or resource information for the access request.

[0017] Optionally, after the step of searching the second cache index for file information and / or resource information for the access request when the second cache index corresponding to the access request exists in the preset local cache, the method includes:

[0018] If the file information and / or resource information for the access request cannot be queried in the second cache index, the access request is forwarded as at least one shard back-to-source request, and at least one shard back-to-source request is sent to the source station, and the file information and / or resource information for at least one shard back-to-source request returned by the source station is received.

[0019] Optionally, when a second cache index corresponding to the access request exists in the preset local cache, before the step of searching the second cache index for file information and / or resource information for the access request, the method includes:

[0020] It is determined that the second cache index and the file information and / or resource information corresponding to the second cache index exist in the preset local cache.

[0021] In a second aspect, an embodiment of the present application provides a device for requesting a return to the source, the device comprising:

[0022] A receiving module, used for receiving an access request sent by a client;

[0023] A query module, used to query a target cache index corresponding to the access request in a preset local cache;

[0024] The back-to-source module is used to determine whether the access request carries a range request header when the target cache index cannot be queried in the preset local cache, and to back-source the access request according to the determination result.

[0025] Optionally, the back-to-source module includes:

[0026] The first back-to-source submodule is used to forward the access request as at least one shard back-to-source request if the access request carries a range request header, and send at least one shard back-to-source request to the source station, and receive file information and / or resource information returned by the source station for at least one shard back-to-source request.

[0027] Optionally, the determining submodule includes:

[0028] The second back-to-source submodule is used to forward the access request to the source station corresponding to the access request if the access request does not carry a range request header, and receive file information and / or resource information for the access request returned by the source station.

[0029] Optionally, the target cache index includes a first cache index, and the device includes:

[0030] The first module is used to query the file information and / or resource information for the access request in the first cache index when there is a first cache index corresponding to the access request in the preset local cache.

[0031] Optionally, the target cache index includes a second cache index, and the device includes:

[0032] The second module is used to query the file information and / or resource information for the access request in the second cache index when there is a second cache index corresponding to the access request in the preset local cache.

[0033] Optionally, the device comprises:

[0034] The third module is used to forward the access request as at least one shard back-to-source request if the file information and / or resource information for the access request cannot be queried in the second cache index, and send at least one shard back-to-source request to the source station, and receive the file information and / or resource information for at least one shard back-to-source request returned by the source station.

[0035] Optionally, the device comprises:

[0036] The fourth module is used to determine whether the second cache index and the file information and / or resource information corresponding to the second cache index exist in the preset local cache.

[0037] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement any of the above-described methods for requesting a return to the source.

[0038] In a fourth aspect, an embodiment of the present application further provides a storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute any of the above-described methods for requesting a return to the source.

[0039] In an embodiment of the present application, an access request sent by a client is received; a target cache index corresponding to the access request is queried in a pre-set local cache; when the target cache index cannot be queried in the pre-set local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result. That is, in an embodiment of the present application, by querying the target cache index in the local cache, the client's request can be quickly responded to, the number of direct accesses to the source server is reduced, and the overall response speed is significantly improved. By determining whether the access request carries a range request header, the return operation can be performed according to the specific needs of the request. For requests carrying a range request header, only a specific part of the resource can be requested, rather than the entire resource, thereby reducing bandwidth consumption and the load of the source server, optimizing resource utilization efficiency, fast response time and efficient resource utilization, so that the client can obtain the required resources faster and improve the user experience. Especially in high-concurrency scenarios, this method can effectively reduce delays and ensure that users have a smooth access experience.

[0040] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0042] Figure 1 This is a flowchart of a method for requesting a return to the source provided by an embodiment of the present application;

[0043] Figure 2 This is a flowchart of another method for requesting a return to the source provided by an embodiment of the present application;

[0044] Figure 3 This is a flowchart of another method for requesting a return to the source provided by an embodiment of the present application;

[0045] Figure 4 This is a device block diagram of a device for requesting a return to the source provided by an embodiment of the present application;

[0046] Figure 5 is a structural diagram of an electronic device provided in an embodiment of the present application;

[0047] Figure 6 It is a schematic diagram of an exemplary request return method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0049] In order to facilitate those skilled in the art to better understand the technical solution of this application, the overall process of request back-to-source processing of this application is described as follows:

[0050] When it is detected that the resource accessed by the user is not in the local cache, the CDN service provider usually adopts the following two strategies for back-to-origin processing:

[0051] 1) Complete return to the source: When the local cache does not exist, the cache server will completely forward the request to the origin site, and the origin site will return the complete file or resource. After receiving these files or resources, the cache server will cache them locally so that it can directly serve other user requests in the future.

[0052] The advantage of the complete back-to-source strategy is that it is simple and direct, but its efficiency is greatly reduced when facing large files containing Range request headers (such as video files, games or software installation packages, etc.). For example, when the Range request range points to the back of the file, users will face a long wait, which is particularly disadvantageous for applications such as video streaming. In addition, when the Range request range is small, the complete back-to-source method will enlarge the back-to-source, resulting in cost waste.

[0053] 2) Sliced ​​traversal: In sliced ​​traversal, the file requested by the user is divided into multiple smaller slices (or "fragments"), and then these slices are requested from the origin server in the form of Range. The origin server returns these slices. After receiving the slices, the cache server caches them locally and combines these slices into a complete file in the correct order.

[0054] When processing "large file + Range" requests, fragmented back-to-source is back-to-source on demand, and only the fragments within the user's request range are returned to the source, which can greatly reduce the user's waiting time and save back-to-source bandwidth. It is also widely used in actual applications. However, this strategy also faces some challenges. For example, in the face of complex source station environments and changing customer needs, it also exposes a thorny problem, namely the source station compatibility problem. Due to the uneven support of the source station server for the HTTP specification, some servers only support complete back-to-source requests and do not support fragmented back-to-source Range requests. In this case, turning on the fragmentation function may cause the back-to-source request to be processed incorrectly, thereby affecting the user experience. For example, when the fragmentation function is enabled, the user requests a complete file. When fragmenting back-to-source, the client's request will be specially processed and converted into multiple Range requests for fragmented transmission. If the source station server does not support the fragmentation mechanism of this Range request, the fragmentation function will not be executed correctly. This incompatibility will cause the CDN to be unable to return a correct response to the user. The complete file that the user can directly obtain will instead have an error response after being accelerated by the CDN. This will seriously affect the user experience, reduce user satisfaction, and may also lead to customer complaints, which will have a negative impact on the reputation of the service provider.

[0055] As can be seen from the above, CDN service providers have two main return-to-origin strategies when processing resource misses requested by users: full return-to-origin and fragmented return-to-origin. Although the full return-to-origin strategy is simple and direct, it is inefficient when processing large files with Range request headers, which may cause users to wait too long, especially in applications such as video streaming. In addition, when the Range request range is small, the full return-to-origin strategy may waste return-to-origin bandwidth and increase costs. In contrast, the fragmented return-to-origin strategy is more efficient when processing large files and files with Range request headers. It can greatly reduce user waiting time and save return-to-origin bandwidth by returning to the source on demand and only returning to the fragments within the user's request range. However, due to the different support levels of the source server for the HTTP specification, some servers may not support the Range request of fragmented return-to-origin. The fragmented return-to-origin strategy also faces the source compatibility issue, which may cause the fragmented return-to-origin request to be processed incorrectly, affecting the user experience.

[0056] Therefore, CDN service providers need to comprehensively consider the specific needs of users, the current cache status, and the characteristics of the source site when selecting a back-to-source strategy. However, when using the above two back-to-source methods, the traditional approach is to configure the back-to-source method in advance, and after receiving the request, query the corresponding cache index (full cache or shard cache) according to the preset back-to-source method. If the requested resource does not exist in the cache, it will go back to the source to obtain it. This approach has obvious limitations:

[0057] 1) The two return-to-source methods are mutually exclusive, and the corresponding caches are also independent of each other. Once you switch between the two return-to-source methods, you must return to the source again, which not only increases operating costs, but also affects service quality and customer experience.

[0058] 2) Both full or fragmented back-to-source have their specific application scenarios, and it is difficult to predict all situations in advance. This rigid preset back-to-source method makes the CDN system unable to cope with changing customer needs and origin site responses.

[0059] Therefore, the existing rigidly preset return-to-source method is powerless in the face of changing customer needs and source station responses, and switching between the two will also bring a large cost. In order to overcome the limitations of traditional practices, it is necessary to further explore more flexible and efficient CDN return-to-source strategies. Therefore, an embodiment of the present application proposes a request return-to-source method, which can analyze the current cache status and client requests in real time, and dynamically select the most suitable return-to-source method, thereby making full use of the respective advantages of complete return-to-source and fragmented return-to-source. Through this method, it is possible to maximize the use of cache resources, reduce return-to-source bandwidth consumption, and improve user experience.

[0060] Figure 1 is a flowchart of a method for requesting a return to the source provided by an embodiment of the present application, such as Figure 1 As shown, the method may include:

[0061] Step 101, receiving an access request sent by a client;

[0062] It should be noted that in an embodiment of the present application, after receiving the client's request, the original preset configuration method is no longer used to determine the way to return to the source and which cache index to query. Instead, a double query cache index method is adopted, that is, the index of the complete cache is first queried, and then the index of the shard cache is queried.

[0063] Step 102, querying a target cache index corresponding to the access request in a preset local cache;

[0064] It should be noted that in the embodiment of the present application, when querying, the index of the complete cache is first retrieved. If the search result shows that there is a complete cache index, the complete cache will be used directly to respond, thereby avoiding further querying the index of the shard cache. This strategy is based on the fact that the complete cache can already meet the needs of fast and stable response. At the same time, even if the index of the shard cache exists, the data may be incomplete due to the lack of shards. Therefore, when the complete cache is available, the complete cache is preferred.

[0065] If the index of the complete cache does not exist, the index of the shard cache is queried. If the query result shows that the index of the shard cache exists, it means that the shard back-to-source operation has been successfully performed before and the origin site supports Range requests. In this case, the existing shard cache will be used to complete the response. If a shard is found to be missing during the processing, the shard back-to-source operation is triggered.

[0066] Step 103: When the target cache index cannot be found in the preset local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result.

[0067] It should be noted that in the embodiment of the present application, if neither the index of the complete cache nor the index of the shard cache exists, the client request is further parsed to check whether it carries a Range request header.

[0068] Further, returning the access request to the source according to the judgment result includes:

[0069] If the access request carries a range request header, the access request is forwarded as at least one shard back-to-source request, and at least one shard back-to-source request is sent to the source station, and the file information and / or resource information returned by the source station for at least one shard back-to-source request is received.

[0070] If the request carries a Range request header, it indicates that the client needs data in a specific range. In this case, the fragmented retrieval strategy is used first. This allows fragmented retrieval based on the specific range of the request without changing the nature of the client request. This not only ensures a quick response to client needs and improves user experience, but also avoids unnecessary retrieval bandwidth consumption.

[0071] Among them, the sharding back-to-origin strategy will split the file requested by the user into multiple smaller shards (or "fragments"), and then request these shards from the origin server in the form of Range. The origin server will return these shards. After receiving the shards, the cache server will cache them locally and combine these shards into a complete file in the correct order.

[0072] Further, returning the access request to the source according to the judgment result includes:

[0073] If the access request does not carry a range request header, the access request is forwarded to a source station corresponding to the access request, and file information and / or resource information for the access request returned by the source station is received.

[0074] If the client request does not carry a Range request header, it means that the client is requesting the entire file. In this case, the full back-to-source strategy is preferred. This will not only not affect the user experience, but also ensure the integrity and fluency of the data. At the same time, it avoids the additional network interactions and potential delays that may be caused by shard back-to-source, and reduces the complexity of business logic. More importantly, for the scenario of the client's complete request, shard back-to-source does not provide additional benefits. Therefore, in this case, full back-to-source is a more efficient and economical solution.

[0075] The complete back-to-origin strategy includes that when the local cache does not exist, the cache server will completely forward the request to the origin site, and the origin site will return the complete file or resource. After receiving these files or resources, the cache server will cache them locally so that it can directly serve other user requests in the future.

[0076] In an embodiment of the present application, an access request sent by a client is received; a target cache index corresponding to the access request is queried in a pre-set local cache; when the target cache index cannot be queried in the pre-set local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result. That is, in an embodiment of the present application, by querying the target cache index in the local cache, the client's request can be quickly responded to, the number of direct accesses to the source server is reduced, and the overall response speed is significantly improved. By determining whether the access request carries a range request header, the return operation can be performed according to the specific needs of the request. For requests carrying a range request header, only a specific part of the resource can be requested, rather than the entire resource, thereby reducing bandwidth consumption and the load of the source server, optimizing resource utilization efficiency, fast response time and efficient resource utilization, so that the client can obtain the required resources faster and improve the user experience. Especially in high-concurrency scenarios, this method can effectively reduce delays and ensure that users have a smooth access experience.

[0077] Figure 2 is a flowchart of a method for requesting a return to the source provided by an embodiment of the present application, such as Figure 1 As shown, the method may include:

[0078] Step 201, receiving an access request sent by a client;

[0079] Step 202, querying a preset local cache for a target cache index corresponding to the access request;

[0080] It should be noted that in the embodiments of the present application, reference is made to the foregoing description, which will not be repeated here.

[0081] Step 203: When a first cache index corresponding to the access request exists in the preset local cache, the first cache index is searched for file information and / or resource information for the access request.

[0082] It should be noted that in the embodiment of the present application, the first cache index is the index of the complete cache. Therefore, in the embodiment of the present application, after receiving the access request sent by the client, the index of the complete cache is first retrieved. If the retrieval result shows that there is a complete cache index, the complete cache will be used directly to respond, thereby avoiding further querying the index of the shard cache. This strategy is based on the fact that the complete cache can already meet the needs of fast and stable responses. At the same time, even if the index of the shard cache exists, the data may be incomplete due to the lack of shards. Therefore, when the complete cache is available, the complete cache is used first.

[0083] In an embodiment of the present application, an access request sent by a client is received; a target cache index corresponding to the access request is queried in a pre-set local cache; when the target cache index cannot be queried in the pre-set local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result. That is, in an embodiment of the present application, by querying the target cache index in the local cache, the client's request can be quickly responded to, the number of direct accesses to the source server is reduced, and the overall response speed is significantly improved. By determining whether the access request carries a range request header, the return operation can be performed according to the specific needs of the request. For requests carrying a range request header, only a specific part of the resource can be requested, rather than the entire resource, thereby reducing bandwidth consumption and the load of the source server, optimizing resource utilization efficiency, fast response time and efficient resource utilization, so that the client can obtain the required resources faster and improve the user experience. Especially in high-concurrency scenarios, this method can effectively reduce delays and ensure that users have a smooth access experience.

[0084] Figure 3 is a flowchart of a method for requesting a return to the source provided by an embodiment of the present application, such as Figure 1 As shown, the method may include:

[0085] Step 301, receiving an access request sent by a client;

[0086] Step 302, querying a preset local cache for a target cache index corresponding to the access request;

[0087] Step 303: when a second cache index corresponding to the access request exists in the preset local cache, query the second cache index for file information and / or resource information for the access request;

[0088] Step 304: If the file information and / or resource information for the access request cannot be queried in the second cache index, the access request is forwarded as at least one shard back-to-source request, and at least one shard back-to-source request is sent to the source station, and the file information and / or resource information for at least one shard back-to-source request returned by the source station is received.

[0089] It should be noted that, in the embodiment of the present application, the second cache index is the index of the shard cache.

[0090] Therefore, when it is detected that the first cache index does not exist, but the second cache index corresponding to the access request exists in the pre-set local cache, that is, if the index of the complete cache does not exist, the index of the shard cache is queried again. If the query result shows that the index of the shard cache exists, this indicates that the shard back-to-source operation has been successfully executed before, and the source station supports Range requests. In this case, the existing shard cache will be used to complete the response. If a shard is found to be missing during the processing, the shard back-to-source is triggered.

[0091] Further, before step 303, that is, before the step of searching the second cache index for file information and / or resource information for the access request when there is a second cache index corresponding to the access request in the preset local cache, the method includes:

[0092] It is determined that the second cache index and the file information and / or resource information corresponding to the second cache index exist in the preset local cache.

[0093] Specifically, in another embodiment, referring to Figure 6 , it can be seen that the request back-to-origin method includes the following specific implementation steps:

[0094] First, when receiving client requests, we no longer simply distinguish whether the request contains the "Ct l-Store: split" request header to distinguish between full and fragmented back-to-source. Instead, we first query the index of the full cache and then the index of the fragmented cache.

[0095] Secondly, if the query result shows that the complete cache exists, the complete cache is used first to complete the client response.

[0096] Secondly, if the query result shows that the complete cache does not exist but the shard cache exists, this means that the shard back-to-source was used during the first client request and the origin site meets the conditions for shard back-to-source. If missing shards are found during the processing, a new shard back-to-source request can be triggered normally.

[0097] Secondly, if the query results show that neither the complete cache nor the shard cache exists, the client request header is further parsed to determine the request type based on whether the Range request header is included.

[0098] Secondly, if the request header contains a Range request header, it indicates that the client is requesting data in a specific range. In this case, sharded back-to-source is preferred. The sharded back-to-source request simply forwards a client's Range request into multiple sharded back-to-source requests of a certain size. It does not change the nature of the client's request and can also respond to the data in the client's request range in a timely manner.

[0099] Secondly, if the request header does not contain a Range request header, it means that the client is requesting the entire file from beginning to end. In this case, full back-to-source is preferred. The full back-to-source strategy is not only simple, but also does not affect the user experience. It can also avoid additional network interactions and potential delays caused by shard back-to-source, reducing the complexity of business logic.

[0100] Therefore, in the embodiment of the present application, in combination with the dual query cache index method, the complete cache index is first queried, and if it exists, it is used directly; if it does not exist, the shard cache index is queried. If the shard cache index exists, the shard cache response will be used, otherwise the client request will be further analyzed. For client requests carrying a Range request header, the shard back-to-source strategy is preferentially adopted to ensure fast response and reduce bandwidth consumption; for full-file requests that do not carry a Range request header, the complete back-to-source strategy is preferentially adopted to ensure data integrity and reduce business logic complexity. This solution flexibly adapts to different scenarios through a dual query cache index method and an adaptive back-to-source strategy, ensuring fast response, reducing bandwidth consumption, ensuring data integrity, and reducing business logic complexity, thereby effectively improving user experience and resource utilization efficiency.

[0101] In an embodiment of the present application, an access request sent by a client is received; a target cache index corresponding to the access request is queried in a pre-set local cache; when the target cache index cannot be queried in the pre-set local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result. That is, in an embodiment of the present application, by querying the target cache index in the local cache, the client's request can be quickly responded to, the number of direct accesses to the source server is reduced, and the overall response speed is significantly improved. By determining whether the access request carries a range request header, the return operation can be performed according to the specific needs of the request. For requests carrying a range request header, only a specific part of the resource can be requested, rather than the entire resource, thereby reducing bandwidth consumption and the load of the source server, optimizing resource utilization efficiency, fast response time and efficient resource utilization, so that the client can obtain the required resources faster and improve the user experience. Especially in high-concurrency scenarios, this method can effectively reduce delays and ensure that users have a smooth access experience.

[0102] Corresponding to the method provided in the above-mentioned request return method embodiment of the present application, see Figure 4 The present application also provides a device block diagram of a device for requesting a return to the source. In this embodiment, the device includes:

[0103] Receiving module 401, used to receive an access request sent by a client;

[0104] A query module 402, configured to query a target cache index corresponding to the access request in a preset local cache;

[0105] The back-to-source module 403 is used to determine whether the access request carries a range request header when the target cache index cannot be found in the preset local cache, and to back-source the access request according to the determination result.

[0106] Optionally, the back-to-source module includes:

[0107] The first back-to-source submodule is used to forward the access request as at least one shard back-to-source request if the access request carries a range request header, and send at least one shard back-to-source request to the source station, and receive file information and / or resource information returned by the source station for at least one shard back-to-source request.

[0108] Optionally, the determining submodule includes:

[0109] The second back-to-source submodule is used to forward the access request to the source station corresponding to the access request if the access request does not carry a range request header, and receive file information and / or resource information for the access request returned by the source station.

[0110] Optionally, the target cache index includes a first cache index, and the device includes:

[0111] The first module is used to query the file information and / or resource information for the access request in the first cache index when there is a first cache index corresponding to the access request in the preset local cache.

[0112] Optionally, the target cache index includes a second cache index, and the device includes:

[0113] The second module is used to query the file information and / or resource information for the access request in the second cache index when there is a second cache index corresponding to the access request in the preset local cache.

[0114] Optionally, the device comprises:

[0115] The third module is used to forward the access request as at least one shard back-to-source request if the file information and / or resource information for the access request cannot be queried in the second cache index, and send at least one shard back-to-source request to the source station, and receive the file information and / or resource information for at least one shard back-to-source request returned by the source station.

[0116] Optionally, the device comprises:

[0117] The fourth module is used to determine whether the second cache index and the file information and / or resource information corresponding to the second cache index exist in the preset local cache.

[0118] In summary, the present application embodiment provides a request back-to-source device, which receives an access request sent by a client; queries the target cache index corresponding to the access request in a pre-set local cache; when the target cache index cannot be queried in the pre-set local cache, determines whether the access request carries a range request header, and returns the access request to the source according to the determination result. That is, in the present application embodiment, by querying the target cache index in the local cache, the client's request can be quickly responded to, reducing the number of direct accesses to the source server, thereby significantly improving the overall response speed, and by determining whether the access request carries a range request header, the back-to-source operation can be performed according to the specific needs of the request. For requests carrying a range request header, only a specific part of the resource can be requested, rather than the entire resource, thereby reducing bandwidth consumption and the load of the source server, optimizing resource utilization efficiency, fast response time and efficient resource utilization, so that the client can obtain the required resources faster and improve the user experience. Especially in high-concurrency scenarios, this method can effectively reduce delays and ensure that users have a smooth access experience.

[0119] Figure 5 This is a structural diagram of an electronic device M00 provided in an embodiment of the present application. In the figure, the electronic device M00 includes a processor M01 and a memory M02. The electronic device includes: a processor; a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement any of the request return to source methods described above, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0120] In an embodiment of the present application, the memory M02 can be used to store software programs and various data. The memory M02 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instruction required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory M02 may include a volatile memory or a non-volatile memory, or the memory x09 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (Random Access Memory, RAM), static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (EnhancedSDRAM, ESDRAM), synchronous link dynamic random access memory (Synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory M02 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0121] The processor M01 may include one or more processing units; optionally, the processor M01 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor M01.

[0122] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned request back-to-source method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0123] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0124] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned request back-to-source method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0125] It should be understood that the chip involved in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0126] An embodiment of the present application further provides a storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above-described methods for requesting a return to the source.

[0127] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned request back-to-source method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0128] An embodiment of the present application also provides a vehicle, which includes the device for requesting a return to the source as described above.

[0129] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0130] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0131] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for requesting a return to the source, characterized in that: The method comprises: Receive access requests sent by clients; Querying a preset local cache for a target cache index corresponding to the access request; When the target cache index cannot be found in the preset local cache, it is determined whether the access request carries a range request header, and the access request is returned to the source according to the determination result.

2. The method according to claim 1, characterized in that The returning the access request to the source according to the judgment result includes: If the access request carries a range request header, the access request is forwarded as at least one shard back-to-source request, and at least one shard back-to-source request is sent to the source station, and the file information and / or resource information returned by the source station for at least one shard back-to-source request is received.

3. The method according to claim 1, characterized in that The returning the access request to the source according to the judgment result includes: If the access request does not carry a range request header, the access request is forwarded to a source station corresponding to the access request, and file information and / or resource information for the access request returned by the source station is received.

4. The method according to claim 1, characterized in that The target cache index includes a first cache index. After the step of querying the target cache index corresponding to the access request in the preset local cache, the method includes: When a first cache index corresponding to the access request exists in the preset local cache, the first cache index is searched for file information and / or resource information for the access request.

5. The method according to claim 1, characterized in that The target cache index includes a second cache index. After the step of querying the target cache index corresponding to the access request in the preset local cache, the method includes: When a second cache index corresponding to the access request exists in the preset local cache, the second cache index is searched for file information and / or resource information for the access request.

6. The method according to claim 5, characterized in that After the step of searching the second cache index for file information and / or resource information for the access request when the second cache index corresponding to the access request exists in the preset local cache, the method includes: If the file information and / or resource information for the access request cannot be queried in the second cache index, the access request is forwarded as at least one shard back-to-source request, and at least one shard back-to-source request is sent to the source station, and the file information and / or resource information for at least one shard back-to-source request returned by the source station is received.

7. The method according to claim 5, characterized in that When the second cache index corresponding to the access request exists in the preset local cache, before the step of searching the second cache index for file information and / or resource information for the access request, the method includes: It is determined that the second cache index and the file information and / or resource information corresponding to the second cache index exist in the preset local cache.

8. A device for requesting a return to the source, characterized in that: The device comprises: A receiving module, used for receiving an access request sent by a client; A query module, used to query a target cache index corresponding to the access request in a preset local cache; The back-to-source module is used to determine whether the access request carries a range request header when the target cache index cannot be queried in the preset local cache, and to back-source the access request according to the determination result.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the request back-to-source method as described in any one of claims 1 to 7.

10. A computer storage medium, a readable storage medium, for storing a program, characterized in that: When the program is executed by a processor, a request back-to-source method as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Fragmentation caching method and system, electronic equipment and storage medium

    CN116389576A

  • Resource processing method and device based on content delivery network

    CN116996578A

Cited By

  • Self-adaptive source station resource acquisition method and electronic equipment

    CN120812047A

  • Method for adaptive source station to acquire resources and electronic device

    CN120812047B