Request processing method, apparatus, device, and medium
By using time difference and switching buffer duration to determine whether a request meets the switching conditions during internet request processing, a smooth switching of request processing methods is achieved. This solves the node anomaly problem caused by sudden changes in processing methods in existing technologies, and improves system stability and bandwidth management for CDN live streaming services.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2024-06-11
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies struggle to smoothly switch processing methods when handling requests over the internet, leading to node processing anomalies and poor stability. This is especially true in CDN live streaming services, where the scheduling bandwidth for cold stream requests can easily surge, impacting system stability.
By obtaining the time difference between the request time and the switching processing trigger time, and combining it with the switching buffer duration, we can accurately determine whether the requests to be processed meet the switching conditions, and gradually and smoothly switch the processing method to avoid a sudden increase in the number of requests.
It enables a smooth switching of request processing methods, improves system stability and accuracy, reduces node processing anomalies, optimizes bandwidth changes for CDN live streaming services, and enhances system fault tolerance and data quality.
Smart Images

Figure CN118632082B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computers, specifically to the fields of cloud computing and media cloud technology, and particularly to a request processing method, apparatus, device, and medium. Background Technology
[0002] On the Internet, servers handle a large number of requests.
[0003] In recent years, people have been exchanging documents such as news, comments, and articles through the internet.
[0004] However, some documents are riddled with factual errors, necessitating factual error detection to reduce the dissemination of erroneous information online. Summary of the Invention
[0005] This disclosure provides a request processing method, apparatus, device, and medium.
[0006] According to one aspect of this disclosure, a request processing method is provided, comprising:
[0007] Get the request time of the pending requests;
[0008] Get the switching trigger time and the switching buffer duration;
[0009] Calculate the time difference between the switching process trigger time and the request time;
[0010] Based on the switching buffer duration and the time difference, it is detected whether the request to be processed meets the processing switching conditions;
[0011] When the pending request meets the processing switching conditions, the pending request is processed using the target processing method after the switch.
[0012] According to one aspect of this disclosure, a request processing apparatus is provided, comprising:
[0013] The request time acquisition module is used to obtain the request time of the request to be processed;
[0014] The switching time acquisition module is used to acquire the switching processing trigger time and the switching buffer duration;
[0015] The switching duration calculation module is used to calculate the time difference between the switching processing trigger time and the request time;
[0016] The request switching detection module is used to detect whether the request to be processed meets the processing switching conditions based on the switching buffer duration and the time difference.
[0017] The processing mode switching module is used to process the request to be processed using the target processing mode after switching when the request to be processed meets the processing switching conditions.
[0018] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0019] At least one processor; and
[0020] A memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the request processing method described in any embodiment of this disclosure.
[0022] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the request processing method described in any embodiment of this disclosure.
[0023] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the request processing method described in any embodiment of this disclosure.
[0024] The embodiments disclosed herein can enable a smooth switching of request processing methods.
[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0026] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0027] Figure 1 This is a flowchart of a request processing method disclosed in an embodiment of the present disclosure;
[0028] Figure 2 This is a flowchart of another request processing method disclosed according to an embodiment of this disclosure;
[0029] Figure 3 This is a flowchart of another request processing method disclosed according to an embodiment of this disclosure;
[0030] Figure 4 This is a scenario diagram of a request processing method disclosed in an embodiment of this disclosure;
[0031] Figure 5This is a schematic diagram of the structure of the request processing apparatus disclosed in accordance with embodiments of the present disclosure;
[0032] Figure 6 This is a block diagram of an electronic device according to the request processing method disclosed in the embodiments of this disclosure. Detailed Implementation
[0033] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0034] Figure 1 This is a flowchart of a request processing method disclosed in an embodiment of this disclosure. This embodiment can be applied to situations where it is necessary to switch the processing method of a request. The method of this embodiment can be executed by a request processing device, which can be implemented in software and / or hardware, and specifically configured in an electronic device with a certain data processing capability, such as a server device.
[0035] S101. Obtain the request time of the pending request.
[0036] The request time can refer to the current time when the request to be processed is being processed. In a node cluster, multiple nodes handle a large number of processing requests. A node can be a server or a microservice. Optionally, a node can be a node in a Content Delivery Network (CDN). The request to be processed can be data transmitted in the CDN. For example, the request to be processed can be a resource retrieval request, such as a request to retrieve a live stream.
[0037] S102. Obtain the switching processing trigger time and the switching buffer duration.
[0038] The switching trigger time can refer to the time at which the switching of request processing operations is triggered. The switching buffer duration can refer to the duration from the start of switching the processing operations of each request to the completion of switching the processing operations of each request. Typically, existing triggering of switching processing operations will switch the processing operations of all requests that need to be switched to the target processing operation. In the embodiments of this disclosure, starting from the switching processing trigger time, a portion of the request processing operations are selected for switching, and the number of selected requests increases over time until all the processing operations of the requests that need to be switched are switched to the target processing operation.
[0039] S103. Calculate the time difference between the switching process trigger time and the request time.
[0040] The time difference refers to the duration between the start time of the processing operation and the current time. The time difference is used to determine the number of requests that require a processing operation switch. In practice, the number of requests requiring a switch increases over time. Based on the time difference, the number of requests requiring a switch at the current time can be determined, and based on the number, it can be determined whether a pending request belongs to the category of requests requiring a processing operation switch.
[0041] S104. Based on the switching buffer duration and the time difference, detect whether the request to be processed meets the processing switching conditions.
[0042] The switching condition refers to the criteria used to determine whether the processing operation of a pending request should be switched. The switching buffer duration can be understood as the total time required for all requests requiring switching to complete the switch, and the time difference can be understood as the current switching progress. Specifically, the switching condition can be determined by checking if the ratio between the pending request and the switching buffer duration is less than the time difference; if it is less than or equal to, the pending request meets the switching condition; if it is greater, the pending request does not meet the switching condition.
[0043] S105. When the pending request meets the processing switching conditions, the pending request is processed using the switched target processing method.
[0044] A pending request meeting the processing switch condition indicates that the pending request can be switched from the current processing method to the target processing method. The processing method of the pending request is switched from the original processing method to the target processing method. For example, the processing method of the pending request is switched from local scheduling (i.e., non-302 scheduling) to 302 scheduling. Another example is that the processing method of the pending request is switched from processing by node A to processing by node B. Yet another example is that the processing method of the pending request is switched from processing by a first optimization strategy to processing by a second optimization strategy, where the first optimization strategy can be load balancing processing and the second optimization strategy can be normal processing, i.e., non-load balancing processing. Furthermore, in the above examples, the contents of the original processing method and the target processing method can be interchanged.
[0045] According to the technical solution of this disclosure, by obtaining the request time of the request to be processed and calculating the time difference between the switching processing trigger time and the request time, the progress of the request to be processed in the switching process is determined based on the switching buffer duration and the time difference, thereby determining whether the request to be processed needs to switch processing methods. It is possible to determine whether to switch processing methods for each request individually, thereby improving the fine granularity of processing method switching. At the same time, it is possible to precisely control the smooth growth of the number of switching requests, reduce the node processing anomalies caused by a sudden increase in the number of switching requests, and improve the stability and accuracy of the request processing system.
[0046] Figure 2 This is a flowchart of another request processing method disclosed in this disclosure, which is further optimized and extended based on the above technical solution and can be combined with the above optional implementation methods. The steps include: obtaining a request value; taking the modulo of the switching buffer duration based on the request value to obtain a modulo result; comparing the modulo result with the time difference; and determining that the request to be processed meets the processing switching conditions when the modulo result is less than or equal to the time difference.
[0047] S201. Obtain the request time of the pending request.
[0048] S202. Obtain the switching processing trigger time and the switching buffer duration.
[0049] S203. Calculate the time difference between the switching process trigger time and the request time.
[0050] S204. Get the requested value.
[0051] The request value represents the request to be processed. The request value can be a numerical value corresponding to the request. In practice, the request is mapped to a numerical space to obtain the request value. Different requests can have the same or different request values. The request value can be a random number or determined based on the identifier of the request.
[0052] Optionally, obtaining the request value includes: obtaining the identification information of the request to be processed; and calculating the identification information to obtain the request value.
[0053] Identification information is used to identify requests awaiting processing. For example, requests from different users may have different identification information. Similarly, requests from different resources may have different identification information. However, different servers may calculate the same request value for the same identifier. By using the same algorithm to calculate the identification information, different servers can achieve the same request value for the same identifier.
[0054] For example, a hash algorithm can be used to calculate the hash value of the request stream name, which is then used as the request value. The hash algorithm can be CRC32 or other hash algorithms.
[0055] In a specific example, the request to be processed is a request for a live stream. The identification information of different live stream requests is different, that is, the identification information is used to identify different live rooms.
[0056] By calculating the request value based on the identifier of the request to be processed, the same request can be calculated to have the same request value. This ensures that the processing method for the same request is consistent with the judgment result, thereby reducing service performance anomalies caused by inconsistent request processing methods.
[0057] S205. The switching buffer duration is moduloed according to the requested value to obtain the modulo result.
[0058] The modulo result is used to represent the request to be processed.
[0059] S206. Compare the modulus result with the time difference.
[0060] S207. When the modulus result is less than or equal to the time difference, it is determined that the request to be processed meets the processing switching condition.
[0061] If the modulo result is less than or equal to the time difference, the request to be processed is determined to meet the processing switching conditions; if the modulo result is greater than the time difference, the request to be processed is determined not to meet the processing switching conditions.
[0062] In practice, the switching buffer duration provides a buffer period during which the number of requests requiring mode switching gradually increases until it reaches a peak, which can be the total number of requests needing mode switching. That is, within this period, the processing mode of some requests switches, and the number of requests eligible for switching gradually increases. After this period, the processing mode of all requests switches. When the time difference is greater than the switching buffer duration, it indicates that the request time is after the buffer period; in this case, any request requiring mode switching switches. When the time difference is less than the switching buffer duration, it indicates that the request time is within the buffer period; in this case, only some requests need mode switching. Taking any value modulo the switching buffer duration will always result in a value less than the time difference. Therefore, by comparing the modulo result with the time difference, it is possible to precisely switch the processing mode of some requests requiring mode switching within the buffer period, and after the buffer period, switch the processing mode of all requests requiring mode switching. Furthermore, the time difference gradually increases with the increase of request time. The closer the time difference is to the switching buffer duration, the more requests the modulo result is less than the time difference. As a result, the more requests meet the switching conditions, thus the number of requests that meet the switching conditions increases with the increase of time.
[0063] S208. When the pending request meets the processing switching conditions, the pending request is processed using the switched target processing method.
[0064] Optionally, the request processing method further includes: when the modulo result is greater than the time difference, determining that the request to be processed does not meet the processing switching conditions; when the request to be processed does not meet the processing switching conditions, processing the request to be processed using the original processing method before the switching.
[0065] The original processing method can refer to the processing method that has not been switched. By setting a condition that requests with a modulo result greater than the time difference do not meet the processing switching condition, some requests will not undergo processing method switching. This can slow down the growth of the number of requests that are switching, achieving a smooth growth in the number of switched requests, thereby improving the accuracy and speed of request processing.
[0066] According to the technical solution disclosed herein, the request value is moduloed with the switching buffer duration, and the modulo result is compared with the time difference. Based on the comparison result, it is determined whether the request to be processed meets the switching conditions. When the time difference gradually approaches the switching buffer duration, the number of requests that need to switch processing methods can be increased. When the time difference is greater than the switching buffer duration, all requests that need to switch processing methods are processed and their processing methods are switched. This achieves that the processing methods of requests that need to be switched are gradually switched over time, and finally, all requests that need to be switched are processed and their processing methods are switched, achieving smooth switching at the request granularity.
[0067] Figure 3 This is a flowchart of another request processing method disclosed in the embodiments of this disclosure, which is further optimized and extended based on the above technical solution, and can be combined with the above optional implementation methods. The step of obtaining the request time of the request to be processed is specifically defined as follows: receiving a streaming request; detecting whether the streaming request is a cold streaming request; if the streaming request is a cold streaming request, determining the streaming request as a request to be processed; obtaining the request time of the request to be processed; and the step of processing the request to be processed using the switched target processing method is specifically defined as: forwarding the request to be processed to the cold streaming centralized node for processing using a 302 scheduling method.
[0068] S301, Received a stream request.
[0069] Stream requests are used to request a data stream.
[0070] S302. Detect whether the stream request is a cold stream request.
[0071] Cold stream requests refer to stream requests with a low number of accesses. In contrast to hot stream requests, which are stream requests with a high number of accesses, cold stream requests can be used. Furthermore, switching can be performed based on region. For example, the current node checks if its region belongs to a specified area. If it does, it checks if the stream request is a cold stream request and whether it meets the switching conditions. If it does not belong to the specified area, the stream request is processed using the original method before the switch.
[0072] S303. When the stream request is a cold stream request, the stream request is determined as a request to be processed.
[0073] Requests are filtered to identify cold requests as pending requests and exclude hot requests from the pending requests. The processing method can be switched based on the switching of cold requests.
[0074] S304. Obtain the request time of the pending request.
[0075] S305. Obtain the switching processing trigger time and the switching buffer duration.
[0076] S306. Calculate the time difference between the switching process trigger time and the request time.
[0077] S307. Based on the switching buffer duration and the time difference, detect whether the request to be processed meets the processing switching conditions.
[0078] S308. When the pending request meets the processing switching conditions, the pending request is forwarded to the cold flow central node for processing using the 302 scheduling method.
[0079] The 302 scheduling method refers to a scheduling method that concentrates all cold flow requests on a single node for processing. A cold flow concentrator node is a node that centrally processes cold flow requests.
[0080] Optionally, the switching process trigger time includes: the specified processing mode switching start time or the specified processing mode switching end time.
[0081] The switching trigger time is the start time of the specified processing method switch. Accordingly, when a pending request meets the processing switching conditions, the processing method of the pending request is switched from a certain processing method to the specified processing method, for example, from the original processing method to the target processing method. At this time, the original processing method is a certain processing method, and the target processing method is the specified processing method. The time difference is the difference between the request time and the start time of the specified processing method switch.
[0082] The switching trigger time is the end time of the specified processing method switch. Accordingly, when a pending request meets the processing switching conditions, the processing method of the pending request is switched from the specified processing method to a certain processing method, such as switching from the original processing method to the target processing method. At this time, the original processing method is the specified processing method, and the target processing method is the certain processing method. The time difference is the difference between the request time and the end time of the specified processing method switch.
[0083] Here, the specified processing method differs from a certain processing method, and similarly, the original processing method differs from the target processing method. For example, the specified processing method is processing method A, and a certain processing method is processing method B. When the pending request meets the processing switching condition, the processing method of the pending request is switched from processing method B to processing method A, and vice versa.
[0084] By setting the switching trigger time to the start or end time of a specified processing method, the number of switching requests can be smoothly varied at both the start and end of a specified processing method, enabling smooth switching between the start and end of a specific processing method and enriching the scenarios for smooth switching.
[0085] Optionally, the streaming request includes: a live streaming data stream request.
[0086] Streaming requests can be either pull requests for live stream data or push requests for live stream data. Typically, streaming requests are pull requests for live stream data. By configuring streaming requests as live stream data requests, abrupt changes in processing methods, such as switching a large number of streaming requests to other methods, can be avoided in live streaming application scenarios. This allows for a smoother transition, improving the stability and fault tolerance of the live stream service system, as well as enhancing the data quality and transmission performance of the live stream.
[0087] In a specific example, the request processing method in this embodiment of the disclosure is executed by nodes in the CDN, particularly edge nodes. The request to be processed may refer to a cold stream request from a live stream. The processing method for the request to be processed may be switching from non-302 scheduling to 302 scheduling, or vice versa.
[0088] In current CDN live streaming services, due to differences in the number of followers of broadcasters and the diversity of live content, the concurrent playback volume of different live streams varies greatly, resulting in significant differences in their popularity (hotness / coldness). Cold streams have very few plays, but the edge nodes accessed still need to retrieve content from the origin server. Multiple edge nodes retrieving content from the origin server increases costs. Therefore, 302 redirection is needed to concentrate cold streams on a single node to reduce origin server costs. However, when 302 redirection is enabled, many cold streams are redirected to the same node within a short period, causing a sudden increase in bandwidth for the redirected domain and impacting service stability.
[0089] In practice, CDNs use different nodes in different regions. This means multiple different nodes need to centralize the same cold stream request to one or a few nodes. The same cold stream request can refer to a request for the same live stream. Since these different nodes are distributed in different regions and their upstream nodes are also different, it is difficult to centrally control the switching processing methods of these nodes for the same cold stream request. This embodiment of the disclosure, by independently determining whether a switching processing method is needed for each request, can precisely control the number of switches for the same cold stream request, achieving a smooth change in the number of switches for the same request.
[0090] In a specific example, the duration of smooth start (smooth_start) and smooth stop (smooth_end) is preset, such as 15 minutes to 30 minutes.
[0091] When a CDN node receives a flow request for a cold stream, it calculates a hash value based on the flow name.
[0092] Smooth Start-up:
[0093] Starting from the effective time (start) of the 302 scheduling mode, a smooth start verification is performed, which checks whether the cold flow request meets the processing switching conditions. The effective time is calculated as the time difference (local_time-start) between the switching processing trigger time (start) and the request time (local_time), in seconds. The calculated hash value is moduloed by the smooth start duration (in seconds). If the modulo value is less than or equal to the time difference (hash%smooth_start≤(local_time-start)), then the cold flow request is determined to meet the processing switching conditions, and the 302 scheduling logic is applied; otherwise, the cold flow request does not meet the processing switching conditions, and the stream is pulled locally directly.
[0094] For example, 302 scheduling is started at 12:00:00, the switching processing trigger time (start) is 12:00:00, the smooth start duration is 30 minutes, that is, the switching buffer duration is 30 minutes, or 1800 seconds.
[0095] The request time of a streaming request within 1 second is determined as the earlier endpoint time.
[0096] All stream requests made within 12:00:01 have a request time of 12:00:00 and a time difference of 0. Consequently, all stream requests made within 12:00:01 will not be subject to 302 scheduling.
[0097] Requests made between 12:00:01 and 12:00:02 have a request time of 12:00:01 and a time difference of 1. The hash value of the stream request is obtained and modulo 1800. If the modulo result is 1, the stream request is eligible for 302 scheduling, and subsequent 302 scheduling operations are executed. All other stream requests are not eligible for 302 scheduling.
[0098] For requests made between 12:00:02 and 12:00:03, with a request time of 12:00:02 and a time difference of 2, obtain the hash value of the stream request and take the modulo of 1800. If the modulo result is 1 or 2, the stream request is subject to 302 scheduling and subsequent 302 scheduling operations are executed. Other stream requests are not subject to 302 scheduling.
[0099] For requests made between 12:00:03 and 12:00:04, with a request time of 12:00:03 and a time difference of 3, the hash value of the stream request is obtained and modulo 1800 is taken. If the hash value is less than or equal to 3, the stream request is subject to 302 scheduling and subsequent 302 scheduling operations are performed. Other stream requests are not subject to 302 scheduling.
[0100] All cold flow requests will be scheduled using a 302 redirect after 30 minutes.
[0101] Smooth ending:
[0102] Similar to the smooth start verification, a smooth end verification is performed starting from the 302 effective end time (end), which checks whether the cold flow request meets the processing switchover conditions. The effective time (the time difference between the switchover trigger time (end) and the request time (local_time)) is calculated (local_time - end), with the time difference in seconds. The calculated hash value is moduloed by the smooth start duration (in seconds). If the modulo value is less than or equal to the time difference (hash % smooth_start ≤ (local_time - end)), the cold flow request is determined to meet the processing switchover conditions, the local pull operation is activated, and the 302 scheduling is switched from active to inactive. Otherwise, the cold flow request does not meet the processing switchover conditions, and the 302 scheduling operation is still executed.
[0103] For example, the 302 schedule ends at 20:00:00, the handover process trigger time (end) is 20:00:00, the smooth start duration is 30 minutes, that is, the handover buffer duration is 30 minutes, or 1800 seconds.
[0104] All stream requests within 20:00:01 have a request time of 20:00:00 and a time difference of 0. Consequently, all stream requests within 20:00:01 will not terminate and will be subject to 302 scheduling, meaning that 302 scheduling will be applied to all of them.
[0105] Requests made between 20:00:01 and 20:00:02 have a request time of 20:00:01 and a time difference of 1. The hash value of the stream request is obtained and modulo 1800. If the modulo result is 1, the stream request ends and a 302 scheduling error is applied, and the local stream pull operation is executed. All other stream requests are subject to 302 scheduling.
[0106] For requests made between 20:00:02 and 20:00:03, with a request time of 20:00:02 and a time difference of 2, obtain the hash value of the stream request and take it modulo 1800. If the modulo result is 1 or 2, the stream request ends and a 302 scheduler is applied, and the local stream pull operation is executed. All other stream requests are subject to the 302 scheduler.
[0107] For requests made between 20:00:03 and 20:00:04, with a request time of 20:00:03 and a time difference of 3, the hash value of the stream request is obtained and modulo 1800 is taken. If the modulo result hash value is less than or equal to 3, the stream request ends and a 302 scheduling is applied, and the local stream pull operation is executed. All other stream requests are subject to 302 scheduling.
[0108] After 30 minutes, all cold stream requests will be terminated with a 302 scheduler, and local streaming operations will be executed.
[0109] The final effect is as follows: during the period starting from the time the 302 is activated, the number of flows scheduled with 302 is increasing until all of them are finally activated; during the period starting from the time the 302 is deactivated, the number of flows deactivated with 302 is increasing until all of them are finally deactivated.
[0110] Through experiments, such as Figure 4 As shown, configuring smooth start-stop can refer to using the request processing method provided in the embodiments of this disclosure, while not configuring smooth start-stop can refer to not using the request processing method provided in the embodiments of this disclosure, that is, not configuring smooth start-stop can refer to the existing effective 302 scheduling method. Figure 4 In the diagram, the blue line at the top represents the bandwidth of the scheduled domain name over time during an effective 302 scheduling operation without smooth start / stop configuration, while the black line at the bottom represents the bandwidth of the scheduled domain name over time during an effective 302 scheduling operation with smooth start / stop configuration. Figure 4 The black line, which is configured with the request processing method provided in the embodiments of this disclosure, changes more smoothly in the start and end phases (i.e., the curved portion within the red box), while the blue line, which does not use the request processing method provided in the embodiments of this disclosure, is more abrupt, increasing sharply in the start phase and decreasing sharply in the end phase.
[0111] The 302 scheduling smooth start-stop algorithm enables the bandwidth to increase and / or decrease smoothly when the 302 function is started and / or stopped, avoiding the impact of sudden bandwidth changes on system stability and enhancing system stability.
[0112] According to the technical solution of this disclosure, by performing a switching judgment on cold flow requests, when a cold flow request meets the switching processing conditions, the cold flow request is forwarded to the cold flow central node for processing using the 302 scheduling method. This allows the bandwidth of the 302 scheduling function to change smoothly during switching, avoiding the impact of sudden bandwidth changes on the stability of the request processing system and enhancing the stability of the request processing system.
[0113] According to embodiments of this disclosure, Figure 5 This is a structural diagram of the request processing device in an embodiment of this disclosure. This embodiment is applicable to situations where it is necessary to switch the processing method of a request. The device is implemented in software and / or hardware and is specifically configured in an electronic device with certain data processing capabilities.
[0114] like Figure 5 The requested processing apparatus 500 shown includes: a request time acquisition module 501, a switching time acquisition module 502, a switching duration calculation module 503, a request switching detection module 504, and a processing mode switching module 505. Among them,
[0115] The request time acquisition module 501 is used to acquire the request time of the request to be processed.
[0116] The switching time acquisition module 502 is used to acquire the switching processing trigger time and the switching buffer duration;
[0117] The switching duration calculation module 503 is used to calculate the time difference between the switching processing trigger time and the request time.
[0118] The request switching detection module 504 is used to detect whether the request to be processed meets the processing switching conditions based on the switching buffer duration and the time difference.
[0119] The processing mode switching module 505 is used to process the request to be processed using the target processing mode after switching when the request to be processed meets the processing switching conditions.
[0120] According to the technical solution of this disclosure, by obtaining the request time of the request to be processed and calculating the time difference between the switching processing trigger time and the request time, the progress of the request to be processed in the switching process is determined based on the switching buffer duration and the time difference, thereby determining whether the request to be processed needs to switch processing methods. It is possible to determine whether to switch processing methods for each request individually, thereby improving the fine granularity of processing method switching. At the same time, it is possible to precisely control the smooth growth of the number of switching requests, reduce the node processing anomalies caused by a sudden increase in the number of switching requests, and improve the stability and accuracy of the request processing system.
[0121] Furthermore, the request switching detection module 504 includes:
[0122] The request value retrieval unit is used to retrieve the request value;
[0123] A buffer duration modulo unit is used to take the modulo of the switching buffer duration based on the request value to obtain the modulo result;
[0124] A time phase detection unit is used to compare the modulus result with the time difference;
[0125] The switching condition judgment unit is used to determine that the request to be processed meets the processing switching condition when the modulus result is less than or equal to the time difference.
[0126] Furthermore, the request value acquisition unit includes:
[0127] The identification information acquisition subunit is used to acquire the identification information of the request to be processed;
[0128] The request value calculation subunit is used to calculate the identification information to obtain the request value.
[0129] Furthermore, the request processing device further includes:
[0130] The non-switching judgment unit is used to determine that the request to be processed does not meet the processing switching condition when the modulus result is greater than the time difference value.
[0131] The original processing unit is used to process the request to be processed using the original processing method before the switch when the request to be processed does not meet the processing switching conditions.
[0132] Furthermore, the switching process trigger time includes: a specified processing mode switching start time or a specified processing mode switching end time.
[0133] Furthermore, the request time acquisition module 501 includes:
[0134] A stream request receiving unit is used to receive stream requests;
[0135] A cold flow determination unit is used to detect whether the flow request is a cold flow request;
[0136] A cold flow request acquisition unit is used to determine the flow request as a request to be processed when the flow request is a cold flow request;
[0137] The request time acquisition unit is used to acquire the request time of the request to be processed.
[0138] Accordingly, the processing mode switching module 505 includes:
[0139] The 302 scheduling switching unit is used to forward the pending request to the cold flow central node for processing using the 302 scheduling method.
[0140] Furthermore, the streaming request includes: a live streaming data stream request.
[0141] The above-described request processing apparatus can execute the request processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the request processing method.
[0142] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0143] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0144] Figure 6 A schematic area diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0145] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required by the instructions of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0146] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0147] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as request processing methods. For example, in some embodiments, the request processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the request processing method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform request processing methods by any other suitable means (e.g., by means of firmware).
[0148] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard objects (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0149] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / instructions specified in the flowcharts and / or area diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0150] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0151] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0152] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0153] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem that addresses the management difficulties and weak business scalability inherent in traditional physical hosting and VPS services. Servers can also be servers for distributed systems or servers integrated with blockchain technology.
[0154] Artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0155] Cloud computing refers to a technology system that provides access to a shared pool of physical or virtual resources via a network. These resources can include servers, instruction sets, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for applications such as artificial intelligence and blockchain, as well as for model training.
[0156] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution provided in this disclosure can be achieved, and this is not limited herein.
[0157] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A request processing method, comprising: Get the request time of the pending requests; Get the switching trigger time and the switching buffer duration; Calculate the time difference between the switching process trigger time and the request time; Based on the switching buffer duration and the time difference, it is detected whether the request to be processed meets the processing switching conditions; When the pending request meets the processing switching conditions, the pending request is processed using the target processing method after the switch. The step of detecting whether the request to be processed meets the processing switching conditions based on the switching buffer duration and the time difference includes: Get the requested value; The modulo operation is performed on the switching buffer duration based on the requested value to obtain the modulo result; Compare the modulus result with the time difference; When the modulus result is less than or equal to the time difference, it is determined that the request to be processed meets the processing switching condition.
2. The method according to claim 1, wherein, The process of obtaining the requested value includes: Obtain the identification information of the requests to be processed; The requested value is obtained by calculating the identification information.
3. The method according to claim 1, further comprising: When the modulus result is greater than the time difference, it is determined that the request to be processed does not meet the processing switching conditions; When the pending request does not meet the processing switching conditions, the original processing method before the switch is used to process the pending request.
4. The method according to claim 1, wherein, The switching process trigger time includes: the start time of the specified processing mode switching or the end time of the specified processing mode switching.
5. The method according to claim 1, wherein, The process of obtaining the request time for the pending request includes: A streaming request has been received. Detect whether the streaming request is a cold streaming request; When the stream request is a cold stream request, the stream request is determined as a request to be processed; Obtain the request time of the pending request; The step of processing the pending request using the switched target processing method includes: The pending requests are forwarded to the cold flow central node for processing using a 302 scheduling method.
6. The method according to claim 5, wherein, The streaming request includes: live streaming data stream request.
7. A request processing apparatus, comprising: The request time acquisition module is used to obtain the request time of the request to be processed; The switching time acquisition module is used to acquire the switching processing trigger time and the switching buffer duration; The switching duration calculation module is used to calculate the time difference between the switching processing trigger time and the request time; The request switching detection module is used to detect whether the request to be processed meets the processing switching conditions based on the switching buffer duration and the time difference. The processing mode switching module is used to process the request to be processed using the target processing mode after switching when the request to be processed meets the processing switching conditions. The request switching detection module includes: The request value retrieval unit is used to retrieve the request value; A buffer duration modulo unit is used to take the modulo of the switching buffer duration based on the request value to obtain the modulo result; A time phase detection unit is used to compare the modulus result with the time difference; The switching condition judgment unit is used to determine that the request to be processed meets the processing switching condition when the modulus result is less than or equal to the time difference.
8. The apparatus according to claim 7, wherein, The request value acquisition unit includes: The identification information acquisition subunit is used to acquire the identification information of the request to be processed; The request value calculation subunit is used to calculate the identification information to obtain the request value.
9. The apparatus according to claim 7, further comprising: The non-switching judgment unit is used to determine that the request to be processed does not meet the processing switching condition when the modulus result is greater than the time difference value. The original processing unit is used to process the request to be processed using the original processing method before the switch when the request to be processed does not meet the processing switching conditions.
10. The apparatus according to claim 7, wherein, The switching process trigger time includes: the start time of the specified processing mode switching or the end time of the specified processing mode switching.
11. The apparatus according to claim 7, wherein, The request time acquisition module includes: A stream request receiving unit is used to receive stream requests; A cold flow determination unit is used to detect whether the flow request is a cold flow request; A cold flow request acquisition unit is used to determine the flow request as a request to be processed when the flow request is a cold flow request; The request time acquisition unit is used to acquire the request time of the request to be processed. The processing mode switching module includes: The 302 scheduling switching unit is used to forward the pending request to the cold flow central node for processing using the 302 scheduling method.
12. The apparatus according to claim 11, wherein, The streaming request includes: live streaming data stream request.
13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the request processing method according to any one of claims 1-6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the request processing method according to any one of claims 1-6.
15. A computer program product comprising a computer program that, when executed by a processor, implements the request processing method according to any one of claims 1-6.
Citation Information
Patent Citations
Task processing method, device and electronic equipment
CN113867916A
Media information transmission method, computing device and storage medium
CN113973224A