CDN cache service processing method and device, storage medium and program product

By deleting the survival indication file of the target cache service device in the CDN system and sending a failed response, the target cache service device is automatically deleted from the list of available devices, which solves the problems of cumbersome operation of cache service downline and high resource consumption in the existing technology, and realizes lossless downline and stable services.

CN120201077APending Publication Date: 2025-06-24CHINA MOBILE COMM GRP TERMINAL +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510462838.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The existing CDN cache service downline mechanism requires a lot of manpower to operate the access layer service configuration, resulting in large resource consumption, cumbersome operations and error-prone, affecting the quality of users' service.

Method used

By deleting the survival indication file of the target cache service device in response to the target request, and sending a failed response to the Nginx server, the target cache service device will be automatically deleted from the list of available cache service devices, achieving lossless downline.

Benefits of technology

The process of caching service offline is simplified, labor costs are saved, operation errors and resource consumption are avoided, and the CDN system continues to provide stable services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120201077A_ABST
    Figure CN120201077A_ABST
Patent Text Reader

Abstract

The invention discloses a CDN cache service processing method and device, a storage medium and a program product, and the method comprises the steps: responding to a target request, deleting a survival indication file corresponding to a cache service in target cache service equipment, the survival indication file is used for detecting the survival of the target cache service equipment by a plurality of Nginx servers in the CDN system; and when a live detection request sent by the target Nginx server is received after the survival indication file is deleted, sending a live detection failure response to the target Nginx server to indicate the target Nginx server to delete the target cache service device from the available cache service device list, each Nginx server is used for mapping a user resource request of the CDN system to the corresponding cache service equipment according to the available cache service equipment list; and if the user resource request is not received within the preset time, executing an operation corresponding to the target request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of CDN, and in particular, to a CDN cache service processing method, apparatus, storage medium, and program product. Background Art

[0002] A Content Delivery Network (CDN) is a network service that accelerates the transmission of Internet content through a globally distributed server network, improving access speed and performance. In actual application scenarios, it mainly delivers content to end users quickly through cache services on a series of Nginx server nodes, i.e., edge servers, in a distributed network, such as cache services on cache service devices like Apache Traffic Server (ATS), thereby improving access speed, stability, and reliability, while reducing the load pressure on the source server.

[0003] According to the characteristics of CDN, existing cache service offline mechanisms for cache service devices all delete the IP addresses of the cache service devices to be taken offline recorded in all Nginx servers of the current node by manually modifying the access layer service configuration, and it is necessary to wait for the probing detection of the access layer service to sense that the cache service of the cache service device to be taken offline is unavailable before the current cache service device can be taken offline. For example, if an ATS needs to be upgraded, its IP address needs to be removed from the list of available upstream cache service devices of all Nginx servers in the corresponding node in advance. Suppose there are 100 Nginx servers in this node, then every time the ATS is upgraded, all 100 Nginx servers need to be operated on.

[0004] Existing cache service offline mechanisms require a large amount of manpower to modify the access layer service configuration files of all Nginx servers in the target node during the execution process, and modifying the access layer service configuration files will cause a large amount of resource consumption for Nginx servers. Therefore, when performing the offline operation of the target cache service in a node with a large number of devices, it is not only easy to make mistakes due to cumbersome operations, resulting in network failures in the live network, but also significantly affects the user service quality. Summary of the Invention

[0005] The purpose of the embodiments of this application is to provide a CDN cache service processing method, apparatus, system, storage medium, and program product to solve the problem of low safety of a flat-tired vehicle.

[0006] To solve the above technical problems, this specification is implemented as follows: In a first aspect, a CDN cache service processing method is provided, which is applied to a target cache service device in a CDN system. The method includes: In response to a target request, delete the survival indication file corresponding to the target cache service in the target cache service device, where the target request is required to stop the target cache service, and the survival indication file is used for liveness detection of the target cache service device by multiple Nginx servers in the CDN system; When a target liveness probe request sent by a target Nginx server among the multiple Nginx servers is received after the survival indication file is deleted, send a liveness probe failure response to the target Nginx server to instruct the target Nginx server to delete the target cache service device from the list of available cache service devices, where each Nginx server is used to map the user resource requests of the CDN system to the corresponding cache service device according to the list of available cache service devices; If no user resource request is received within a preset time, perform the operation corresponding to the target request.

[0007] In a second aspect, a CDN cache service processing method is provided, which is applied to a target Nginx server in a CDN system. The method includes: Send liveness probe requests to multiple cache service devices in the CDN system according to a liveness probe cycle, so that each cache service device responds to the liveness probe requests to determine whether the survival indication file corresponding to the target cache service in each cache service device is deleted. The survival indication file is used for liveness detection of multiple cache service devices by the target Nginx server, and a liveness probe request is sent once per liveness probe cycle; Receive a liveness probe failure response sent by a target cache service device among the multiple cache service devices when it determines that the survival indication file is deleted; If the target cache service device continuously sends liveness probe failure responses in multiple liveness probe cycles, delete the target cache service device from the list of available cache service devices, where the target Nginx server is used to map the user resource requests of the CDN system to the corresponding cache service device according to the list of available cache service devices.

[0008] In a third aspect, a CDN cache service processing device is provided, which is applied to a target cache service device in a CDN system. The device includes: A deletion module, configured to delete the survival indication file corresponding to the target cache service in the target cache service device in response to a target request, where the target request is required to stop the target cache service, and the survival indication file is used for liveness detection of the target cache service device by multiple Nginx servers in the CDN system; A sending module, configured to send a probing failure response to a target Nginx server when receiving a target probing request sent by the target Nginx server among the multiple Nginx servers after deleting the alive indication file, so as to instruct the target Nginx server to delete the target cache service device from the available cache service device list, where each Nginx server is configured to map a user resource request of the CDN system to a corresponding cache service device according to the available cache service device list; An execution module, configured to execute an operation corresponding to the target request if no user resource request is received within a preset time.

[0009] In a fourth aspect, a CDN cache service processing device is provided, which is applied to a target Nginx server in a CDN system. The device includes: A sending module, configured to send probing requests to multiple cache service devices in the CDN system according to a probing period, so that each cache service device responds to the probing request to determine whether the alive indication file corresponding to the target cache service in each cache service device is deleted. The alive indication file is used for the target Nginx server to perform probing detection on multiple cache service devices, and a probing request is sent once in a probing period; A receiving module, configured to receive a probing failure response sent by the target cache service device among the multiple cache service devices when determining that the alive indication file is deleted; A deletion module, configured to delete the target cache service device from the available cache service device list if the target cache service device continuously sends probing failure responses in multiple probing periods, where the target Nginx server is configured to map a user resource request of the CDN system to a corresponding cache service device according to the available cache service device list.

[0010] In a fifth aspect, a CDN cache service processing system is provided, including multiple cache service devices and multiple Nginx servers, Each cache service device, when executed, implements the steps of the method described in the first aspect; Each Nginx server, when executed, implements the steps of the method described in the second aspect.

[0011] In a sixth aspect, a CDN cache service processing device is provided, including a processor and a memory. The memory stores a program or instruction that can run on the processor. When the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.

[0012] In a seventh aspect, a readable storage medium is provided, on which a program or instructions are stored, and when the program or instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0013] In an eighth aspect, a computer program product is provided, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps of the method described in the first aspect.

[0014] In an embodiment of the present application, the cache service device deletes the alive indication file corresponding to the target cache service in the target cache service device by responding to a target request, where the target request is for stopping the target cache service, and the alive indication file is used for liveness detection of the target cache service device by multiple Nginx servers in the CDN system; when a target liveness request sent by a target Nginx server among the multiple Nginx servers is received after the alive indication file is deleted, a liveness failure response is sent to the target Nginx server to instruct the target Nginx server to delete the target cache service device from the available cache service device list, where each Nginx server is used to map user resource requests of the CDN system to the corresponding cache service device according to the available cache service device list; if no user resource request is received within a preset time, the operation corresponding to the target request is executed. Thus, the unavailability of the cache service of the target cache service device can be mapped from the unavailability of the overall process to the state of whether an alive indication file exists. By deleting the alive indication file, it is possible to simply, quickly, and automatically perform effective lossless offline of the cache service of the target cache service device only by deleting the alive indication file of the target cache service device. This can not only save labor costs, avoid errors and in-network failures caused by cumbersome operations when there are many Nginx servers, but also avoid a large amount of resource consumption by Nginx servers. In addition, the Nginx server can immediately sense whether the corresponding cache service device is unavailable during the corresponding detection period of sending the liveness request, but the cache service corresponding to the current liveness cycle of the cache service device will not be offline. Instead, it will be actually stopped after all Nginx servers have performed offline processing and no longer receive user resource requests. Therefore, during the entire liveness detection process of multiple Nginx servers, the quality of customer service will not be affected, and the operation corresponding to the target request can be completed without loss, thereby ensuring that the entire CDN system continuously provides stable services. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 It is a schematic diagram of an application scenario of the CDN cache service processing method of an embodiment of the present application.

[0016] Figure 2 It is a flowchart of the CDN cache service processing method of the first embodiment of the present application.

[0017] Figure 3 It is a flow chart of the CDN cache service processing method of the second embodiment of the present application.

[0018] Figure 4 It is a specific example flow chart of the CDN cache service processing method of an embodiment of the present application.

[0019] Figure 5 It is a structural block diagram of the CDN cache service processing device of the first embodiment of the present application.

[0020] Figure 6 It is a structural block diagram of a CDN cache service processing device according to the second embodiment of the present application.

[0021] Figure 7 It is a structural block diagram of the CDN cache service processing system of an embodiment of the present application.

[0022] Figure 8 It is a structural block diagram of a CDN cache service processing device according to another embodiment of the present application. DETAILED DESCRIPTION

[0023] 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 part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application. The numbering of the drawings in this application is only used to distinguish the various steps in the scheme, and is not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.

[0024] In order to solve the problems existing in the prior art, the embodiments of the present application provide a CDN cache service processing method and device, a system, a readable storage medium, and a computer program product.

[0025] First combine Figure 1, the application scenario of the CDN cache service processing method according to the embodiments of the present application is described. The CDN system includes a load balancing device, multiple cache service devices, multiple Nginx servers, and a customer origin server.

[0026] Combined with Figure 1 For example, the load balancing device is the LVS device 20. Based on the load balancing technology of the network transport layer, the traffic entry of the CDN system is the four-layer load balancing device of the cluster. This device uses the kernel Linux Virtual Server (LVS) technology combined with keepalived for four-layer traffic forwarding, and selects the corresponding server for CDN acceleration according to different algorithms according to business requirements (such as traffic balancing, session retention, etc.).

[0027] Multiple Nginx servers 30 correspond to, for example, Figure 1 the Nginx of. In addition to using the load balancing device as the traffic entry for the business of the CDN system, in the application layer of the OSI standard seven-layer model, some HTTP servers or reverse proxy servers are also required to access the business of the CDN system. For example, the Nginx server 30 provides virtual domain name configuration to access user services. The cache service device 40 corresponds to, for example, Figure 1 ATS.1 to ATS.5. ATS is used as the cache software of the CDN system, mainly providing cache support for the user resource requests of the CDN system.

[0028] Specifically, combined with Figure 1 , for the user resource request sent for the access requirement of user 10 to the resource, the LVS device 20 performs traffic distribution operations. Since it provides acceleration services and returns the resources requested by the client of user 10, the egress bandwidth of the LVS device 20 is relatively high. Therefore, after each user resource request passes through Nginx, it is mapped to different cache service devices 40 for service by a preset hash algorithm. When multiple Nginx map the user resource requests to the normally available cache service devices, the cache service devices will obtain the corresponding resources from the customer origin server 50 and return them to the client of user 10. For example, Figure 1 in Nginx maps the user resource request R1 to ATS.5. When ATS.5 is serving normally, it will obtain the corresponding resources from the customer origin server 50 based on the user resource request R1 and return them to the client of user 10.

[0029] In addition, multiple Nginx servers respectively perform liveness detection on multiple cache service devices through the liveness detection function to detect the currently online and available cache service devices. For example Figure 1Among them, multiple Nginx servers respectively perform liveness detection on ATS.1 to ATS.5. If ATS.5 goes offline, the liveness detection for ATS.5 fails.

[0030] Next, in combination with Figure 2 the caching service processing method of the first embodiment of the present application will be described. The method of this embodiment is applied to a target caching service device in a CDN system, and the target caching service device is any one of multiple caching service devices 40.

[0031] As Figure 2 shown, the method of this embodiment includes the following steps 102 to step 106.

[0032] Step 102, in response to a target request, delete the liveness indication file corresponding to the target caching service in the target caching service device, where the target request is for stopping the target caching service, and the liveness indication file is used for liveness detection of the target caching service device by multiple Nginx servers in the CDN system.

[0033] The CDN system includes multiple caching service devices 40, and the caching service processing method of this embodiment can be applied to any one of the caching service devices. Under normal circumstances, as Figure 1 described in the application scenario, the caching service device normally provides caching services in the CDN system. However, in some cases such as upgrades, failures, or emergencies, there is one or some caching service devices, that is, the target caching service device, which needs to stop the caching service and perform offline processing. At this time, the target caching service device will receive a target request to stop the caching service of the target caching service device, and the target caching service device will perform offline processing after this target request.

[0034] Specifically, the target caching service device deletes the liveness indication file created for the target caching service, such as the alive file. The liveness indication file is used for liveness detection of the target caching service device by multiple Nginx servers in the CDN system. In one embodiment, the liveness indication file is an empty file without any content or data, which is convenient for creation and deletion. Thus, the liveness detection of the caching service device by each Nginx server can be realized in the simplest way.

[0035] If the target caching service device receives a request to stop the target caching service, it will delete the locally created liveness indication file, so that subsequent liveness detection of the target caching service device by multiple Nginx servers can be determined based on whether the liveness indication file on the target caching service device exists or is deleted.

[0036] Step 104, when a target liveness probe request sent by a target Nginx server among the multiple Nginx servers is received after the liveness indication file is deleted, send a liveness probe failure response to the target Nginx server to instruct the target Nginx server to delete the target cache service device from the available cache service device list, where each Nginx server is used to map the user resource requests of the CDN system to the corresponding cache service device according to the available cache service device list.

[0037] The liveness probe detection of each cache service device by the Nginx server will be continuously executed according to a preset liveness probe period. A liveness probe request for liveness probe detection is sent to each cache service device deployed corresponding to the current node in each liveness probe period to detect the unavailable cache service devices among them. The liveness probe detection is for all deployed cache service devices, including those that are currently available and those that are currently unavailable.

[0038] In this way, when the target cache service device deletes the liveness indication file in response to the target request, if a liveness probe request sent by any Nginx server among the multiple Nginx servers is received, a liveness probe failure response is sent to that Nginx server. The liveness probe failure response indicates that the target cache service device is currently unavailable and cannot provide cache services normally. Thus, it can instruct the corresponding Nginx server to delete the target cache service device from the available cache service device list, preventing the Nginx server from mapping the subsequent user resource requests received to the target cache service device.

[0039] The available cache service device list only records the currently available cache service devices, that is, the devices that provide cache services normally. If it is determined through liveness probe detection that a certain cache service device is currently unavailable, that cache service device will be deleted from the available cache service device list. Subsequently, each Nginx server will map the user resource requests of the CDN system to the corresponding cache service device through the hash algorithm according to the currently updated available cache service device list on it.

[0040] Through the above method, multiple Nginx servers can respectively detect that the target cache service device that has deleted the liveness indication file is unavailable and can automatically delete the target cache service device from the available cache service device list recorded by each of them, transferring the subsequent bandwidth traffic on the target cache service device, that is, the user resource requests, to other available cache service devices to provide cache services.

[0041] Thus, after all Nginx servers delete the target cache service device from the corresponding available cache service device list, the target cache service device will not receive new user resource requests subsequently.

[0042] In the embodiment of the present application, by adopting soft offline, during the process of probe failure, the cache service provided by the target cache service device is normal. Because the probe failure is not a real cache service failure, but because the alive indication file is deleted, thus from the perspective of the Nginx server, an illusion that the target cache service device cannot provide services is formed. In this way, during the entire probe process in which multiple Nginx servers probe the target cache service device, the target cache service device is available and the service quality will not be affected.

[0043] Step 106, if no user resource request is received within the preset time, then perform the operation corresponding to the target request.

[0044] As described above, if no user resource request is received within the preset time, it means that the target cache service device has completed the offline operation on all Nginx servers. At this time, the cache service of the target cache service device can be stopped normally, and the operation corresponding to the target request can be performed for upgrade or fault handling, etc.

[0045] Performing the operation of the target request on the target cache service device in the case of a user resource request will affect the service quality. In the embodiment of the present application, after deleting the target cache service device from the list of available cache service devices, thereby transferring the user resource request of the target cache service device to other available cache service devices, the operation of the target request is performed. In this way, it can effectively ensure that during the process of performing the operation corresponding to the target request, the impact on the service quality is reduced.

[0046] Optionally, after performing the operation corresponding to the target request, it further includes: restarting the target cache service device and creating the alive indication file locally; when a target probe request sent by a target Nginx server among the multiple Nginx servers is received after creating the alive indication file, sending a probe success response to the target Nginx server to instruct the target Nginx server to add the target cache service device to the list of available cache service devices.

[0047] After the target cache service device finishes performing the operation corresponding to the current request, the stopped cache service can be restored. In this embodiment, the target cache service device can be restarted, and the alive indication file can be created again locally on the target cache service device. Thus, when the alive indication file is created, when the Nginx server probes the target cache service device, the alive indication file can be found and a probe success response can be sent to the Nginx server.

[0048] Each Nginx server continuously sends liveness detection requests to the target cache service device according to the set detection period. When there is a liveness indication file locally in the target cache service device, it can respond to the corresponding detection request and send a liveness success response to the Nginx server. The liveness success response indicates that the target cache service device is currently available and can provide cache services normally. Thus, it can instruct the corresponding Nginx server to add the target cache service device to the list of available cache service devices, so that the Nginx server can subsequently map the received user resource requests to the target cache service device.

[0049] In the above manner, multiple Nginx servers can respectively detect that the target cache service device without a deleted liveness indication file is available, and can automatically add the target cache service device to the list of available cache service devices recorded by each of them, and allocate the subsequent bandwidth traffic, that is, user resource requests, to the available cache service devices including the target cache service device to provide cache services.

[0050] By mapping the liveness detection of the Nginx server to the liveness indication file, when the target cache service needs to be restarted, simple, fast, and automatic service recovery operations can also be performed to ensure flexible expansion and contraction of nodes.

[0051] In order to implement the use of the liveness indication file for the liveness detection of cache service devices by multiple Nginx servers in the CDN system, it is necessary to pre-configure each cache service device.

[0052] In one embodiment, optionally, before deleting the liveness indication file corresponding to the target cache service in the target cache service device in step 102, it further includes: creating the liveness indication file corresponding to the target cache service locally in the target cache service device and defining the name of the liveness indication file; configuring liveness detection configuration on the target cache service device, where the liveness detection configuration corresponds to the liveness detection and is used to perform the liveness detection of the target cache service device by multiple Nginx servers by mapping the liveness detection request to finding whether the liveness indication file with the name is deleted; configuring to send a liveness success response when the liveness indication file with the name is not deleted, the first response code used for the liveness success response, and configuring to send a liveness failure response when the liveness indication file with the name is deleted and the second response code used for the liveness failure response; configuring the plugin code for finding whether the liveness indication file with the name is deleted.

[0053] When the target cache service device has an operation requirement that needs to be executed when the service stops, in order to ensure that the CDN system's service can operate normally and stably during the operation, it is necessary to soft-offline the cache service of the target cache service device. In the embodiment of the present application, the alive indication file of the target cache service device is deleted to implement the response to the liveness probe request of Nginx.

[0054] Specifically, the configuration of the target cache service device includes: 1. Create a local alive indication file with a predefined name, such as an empty file named alive. 2. Configure a probe configuration for the cache service, corresponding to the probe configuration of the Nginx server, so that the liveness probe request of the Nginx server can be mapped to the probe configuration of the cache service, that is, by checking whether the alive indication file with the corresponding name has been locally deleted or exists locally, to perform the liveness detection of the target cache service device by the Nginx server. For example, set the mapping code as: , where the domain name "http: / / heartbeat" at the back represents the Nginx server of the origin, and the domain name "http: / / heartbeat" at the front represents the target cache service device of the destination, that is, map the domain name accessed by the liveness probe request of the Nginx server to query the alive indication file of this domain name on the target cache service device. During the data processing, the probe request flows to this probe configuration of the target cache service device through the probe configuration of the Nginx server, and the probe configuration of the cache service will check whether there is an empty file named alive locally. 3. Configure the plugin code for checking whether the empty file named alive has been deleted. The plugin code is used to detect whether the alive empty file exists. 4. Configure to send a liveness probe success response when the alive empty file exists / has not been deleted, and the first response code used for the liveness probe success response. For example, if the alive empty file exists, return 200 to represent that the liveness probe is successful; and configure to send a liveness probe failure response when the alive empty file does not exist / has been deleted, and the second response code used for the liveness probe failure response. For example, if the alive empty file does not exist, return 404 to represent that the liveness probe fails.

[0055] Based on the solution provided in the above embodiments, optionally, in the above step 104, when a target liveness probe request sent by a target Nginx server among the multiple Nginx servers is received after deleting the liveness indication file, sending a liveness probe failure response to the target Nginx server includes: mapping the target liveness probe request of the target Nginx server to a liveness probe configuration of the target cache service device; based on the liveness probe configuration, using the plug-in code to check whether a liveness indication file with the name exists on the target cache service device; and based on the search result that the liveness indication file with the name does not exist, sending a liveness probe failure response to the target Nginx server.

[0056] After the target cache service device responds to the target request to delete the locally created liveness indication file, if a liveness probe request sent by the target Nginx server is received, first map the liveness probe request of the target Nginx server to the liveness probe configuration of the target cache service device, that is, check whether the target cache service device is available by checking whether a liveness indication file exists on the target cache service device. Specifically, the configured plug-in code can be used to perform the corresponding file search on the target cache service device, and after the corresponding liveness indication file cannot be found, a liveness probe failure response is sent to the target Nginx server according to the configured response code.

[0057] In the embodiment of the present application, the cache service device deletes the survival indication file corresponding to the target cache service in the target cache service device by responding to a target request, where the target request is for stopping the target cache service, and the survival indication file is used for the liveness detection of the target cache service device by multiple Nginx servers in the CDN system; when a target liveness request sent by a target Nginx server among the multiple Nginx servers is received after the survival indication file is deleted, a liveness failure response is sent to the target Nginx server to instruct the target Nginx server to delete the target cache service device from the list of available cache service devices, where each Nginx server is used to map the user resource request of the CDN system to the corresponding cache service device according to the list of available cache service devices; if no user resource request is received within a preset time, the operation corresponding to the target request is executed. Thus, the unavailability of the cache service of the target cache service device can be mapped from the unavailability of the overall process to the state of whether a survival indication file exists. By deleting the survival indication file, it is possible to simply, quickly, and automatically perform effective lossless offline of the cache service of the target cache service device only by deleting the survival indication file of the target cache service device, which can not only save labor costs, avoid errors and in-network failures caused by cumbersome operations when there are many Nginx servers, but also avoid a large amount of resource consumption by Nginx servers. In addition, the Nginx server can immediately sense whether the corresponding cache service device is unavailable during the corresponding detection period of sending the liveness request, but the cache service corresponding to the current liveness cycle of the cache service device will not be taken offline, but will be actually stopped after all Nginx servers have performed the offline process and no longer receive user resource requests. Therefore, during the entire liveness detection process of multiple Nginx servers, the quality of customer service will not be affected, and the operation corresponding to the target request can be completed without loss, thereby ensuring that the entire CDN system continuously provides stable services.

[0058] Next, in conjunction with Figure 3 the cache service processing method of the second embodiment of the present application will be described. The method of this embodiment is applied to a target Nginx server in the CDN system, and the target Nginx server is any one of the multiple Nginx servers.

[0059] As Figure 3 shown, the method of this embodiment includes the following steps 202 to 206.

[0060] Step 202: Send liveness probes to multiple cache service devices in the CDN system according to the liveness probe period, so that each cache service device responds to the liveness probe request and determines whether the liveness indication file corresponding to the target cache service in each cache service device has been deleted. The liveness indication file is used for the target Nginx server to perform liveness detection on multiple cache service devices, and a liveness probe request is sent once per liveness probe period.

[0061] Multiple Nginx servers in the CDN system will respectively send liveness probe requests to multiple cache service devices deployed in their respective nodes. The cache service device that receives the corresponding liveness probe request will determine whether the locally created liveness indication file corresponding to the target cache service has been deleted. The target Nginx server will send liveness probe requests to each cache service device according to the preset liveness probe period. For example, if the liveness probe period for any cache service device is 10 seconds, then a liveness probe request will be sent to each cache service device every 10 seconds.

[0062] For the description of the liveness indication file and the response of the cache service device to the liveness probe request, reference can be made to the corresponding content in the first embodiment, which will not be elaborated here.

[0063] Step 204: Receive the liveness probe failure response sent by the target cache service device in the multiple cache service devices when it determines that the liveness indication file has been deleted.

[0064] If the target cache service device queries and determines that the local liveness indication file has been deleted, it means that the target cache service device needs to take the corresponding cache service offline. After the target Nginx server receives the liveness probe failure response, it considers the target cache service device to be unavailable at present. Of course, at this time, the target cache service device does not actually directly stop providing the cache service. Before all Nginx servers send liveness probe requests and receive liveness probe failure responses, the target cache service device still provides services normally.

[0065] Step 206: If the target cache service device continuously sends liveness probe failure responses in multiple liveness probe periods, delete the target cache service device from the list of available cache service devices, where the target Nginx server is used to map the user resource requests of the CDN system to the corresponding cache service devices according to the list of available cache service devices.

[0066] The target cache service device may send incorrect liveness probe failure responses due to occasional phenomena when responding to liveness probe requests. To avoid this situation, in this embodiment, it is proposed that if the target cache service device continuously sends liveness probe failure responses in multiple liveness probe periods, it is truly determined that the target cache service device is unavailable, and then the target cache service device is deleted from the list of available cache service devices.

[0067] For the description of the Nginx server deleting the target cache service device from the list of available cache service devices and mapping user resource requests, reference may be made to the corresponding content in the first embodiment, which will not be elaborated here.

[0068] Optionally, after deleting the target cache service device from the list of available cache service devices, it further includes: sending a liveness probe request to the target cache service device according to the liveness probe period; receiving a liveness probe success response sent by the target cache service device when it determines that the liveness indication file has not been deleted; if the target cache service device continuously sends liveness probe success responses in multiple liveness probe periods, adding the target cache service device to the list of available cache service devices.

[0069] The Nginx server continuously sends liveness probe requests to all cache service devices deployed by the nodes. If the target cache service device restarts and creates a liveness indication file locally, it means that the target cache service device can currently provide cache services normally and the cache service is pending online. At this time, the target cache service device responds to the liveness probe request, queries the locally created liveness indication file, and sends a liveness probe success response to the corresponding Nginx server. Thus, the Nginx server determines that the target cache service device is currently available.

[0070] The target cache service device may send an incorrect liveness probe success response due to occasional phenomena when responding to the liveness probe request. To avoid this situation, in this embodiment, it is proposed that if the target cache service device continuously sends liveness probe success responses in multiple liveness probe periods, then it is truly determined that the target cache service device is available, and then the target cache service device is re-added to the list of available cache service devices.

[0071] For the description of the Nginx server adding the target cache service device to the list of available cache service devices, reference may be made to the corresponding content in the first embodiment, which will not be elaborated here.

[0072] In order to implement the liveness indication file for the liveness probe detection of cache service devices by multiple Nginx servers in the CDN system, it is necessary to pre-configure each Nginx server.

[0073] Optionally, before sending the probing requests to multiple cache service devices in the CDN system according to the probing period, the following steps are further included: configuring the probing period; configuring the number of probing periods corresponding to continuously sending probing failure responses as a first quantity, and configuring the number of probing periods corresponding to continuously sending probing success responses as a second quantity, where the first quantity is greater than the second quantity; configuring the first response code for indicating a probing failure response received when the survival indication file is deleted, and configuring the second response code for indicating a probing success response received when the survival indication file is not deleted, and the first response code is different from the second response code; configuring the data packet of the probing request.

[0074] The configuration of the target Nginx server includes: 1. The probing period, which is used to configure the time interval for each Nginx server to send probing requests. The probing periods corresponding to different Nginx servers may be different, or the same Nginx server may configure different probing periods for different cache service devices. For example, probe once every 10 - 30 seconds. 2. Configure to consider the target cache service device unavailable when continuously receiving the first quantity of probing failure responses from the target cache service device, and the first quantity is, for example, 5 times; and configure to consider the target cache service device available when receiving the second quantity of probing success responses from the target cache service device, and the second quantity is, for example, 2 times. 3. Configure the first response code and the second response code, which specifically correspond one-to-one with the first response code and the second response code configured by the target cache service device in the first embodiment, so that the availability of the target cache service can be determined based on the first response code and the second response code. 4. Configure the data packet of the probing request sent.

[0075] The following is the code embodiment corresponding to the above configuration: upstream cacheserver_args{ # Probing period check interval=10000 rise=2 fall=5 timeout=3000 type=http; # The expected response code is 2xx or 3xx check_http_expect_alive http_2xx http_3xx; # Send the probing data packet, and the domain name is heartbeat

[0076] # Hash algorithm hash $uri consistent; # List of all cache service devices include upstream_list;} In an embodiment of the present application, the Nginx server sends a liveness probe request to multiple cache service devices in the CDN system according to the liveness probe period, so that each cache service device responds to the liveness probe request to determine whether the survival indication file corresponding to the target cache service in each cache service device is deleted. The survival indication file is used for the target Nginx server to perform liveness detection on multiple cache service devices, and a liveness probe request is sent once in a liveness probe period; receive a liveness probe failure response sent by the target cache service device among the multiple cache service devices when it determines that the survival indication file is deleted; if the target cache service device continuously sends liveness probe failure responses in multiple liveness probe periods, then delete the target cache service device from the list of available cache service devices. Among them, the target Nginx server is used to map the user resource request of the CDN system to the corresponding cache service device according to the list of available cache service devices. Thus, the unavailability of the cache service of the target cache service device can be mapped from the unavailability of the overall process to the state of whether a survival indication file exists. By deleting the survival indication file, it is possible to simply, quickly, and automatically perform effective lossless offline of the cache service of the target cache service device only by deleting the survival indication file of the target cache service device. This not only saves labor costs and avoids errors and in-network failures caused by cumbersome operations when there are many Nginx servers, but also avoids a large amount of resource consumption by the Nginx server. In addition, the Nginx server can immediately sense whether the corresponding cache service device is unavailable during the corresponding detection period when sending the liveness probe request. However, the cache service corresponding to the current liveness probe period of the cache service device will not be offline, but will actually stop the corresponding cache service after all Nginx servers have performed offline processing and no longer receive user resource requests. Therefore, during the entire liveness detection process of multiple Nginx servers, the quality of customer service will not be affected, and the operations corresponding to the target requests can be completed without loss, thus ensuring that the entire CDN system continuously provides stable services.

[0077] Next, the CDN cache service processing method of the embodiment of the present application will be described in combination with Figure 1 the application scenario of. As Figure 1 shown, it includes the following steps: Step 1. For the user resource requests sent by at least one user 10, the LVS device 20 performs a traffic allocation operation and maps the user resource request R1 to ATS.5; Step 2. When ATS.5 receives the target request, such as a request for service upgrade, it deletes the locally created corresponding survival indication file; Step 3. After the survival indication file is deleted, throughout the liveness probe configuration of the entire service process, ATS.5 fails to respond to the liveness probe request of Nginx; Step 4: After Nginx senses the failure of the liveness probe, it actively deletes ATS.5 from the list of available cache service devices, and remaps the user resource request R1 to ATS.4. Subsequent user resource requests will be mapped to ATS.1 to ATS.4; Step 5: After all Nginx senses the failure of the liveness probe of ATS.5 and deletes it from the list of available cache service devices, perform a service upgrade on ATS.5.

[0078] Next, further combine Figure 4 the example of Figure 1 to describe the CDN cache service processing method of the embodiment of the present application. In this embodiment, the four-layer load balancer corresponds to Figure 1 the LVS device 20, and the seven-layer access A, seven-layer access B, and seven-layer access C correspond to Figure 1 the Nginx server 30, and the cache service A, cache service B, and cache service C correspond to

[0079] In Figure 4 this embodiment of

[0080] When it is necessary to take cache service B offline or restart it, the following steps are included: receive the requirement to take cache service B offline (i.e., receive the target request), and delete the corresponding alive file (i.e., the liveness indication file). When the alive file of cache service B is deleted, it is impossible to return a correct HTTP liveness probe data packet to the seven-layer access A, seven-layer access B, and seven-layer access C. For example, the seven-layer access A, seven-layer access B, and seven-layer access C receive a 404 response code indicating the failure of the liveness probe.

[0081] The seven-layer access A, seven-layer access B, and seven-layer access C continue to send liveness probe requests according to the liveness probe cycle for simple and quick retries. After a preset number of liveness probe cycles, it can be confirmed that the service of cache service B is unavailable. The seven-layer access A, seven-layer access B, and seven-layer access C automatically schedule the bandwidth traffic of cache service B (i.e., the user resource request) to cache service A and cache service C to ensure that the subsequent upgrade of cache service B will not affect the customer service quality.

[0082] Seven - layer access A, seven - layer access B, and seven - layer access C receive HTTP probing packets indicating successful probing within a short period, and consider that the cache service B has started. Then, they add cache service B to the list of available cache service devices. Cache service B receives normal user resource requests within a short period and realizes a complete bandwidth cut - back.

[0083] Optionally, as Figure 5 shown, an embodiment of the present application further provides a CDN cache service processing device 1000, which is applied to a target cache service device in a CDN system. The device includes: A deletion module 1200, configured to delete a survival indication file corresponding to a target cache service in the target cache service device in response to a target request, where the target request is for stopping the target cache service, and the survival indication file is used for probing detection of the target cache service device by multiple Nginx servers in the CDN system; A sending module 1400, configured to send a probing failure response to a target Nginx server when receiving a target probing request sent by the target Nginx server among the multiple Nginx servers after deleting the survival indication file, so as to instruct the target Nginx server to delete the target cache service device from the list of available cache service devices. Each Nginx server is used to map user resource requests of the CDN system to corresponding cache service devices according to the list of available cache service devices; An execution module 1600, configured to perform an operation corresponding to the target request if no user resource request is received within a preset time.

[0084] The CDN cache service processing device provided by the embodiments of this specification can implement Figure 2 each process implemented by the method embodiments. To avoid repetition, details are not described here again.

[0085] Optionally, as Figure 6 shown, an embodiment of the present application further provides a CDN cache service processing device 2000, which is applied to a target Nginx server in a CDN system. The device includes: A sending module 2200, configured to send probing requests to multiple cache service devices in the CDN system according to a probing period, so that each cache service device responds to the probing request to determine whether a survival indication file corresponding to a target cache service in each cache service device is deleted. The survival indication file is used for probing detection of multiple cache service devices by the target Nginx server, and a probing request is sent once per probing period; A receiving module 2400, configured to receive a probing failure response sent by a target cache service device among the multiple cache service devices when determining that the survival indication file is deleted; A deletion module 2600 is configured to delete the target cache service device from the list of available cache service devices if the target cache service device continuously sends probing failure responses in multiple probing cycles, where the target Nginx server is configured to map user resource requests of the CDN system to corresponding cache service devices according to the list of available cache service devices.

[0086] The CDN cache service processing device provided by the embodiments of this specification can implement Figure 3 each process implemented by the method embodiments. To avoid repetition, details are not described here again.

[0087] Optionally, as Figure 7 shown, an embodiment of the present application further provides a CDN cache service processing system 100, including multiple cache service devices 40 and multiple Nginx servers 30. Each cache service device 40, when executed, implements the steps of the method described in the first embodiment above. Each Nginx server 30, when executed, implements the steps of the method described in the second embodiment above.

[0088] Optionally, as Figure 8 shown, an embodiment of the present application further provides a CDN cache service processing device 3000, including a processor 3400 and a memory 3200. A program or instruction that can run on the processor 3400 is stored on the memory 3200. When the program or instruction is executed by the processor 3400, it implements each step of the CDN cache service processing method embodiment above, and can achieve the same technical effect. To avoid repetition, details are not described here again.

[0089] An embodiment of the present application further provides a readable storage medium. A program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, it implements each process of any one of the CDN cache service processing method embodiments above, and can achieve the same technical effect. To avoid repetition, details are not described here again. Among them, the readable storage medium includes computer-readable storage media, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0090] An embodiment of the present application further provides a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program. The computer program can be operated to cause a computer to implement each process of any one of the CDN cache service processing method embodiments above, and can achieve the same technical effect. To avoid repetition, details are not described here again.

[0091] It should be noted that in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or device comprising such element.

[0092] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present application.

[0093] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them fall within the protection scope of the present application.

Claims

1. A CDN cache service processing method, characterized in that: A target cache service device applied to a CDN system, the method comprising: In response to a target request, deleting a survival indication file corresponding to a target cache service in the target cache service device, wherein the target request requires stopping the target cache service, and the survival indication file is used for liveness detection of the target cache service device by multiple Nginx servers in the CDN system; When receiving a target liveness detection request sent by a target Nginx server among the multiple Nginx servers after deleting the liveness indication file, sending a liveness detection failure response to the target Nginx server to instruct the target Nginx server to delete the target cache service device from the list of available cache service devices, wherein each Nginx server is used to map the user resource request of the CDN system to the corresponding cache service device according to the list of available cache service devices; If no user resource request is received within the preset time, the operation corresponding to the target request is executed.

2. The method according to claim 1, characterized in that: After executing the operation corresponding to the target request, the method further includes: Restarting the target cache service device and creating the survival indication file locally; When a target liveness request is received from a target Nginx server among the multiple Nginx servers after the liveness indication file is created, a liveness success response is sent to the target Nginx server to instruct the target Nginx server to add the target cache service device to the available cache service device list.

3. The method according to claim 1 or 2, characterized in that: Before deleting the survival indication file corresponding to the target cache service in the target cache service device in response to the target request, the method further includes: Creating a survival indication file corresponding to the target cache service locally on the target cache service device and defining a name of the survival indication file; Configure a liveness detection configuration on the target cache service device, the liveness detection configuration corresponds to the liveness detection, and is used to perform liveness detection of the target cache service device by multiple Nginx servers by mapping the liveness detection request to finding whether the survival indication file of the name is deleted; A first response code used for sending a successful detection of liveness response and a successful detection of liveness response when the survival indication file of the name is not deleted is configured, and a second response code used for sending a failed detection of liveness response and a failed detection of liveness response is configured when the survival indication file of the name is deleted; Configures the plugin code used to find out whether a liveness indicator file of the said name has been deleted.

4. The method according to claim 3, characterized in that When receiving a target liveness detection request sent by a target Nginx server among the multiple Nginx servers after deleting the liveness indication file, sending a liveness detection failure response to the target Nginx server includes: Mapping the target liveness request of the target Nginx server to the liveness configuration of the target cache service device; Based on the live detection configuration, searching, by the plug-in code, on the target cache service device whether there is a live indication file with the name; Based on the search result that the survival indication file with the name does not exist, a detection failure response is sent to the target Nginx server.

5. A CDN cache service processing method, characterized in that: Applied to a target Nginx server in a CDN system, the method comprises: Send a live detection request to multiple cache service devices in the CDN system according to the live detection cycle, so that each cache service device responds to the live detection request and determines whether the survival indication file corresponding to the target cache service in each cache service device is deleted. The survival indication file is used by the target Nginx server to detect the liveness of multiple cache service devices. The live detection request is sent once in one live detection cycle; receiving a detection failure response sent by a target cache service device among the multiple cache service devices when determining that the survival indication file is deleted; If the target cache service device continuously sends a detection failure response in multiple detection cycles, the target cache service device is deleted from the list of available cache service devices, wherein the target Nginx server is used to map the user resource request of the CDN system to the corresponding cache service device according to the list of available cache service devices.

6. The method according to claim 5, characterized in that After deleting the target cache service device from the list of available cache service devices, the method further includes: Sending a liveness detection request to the target cache service device according to the liveness detection cycle; receiving a live detection success response sent by the target cache service device when determining that the live indication file has not been deleted; If the target cache service device continuously sends a successful detection response in multiple detection cycles, the target cache service device is added to the available cache service device list.

7. The method according to claim 6, characterized in that Before sending the live detection request to the multiple cache service devices in the CDN system according to the live detection cycle, the method further includes: Configuring the detection period; Configure a first number of multiple probe cycles corresponding to consecutively sending probe failure responses, and configure a second number of multiple probe cycles corresponding to consecutively sending probe success responses, wherein the first number is greater than the second number; When the survival indication file is configured to be deleted, a first response code indicating a failed detection response is received, and when the survival indication file is configured not to be deleted, a second response code indicating a successful detection response is received, and the first response code is different from the second response code; Configure the packet of the liveness request.

8. A CDN cache service processing device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 4 or any one of claims 5 to 7 are implemented.

9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 4 or any one of claims 5 to 7 are implemented.

10. A computer program product, characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute the steps of the method according to any one of claims 1 to 4 or any one of claims 5 to 7.