Playback control management method, system, device and storage medium
The token bucket algorithm is used to limit the current flow of terminal requests, and combined with circular buffer technology, it solves the problem of reduced processing speed and accuracy of the existing system in high concurrency scenarios, achieves effective management and processing of terminal requests, and prevents The system is slow or down.
Patent Information
- Application Number
- CN202210589699.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-05-27
AI Technical Summary
The existing terminal broadcast control management system cannot effectively perform flexible restrictions under a large number of access requests, resulting in reduced processing speed and accuracy, and cannot cope with traffic emergencies.
The token bucket algorithm is used to limit the current flow of terminal requests, and the requests are stored in the circular queue of the circular buffer and processed through the Disruptor framework to avoid false overflow and resource waste.
It effectively prevents system slowdown or downtime caused by a sudden increase in terminal request traffic, improves the real-time performance and accuracy of data stream processing in high-concurrency scenarios, and avoids waste of queue space.
Smart Images

Figure CN115174485B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of playback control technology, and in particular to a playback control management method and system, device and storage medium. Background Art
[0002] The terminal broadcast control management system is a distributed operation architecture. The broadcast control management system server and various terminal systems (such as terminal boxes equipped with Android system) distributed in different locations form a terminal broadcast control network through the C / S structure. The broadcast control management system and the terminal system communicate with each other and transmit data through message services. The core of the entire system is the intelligent broadcast control management platform running in the data center. The broadcast control management platform is responsible for managing the information of all terminal devices or public smart screens distributed inside and outside the physical outlets in the system, realizing unified terminal monitoring, multimedia push, content arrangement, indicator interaction and other functions.
[0003] The existing terminal broadcast control management system uses high-quality encoding to transmit display data to the intelligent terminal through the network via HTTP / HTTPS protocol, and then the terminal converts the combined multimedia information into video signals for display terminals (such as LCD, plasma, and TV) for broadcast. The system provides a unified open system interface. For high-concurrency application scenarios, the system will provide a current limiting and fuse processing mechanism at the entrance to ensure stable remote centralized management and real-time updates of published content.
[0004] However, due to the characteristics of the broadcast control system, the time periods for the terminal devices or large-screen devices supported by the broadcast control system to obtain data are relatively concentrated. The existing system is unable to flexibly limit access traffic when new terminal devices are continuously added, resulting in a significant reduction in processing speed and accuracy under a large number of access requests. Summary of the invention
[0005] In view of this, the present disclosure proposes a playback control management method and system, a device and a storage medium to ensure that a large number of terminal system requests within a certain period of time will not cause slow access to the entire system.
[0006] According to one aspect of the present disclosure, a playback control management method is provided, including:
[0007] Obtaining terminal requests sent by each terminal system, and allocating a token to each terminal request;
[0008] After the terminal request is allocated to the token, storing the terminal request in a circular queue in a circular buffer;
[0009] Each terminal request in the circular queue is processed so that each terminal request obtains the corresponding target data, and returns the requested completed data to the corresponding terminal system.
[0010] In a possible implementation, when allocating a token to each terminal request, it is performed based on a token bucket algorithm.
[0011] In a possible implementation manner, when the terminal request is not allocated the token, an operation of refusing to process the terminal request is performed.
[0012] In a possible implementation, when the terminal request is stored in a circular queue in a circular buffer, the terminal request is converted into an event to be consumed based on a Disruptor framework.
[0013] In a possible implementation, the server platform processes each terminal request in the circular queue so that each terminal request obtains corresponding target data, including:
[0014] According to the type of each terminal request, the server platform reads the corresponding target data and sends the target data to the corresponding terminal system.
[0015] In a possible implementation manner, the type of the terminal request includes at least one of an independent request and a common request.
[0016] According to another aspect of the present application, a playback control management system is provided, comprising a current limiting module and a circular buffer module;
[0017] The current limiting module is configured to obtain terminal requests sent by each terminal system and allocate a token to each terminal request;
[0018] The circular buffer module is configured to obtain the terminal request of the token and store the terminal request in the circular queue. According to each terminal request, the server platform reads the corresponding target data and sends the target data to the corresponding terminal system.
[0019] In a possible implementation, the current limiting module allocates tokens to each terminal request based on a token bucket algorithm.
[0020] According to another aspect of the present application, a playback control management device is provided, including:
[0021] processor;
[0022] a memory for storing processor-executable instructions;
[0023] Wherein, the processor is configured to implement the method described in any one of claims 1 to 6 when executing the executable instructions.
[0024] According to another aspect of the present application, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, any of the above-mentioned methods is implemented.
[0025] The playback management method of the disclosed embodiment distributes tokens to the terminal requests sent by the terminal system, and decides whether to receive and process the terminal requests according to the result of the tokens distributed to the terminal requests when processing the terminal requests, thereby achieving the purpose of limiting the terminal requests sent by each terminal system, which effectively prevents the problem of slow operation or downtime of the subsystem due to the sudden increase in terminal request traffic. At the same time, when processing terminal requests, combined with the circular message queue technology, the server platform processes each terminal request in the circular list according to each terminal request stored in the circular queue, so that each terminal request obtains the corresponding target data, and returns the data completed by the request to the corresponding terminal system. Compared with the traditional message queue, storing the terminal request in the circular queue can effectively avoid the false overflow phenomenon and can fully reuse the queue space.
[0026] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0028] Figure 1 A flowchart showing a playback control management method according to an embodiment of the present disclosure;
[0029] Figure 2 A schematic diagram showing a playback control management method according to an embodiment of the present disclosure;
[0030] Figure 3 A schematic diagram showing a token bucket algorithm according to an embodiment of the present disclosure is shown;
[0031] Figure 4 A schematic diagram showing two consumption modes in a circular buffer according to an embodiment of the present disclosure;
[0032] Figure 5 A main structure diagram of the playback control management system according to an embodiment of the present disclosure is shown;
[0033] Figure 6 A main structure diagram of the playback control management device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0034] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0035] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0036] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0037] It should be noted that the method of the embodiment of the present disclosure is mainly used to process terminal requests (such as data playback requests) sent by multiple terminal systems connected to the terminal broadcast control management system. In particular, when there are large-traffic and high-concurrency terminal requests, the terminal broadcast control management system can still respond to the terminal requests in a timely manner, thereby preventing the system from running slowly or crashing due to a surge in terminal request traffic.
[0038] Figure 1 A flowchart of a playback control management method according to an embodiment of the present disclosure is shown. Figure 2 A schematic diagram of a playback control management method according to an embodiment of the present disclosure is shown. Figure 3 A schematic diagram of a token bucket algorithm according to an embodiment of the present disclosure is shown. Figure 4 A schematic diagram showing two consumption modes in a circular buffer according to an embodiment of the present disclosure is shown. Figure 5 A main structure diagram of a playback control management system according to an embodiment of the present disclosure is shown. Figure 6 FIG. 2 shows a main structure diagram of a playback control management device according to an embodiment of the present disclosure. Figure 1 As shown, the playback control management method includes: Step S100: obtaining terminal requests sent by each terminal system and allocating tokens to each terminal request. Step S200: after the terminal request is allocated with a token, the terminal request is stored in a circular queue in a circular buffer. Step S300: processing each terminal request in the circular queue, so that each terminal request obtains the corresponding target data, and returns the requested completed data to the corresponding terminal system.
[0039] The playback management method of the disclosed embodiment allocates tokens to the terminal requests sent by the terminal system, and decides whether to receive and process the terminal requests according to the result of the tokens allocated to the terminal requests when processing the terminal requests, thereby achieving the purpose of limiting the terminal requests sent by each terminal system, which effectively prevents the problem of slow operation or downtime of the broadcast control management system due to the sudden increase in terminal request traffic. At the same time, when processing terminal requests, combined with the circular message queue technology, the server platform processes each terminal request in the circular list according to each terminal request stored in the circular queue, so that each terminal request obtains the corresponding target data, and returns the request completed data to the corresponding terminal system. The server platform refers to the terminal broadcast control management system. Compared with the traditional message queue, storing the terminal request in the circular queue can effectively avoid the false overflow phenomenon and can fully reuse the queue space.
[0040] Among them, those skilled in the art can understand that the playback control management system server and various terminal systems distributed in different locations (such as terminal boxes equipped with Android system) form a terminal playback control network through the C / S structure, and the playback control management system and the terminal system communicate with each other and transmit data through message services.
[0041] In a possible implementation, token allocation to each terminal request is performed based on a token bucket algorithm. Figure 3 ,Based on the server processing capacity and the traffic of terminal requests, the threshold parameters and token addition rate of the token bucket are set. Tokens are generated at a fixed addition rate and added to the token bucket waiting to be allocated to the received terminal requests. When the number of tokens in the token bucket reaches the threshold, the tokens generated at the fixed addition rate will be discarded and will not enter the token bucket.
[0042] At present, the mainstream terminal broadcast control system basically adopts the leaky bucket algorithm for terminal request flow limiting. The leaky bucket algorithm will forcibly limit the number of requests that exceed the threshold, and it is impossible to effectively utilize network resources. Due to the characteristics of the broadcast control system, the time period for the terminal system or large-screen device supported by the broadcast control system to obtain data is relatively concentrated. The existing system cannot realize elastic restriction of access traffic when the terminal system is continuously added, which leads to a significant reduction in the processing speed and accuracy under a large number of access requests. Therefore, it has almost no ability to cope with the situation of traffic bursts. The present invention uses a token bucket algorithm to process traffic requests at the entrance of the terminal system requesting services, which can effectively improve the real-time and accuracy of data flow processing in high-concurrency scenarios.
[0043] Here, it should be noted that the threshold parameter of the token bucket is set based on the maximum value of the sum of the number of calls to the server by all terminal systems accessing the broadcast control management system in a certain period of time. For example, all terminal systems send a maximum of 100 terminal requests to the server in a certain second (that is, the maximum value of the sum of the number of terminal requests sent by all terminal systems to the server in a certain second is 100 times), and the threshold parameter of the token bucket is set to 1.1 to 2 times the number of terminal requests, then the threshold parameter is set to 110 to 200.
[0044] The terminal system accesses the external service interface of the unified broadcast control management system through the bound request address to obtain display data or commands. At the request entrance, the token bucket algorithm is used to limit the flow of each terminal request, including: the terminal request issued by each terminal system enters the token bucket, one terminal request obtains one token, and the terminal request that obtains the token is sent to the circular buffer for storage, waiting for the server platform to process each terminal request. When the number of tokens in the token bucket is zero, the terminal request will not obtain the token, and the terminal request that is not allocated a token will be rejected.
[0045] Among them, according to actual use needs, the configuration of the token bucket can be flexibly set based on the interface type of the terminal system or the terminal request signal type. For example, the same token bucket is configured for terminal requests of the same interface type or the same signal type, so that terminal requests sent by terminal systems of the same interface type all obtain tokens through the same token bucket, or terminal requests of the same signal type all obtain tokens through the configured same token bucket, and then each terminal request that obtains a token in each token bucket is sent to the circular buffer.
[0046] Here, it should be explained that the token bucket places tokens in the token bucket according to the set speed. If the token bucket is full, the number of tokens will not continue to increase. The terminal request will obtain the right to obtain the corresponding target data based on the allocated token. There are two ways to handle the situation where the token is not allocated in the terminal request. One is that if the terminal request cannot get the token, it will be rejected, which is similar to the polling service of the heartbeat detection. After the rejection, the terminal system will initiate the request again in the next request cycle, and then continue to repeat. Another command is similar to the feedback of the execution control command. The terminal request will continue to detect the new tokens born in the token bucket until the system releases it. Those skilled in the art can set it according to the actual situation.
[0047] The terminal request that obtains the token is stored in a circular queue in the circular buffer. In a possible implementation, the circular queue is deployed based on the Disruptor framework, and each terminal request in the circular queue is converted into a to-be-consumed event waiting to be processed. The terminal request that obtains the token is stored in the circular buffer. At the same time, each processing logic consumes (i.e. processes) each to-be-consumed event (i.e., terminal request) in the circular queue as a consumer in sequence. The consumer consumes the to-be-consumed event, i.e., each processing logic processes each terminal request, so that the server platform completes the business processing according to each terminal request, and constructs the corresponding target data, and returns the corresponding target data to the corresponding terminal system to complete the business processing. By setting up a circular buffer, the speed mismatch between each terminal system and the server platform is reduced, and the parallelism between each terminal system and the server platform is improved. The Disruptor framework is an open source, high-performance asynchronous processing framework that can be implemented using commonly used technical means in this field.
[0048] In some known message queue technologies, when processing terminal requests, the server will import the terminal requests into the message queue to wait for the execution thread to perform subsequent processing. In some high-concurrency scenarios, when multiple data reading terminals send data reading requests to the server cluster at the same time, the server needs to respond to the data reading requests in sequence, and put the queried data into the message queue according to the query order, and then generate the dispatching tasks in sequence according to the arrangement order of the target data in the message queue, and dispatch the target data to the data reading terminal by executing the corresponding dispatching tasks. However, when executing the dispatching tasks in sequence, on the one hand, a large memory resource is required to meet the data reading in the high-concurrency scenario, and on the other hand, the request to lock the resource data leads to a longer response time. In this application, a message queue based on the Disruptor framework is used as the server-side data access, thereby utilizing the high throughput and low latency characteristics of the Disruptor to achieve efficient data transmission in memory and reduce the time that data occupies in other intermediate storage environments. Compared with traditional message queues, the circular queue structure adopted in this disclosure avoids garbage data from being recycled. The circular queue is actually an array, using an array instead of a linked list. Array preload access is much faster than a linked list, and at the same time, the array is more friendly to the processor's cache mechanism. The element position positioning mechanism in the circular queue can speed up the positioning speed through bit operations.
[0049] For example, there are n element positions in the circular queue, 1 to n respectively. Each terminal system stores each terminal request in a circular list in sequence. Each terminal request occupies an element position. When each terminal request is processed, the element position will be vacated. At the same time, the processing logic processes each terminal request in the circular queue, and the n+1th terminal request is added to the vacated element position in the circular queue in sequence. When all the element positions in the circular queue are full, the default rule is that the n+1th terminal request blocks and waits for an empty position in the queue, otherwise it will wait. This default rule can be customized and developed by technicians in this field based on the Disruptor framework, which will not be repeated here.
[0050] The processing logic contains multiple types of processing logic, and the multiple types of processing logic correspond to various types of terminal requests. The processing logic uses an independent consumption mode to process each terminal request, that is, the processing logic processes each terminal request in the circular queue in sequence. After processing the terminal request at the nth position, it returns to process the terminal request at the first position and repeats the process. The processing logic judges the type of terminal request and selects the matching type of processing logic to process it. When a certain type of terminal request occurs frequently within a certain period of time, or the required processing event is long, the processing logic can support the use of a common consumption mode to process this type of terminal request, that is, add multiple consumers to compete for the consumption of this type of terminal request to improve consumption capacity. This competition process is achieved through the atomic variable CAS competition mechanism. Among them, multiple consumers are multiple threads, which are entrusted to the thread pool for thread management.
[0051] That is to say, when processing the terminal requests added to the circular queue, two consumption modes may be included, one is the independent consumption mode and the other is the common consumption mode. The independent consumption mode means that each terminal request added to the circular queue is processed in sequence (such as: in the order of the request position in the circular queue from front to back) using a single thread. When the common consumption mode is adopted, the same type of terminal requests are processed simultaneously in a multi-threaded manner. When processing terminal requests in the common consumption mode, the request type of the terminal requests added to the circular queue can be identified and judged first, and the terminal requests that meet the common consumption mode are identified from the terminal requests added to the circular queue. Then, the identified terminal requests are processed in the common consumption mode, and the remaining terminal requests are directly processed in the independent consumption mode.
[0052] Therefore, in a possible implementation, the type of terminal request includes at least one of an independent request and a common request, the independent request adopts an independent consumption mode, and the common request adopts a common consumption mode. Wherein, when identifying and judging the request type of each terminal request in the circular queue, it can be implemented by extracting a corresponding identifier that can characterize the request type from the terminal request. Wherein, the identifier that can characterize the request type can be a command prompt in the terminal request.
[0053] That is, the character string of each terminal request includes a command prompt, and the request type is determined to be an independent request or a common request based on the command prompt.
[0054] Furthermore, after the request type of the terminal request in the circular queue is identified and determined by any of the above methods, the corresponding processing method (ie, independent consumption mode or common consumption mode) can be determined according to the identified and determined request type.
[0055] Here, it should be noted that when determining the corresponding processing method according to the identified request type, it can be implemented according to the pre-constructed mapping relationship between the request type and the processing method. That is to say, in the method of the embodiment of the present application, various terminal requests that conform to the common consumption mode are pre-stored, and then the currently identified terminal request is compared with the pre-stored terminal requests that conform to the common consumption mode. If it is within the range of terminal requests that conform to the common consumption mode, the currently identified terminal request type is determined to be a common request, and is processed according to the common consumption mode. If the currently identified terminal request is not within the range of pre-stored terminal requests that conform to the common consumption mode, it is determined that the request type is an independent request, and is processed according to the independent consumption mode.
[0056] Furthermore, among the various types of terminal requests issued by each terminal system, it should be understood that the commands requested by the terminal have different types, such as commands to obtain data, generate pictures, send terminal status, etc. These different types of requests all contain different command prompts to implement the judgment of the request type.
[0057] Among them, in one possible implementation method, when determining terminal requests that comply with the common consumption pattern, they can be divided based on the frequency of occurrence within a certain period of time or the required processing time. Terminal requests with a higher frequency of occurrence or a longer processing time within a certain period of time can be set as requests that comply with the common consumption pattern (that is, the request type is a common request), and other types of terminal requests are independent requests.
[0058] That is, the type of terminal request is determined by the command prompt in the character string of each terminal request, and then the terminal request is determined to be an independent request or a common request. And the processing logic corresponding to each type of terminal request in the common request is set to multi-threaded, so as to have the common consumption capability for the common request. The specific number of multi-threaded processing logic can be set by those skilled in the art based on the processing capability of the service platform, and is not limited here.
[0059] More specifically, when setting the terminal request type that appears frequently within a certain period of time as a terminal request that conforms to the common consumption mode, it can be determined based on the frequency of terminal request issuance and / or the processing time of each terminal request. Among them, the frequency of terminal request issuance refers to the number of occurrences within a preset statistical time range. The processing time refers to the time required to process the terminal request until the target data corresponding to the terminal request is obtained.
[0060] In a possible implementation summary, when determining whether a terminal request conforms to the common consumption model based on the frequency of occurrence of the terminal request, it includes: counting the issuance time and the required processing time of all terminal requests issued by the terminals connected to the broadcast control management system. Among them, the calculation of the processing time can be done by adding duration logic at the request entry and request end stage in an aspect-oriented programming manner, and calculating the time consumption, which is a commonly used technical means in this field. Based on the issuance time of all terminal requests, the time point with the most issuances of all terminal requests in a day is obtained, and the statistical time range is determined based on this time point, and then all terminal requests issued are counted within the determined statistical time range, and the number of occurrences of each terminal request within the statistical time range is calculated, and then sorted by the number of occurrences from most to least, and then the terminal requests in the top N are selected from the sorting as requests that conform to the common consumption model.
[0061] In a possible implementation, the statistical time range may be: from five minutes before the time point when all terminal requests are issued the most in a day to five minutes after the time point. The value range of N may be set to: 2≤N≤4, preferably 3.
[0062] In addition, when determining the terminal request that complies with the common consumption mode based on the longer processing time, it can be achieved in the following manner.
[0063] That is, all terminal requests issued by each terminal connected to the broadcast control management system within a preset time are counted, and the processing time of each terminal request is calculated, and then the processing time is arranged in order from long to short, and the top M terminal requests are selected as requests that meet the common consumption model.
[0064] Here, it should be pointed out that the preset time can be flexibly set according to the actual situation. It can adopt the same time range as in the implementation method of statistical frequency of occurrence, or it can be set separately, such as: any time value between 30min-12h, preferably 12h. The value range of M is: 2≤M≤5, preferably 3.
[0065] Among them, in a possible implementation, when determining the terminal request that meets the common consumption mode according to any of the above methods, the two parameters of occurrence frequency and processing time can be combined for determination. For example, the terminal request determined according to the occurrence frequency and the terminal request determined according to the processing time can be directly merged (i.e., taking the union) as the terminal request that is finally determined to meet the common consumption mode.
[0066] Further, the processing logic judges the request type of each terminal request in the circular queue in turn based on the command prompt, and then judges whether the terminal request is an independent request or a common request. When the current terminal request is judged to be an independent request, the processing logic matching the current terminal request type is selected from the processing logic, and one processing logic processes one current terminal request, that is, independent consumption. After the processing is completed, the terminal request at the next element position of the current terminal request in the circular queue is judged and processed. When the current terminal request is judged to be a common request, the multi-threaded processing logic set for the terminal request of this type preempts the service of all terminal requests of this type in the circular queue, and multiple processing logics process multiple current terminal requests, that is, common consumption, until all terminal requests of this type in the current circular queue are processed, and then the terminal request at the next element position of the current terminal request in the circular queue is judged and processed. Repeatedly, each terminal request in the circular queue is processed. Among them, for the terminal request that has been processed, the element position in the circular queue where it is located becomes an empty position, which is used to add a new terminal request that obtains a token.
[0067] For example, each terminal request type includes request A, request B, request C...request N, and the processing logic includes corresponding logic A, logic B, logic C...logic N. The frequency of all terminal request types occurring within the ten minutes with the most terminal requests in a day is counted, and the top three terminal requests with the highest frequency are taken out, such as request A, request B and request C. Then, the required processing time of all terminal requests is sorted, and the three terminal requests with the longest required time are taken out, such as request B, request C and request D. The terminal request types taken out twice are taken as a union, that is, request A, request B, request C and request D, as a common request. Then, logic A, logic B, logic C and logic D are all preset as multi-threaded, which are used to jointly consume the corresponding types of terminal requests.
[0068] See also Figure 4 , based on the circular queue deployed by the Disruptor framework, a sequence value is assigned to each terminal request to mark the position of the consumption event in the circular queue, and the terminal request is published as a to-be-consumed event. The types of terminal requests include at least one of independent requests and joint requests. The consumption mode of the Disruptor framework supports independent consumption and joint consumption modes. In the joint consumption mode, the consumer's Sequence value comes from the public Sequence instance. The public Sequence instance is an instance that exists in the joint consumption mode and is used to record the progress of the current consumption event processing. The joint consumption mode is adopted for joint requests. There are multiple competing consumers in the joint request, that is, multi-threaded processing logic. Each consumer will create its own Sequence1-1, Sequence1-2, and Sequence1-3 instances based on the current public Sequence1 instance to achieve competitive consumption. Among them, the multi-threaded processing logic is delegated to the thread pool for thread management. Each terminal request will use a command prompt to identify the command type (similar to the json format), and then classify each terminal request. When the consumer processes the command, it will go through different business processing logics according to the terminal request type, independent consumption or joint consumption. Different types of terminal requests should be understood as commands of different types requested by the terminal, such as commands to obtain data, generate images, send terminal status, etc. These commands are all pending events in the circular queue, and the RingBuffer circular queue is responsible for providing a unified Sequence value. Consumers will consume the pending event content in the RingBuffer queue, that is, process the terminal commands. However, if some terminal commands take a long time to process, in order to improve the processing capability, this type of terminal request can be defined as a common request to provide multiple identical services for processing. The same service is a common consumer, and the process of service preemption events is achieved through CAS competition. Independent consumers will sequentially process the content of each independent request as an independent event to complete the consumption function. Common consumers refer to the creation of multiple competing consumers within the processing logic of a certain independent request mentioned above to compete for the consumption rights of this event. These consumers are collectively called common consumers and will have the same Sequence to indicate the consumption progress of the current event. At the same time, each consumer will also have an independent Sequence to support CAS competition and avoid performance problems caused by locking. Multiple threads use atomic variables CAS competition to grab consumable events for consumption. Atomic variables refer to variables that can ensure that all operations on them are atomic and indivisible. The CAS algorithm is an implementation of a lock-free, non-blocking algorithm that can provide high concurrent processing capabilities. This is a common technical means in this field and will not be described in detail.
[0069] Furthermore, concurrent processing of data is realized through a concurrent tool based on the Disruptor framework. In the process of processing data, the producer and consumer of the data are clarified, that is, the source of the target data and the data reading terminal that needs to read the data are clarified. By clarifying the producer side, that is, each terminal system, each terminal request is put into a circular list waiting for consumption. By clarifying the consumer side, that is, the server platform, each terminal request is consumed independently and jointly. And an event process for monitoring the concurrent tool is generated in the server. Therefore, when multiple terminal systems simultaneously issue the same terminal request, the concurrent tool realizes the joint consumption of the terminal data, thereby improving the efficiency of concurrent reading of data. The concurrent tool contains all the basic components of the Disruptor framework. In the basic components of the Disruptor framework, the consumable event, that is, the terminal request, is carried by creating a circular queue RingBuffer object component. The consumer, that is, the server platform, as an independent thread, obtains the position of consumption in the circular queue RingBuffer through Sequence, and then the event consumption operation is triggered by EventHandler.
[0070] The processing logic processes each terminal request, that is, the server platform performs business processing on each terminal request. After the server platform completes the business processing of each terminal request, according to the type of each terminal request, the server platform reads the corresponding target data and sends the target data to the corresponding terminal system to complete the business processing.
[0071] Here, it should be noted that when the server platform processes the terminal request in the circular queue, it synchronously constructs the log data and sends the log data to the information server platform for storage to complete the log information recording operation. Similarly, any of the above methods can also be used to create multiple common consumers to construct log data processing.
[0072] For further information, see Figure 2 and Figure 3, the present disclosure also includes step S110: the broadcast control management system obtains each terminal request issued by each terminal system. The broadcast control management system is configured with a token bucket for executing step S120: the token bucket allocates a token to each terminal request, and one token corresponds to one terminal request. Step S130 is executed for all the terminal requests obtained: whether the terminal request has obtained the token. For the terminal request that has not obtained the token, a rejection process is performed. For the terminal request that has obtained the token, step S200 is executed: after the terminal request is allocated with the token, the terminal request is stored in the circular queue in the circular buffer. For each terminal request in the circular queue, step S310 is executed to determine the type of each terminal request. According to the terminal request type, the server platform uses independent consumption or common consumption to process the corresponding terminal request. When processing each terminal request, step S320 is also executed at the same time: when the server platform processes the terminal request in the circular queue, it synchronously constructs log data, sends the log data to the letter server platform for storage, and completes the recording operation of the log information. After the server platform completes the business processing of each terminal request, step S330 is executed: according to the type of each terminal request, the server platform reads the corresponding target data and sends the target data to the corresponding terminal system to complete the business processing. Figure 3 , further comprising step S002: determining whether the number of added tokens in the token bucket reaches a threshold value, if the number of tokens in the token bucket reaches the threshold value, that is, the token bucket is full, the number of tokens will not continue to increase.
[0073] Furthermore, in order to avoid excessive issuance of a certain type of terminal request in a certain time period, which increases the number of other types of terminal requests being denied access due to failure to obtain tokens, a token bucket can be set separately for a certain type of terminal request. For example, based on the issuance time of all terminal requests, the time point with the most issuances of all terminal requests in a day is obtained, and the statistical time range is determined based on the time point, and then all the terminal requests issued are counted within the determined statistical time range, and the number of occurrences of each terminal request within the statistical time range is calculated. Preferably, the terminal request of the type with the highest frequency within the 12h range of the time point, that is, the terminal request of type a, is selected. For the terminal request of type a, a token bucket A is added, and the type of each received terminal request is judged at the request entrance, and all the terminal requests of type a are sent to the token bucket A for token allocation, and the terminal requests of the remaining types are sent to the token bucket B for token allocation. The terminal request of type a that obtains the token and the remaining terminal requests that obtain the token are sent to the circular queue for processing. It is also possible to sort the occurrences of each type of terminal request within the above statistical time range in descending order, select the terminal requests of the first P types in the sorting, set P token buckets and a public token bucket accordingly, judge the type of each received terminal request at the request entrance, send the terminal requests of the first P types in the sorting to the corresponding P token buckets for token allocation, send the terminal requests of other types to the public token bucket for token allocation, and send the terminal requests of the P types that have obtained tokens and the remaining terminal requests that have obtained tokens to the circular queue for processing. Similarly, multiple token buckets can be set one by one for the terminal requests of the corresponding types. The threshold parameters of each token bucket and the corresponding token addition rate are set according to the actual situation, as long as the sum of the threshold parameters of each token bucket is not greater than twice the sum of the number of calls to the server in a certain time period (that is, the maximum value of the sum of the number of terminal requests sent to the server by all terminal systems within a certain second is 100 times, then the sum of the threshold parameters of each token bucket is not greater than 200).
[0074] According to another aspect of the present disclosure, referring to Figure 5 , a playback control management system 100 is provided, including a current limiting module 110 and a circular buffer module 120. The current limiting module 110 is configured to obtain terminal requests sent by each terminal system and allocate tokens to each terminal request. The circular buffer module 120 is configured to store the terminal requests that obtain the tokens, and according to each terminal request stored in the circular buffer, read the corresponding target data from the circular queue stored in the circular buffer, and return the requested completed data to the corresponding terminal system. Among them, the circular buffer module 120 is deployed with a concurrent tool based on the Disruptor framework.
[0075] In a possible implementation, the current limiting module 110 allocates tokens to each terminal request based on a token bucket algorithm.
[0076] Furthermore, according to another aspect of the present disclosure, a playback control management device 200 is also provided. Figure 6 The playback control management device 200 of the embodiment of the present disclosure includes a processor 210 and a memory 220 for storing executable instructions of the processor 210. The processor 210 is configured to implement any of the above playback control management methods when executing the executable instructions.
[0077] Here, it should be noted that the number of processors 210 can be one or more. At the same time, the playback control management device 200 of the embodiment of the present disclosure may also include an input device 230 and an output device 240. The processor 210, the memory 220, the input device 230, and the output device 240 may be connected via a bus or in other ways, which are not specifically limited here.
[0078] The memory 220 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and various modules, such as the program or module corresponding to the playback control management method of the embodiment of the present disclosure. The processor 210 executes various functional applications and data processing of the playback control management device 200 by running the software programs or modules stored in the memory 220.
[0079] The input device 230 may be used to receive input numbers or signals. The signals may be key signals related to user settings and function control of the device / terminal / server. The output device 240 may include display devices such as display screens.
[0080] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by the processor 210, any of the above-mentioned playback control management methods is implemented.
[0081] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A playback control management method, applied to a server platform, characterized in that: include: Obtaining terminal requests sent by each terminal system, and allocating a token to each terminal request; After the terminal request is allocated to the token, storing the terminal request in a circular queue in a circular buffer; Processing each terminal request in the circular queue, so that each terminal request obtains the corresponding target data, and returns the requested completed data to the corresponding terminal system; The processing of each terminal request in the circular queue so that each terminal request obtains corresponding target data includes: According to the type of each terminal request, the server platform reads the corresponding target data and sends the target data to the corresponding terminal system; The types of terminal requests include independent requests and common requests; There are two consumption modes when processing terminal requests added to the circular queue, one is the independent consumption mode and the other is the common consumption mode; the independent consumption mode means that each terminal request added to the circular queue is processed in sequence by a single thread; when the common consumption mode is adopted, the terminal requests of the same type are processed simultaneously by multi-threading; when the common consumption mode is adopted to process the terminal requests, the request type of the terminal requests added to the circular queue is first identified and judged, and after the terminal requests that meet the common consumption mode are identified from the terminal requests added to the circular queue, the identified terminal requests are processed by the common consumption mode, and the remaining terminal requests are directly processed by the independent consumption mode; Independent requests adopt an independent consumption mode, and common requests adopt a common consumption mode; wherein, when identifying and judging the request type of each terminal request in the circular queue, it is achieved by extracting a corresponding identifier that can characterize the request type from the terminal request; The identifier that can characterize the request type is the command prompt in the terminal request; that is, the character string of each terminal request includes a command prompt, and the request type is determined to be an independent request or a common request by the command prompt; When determining terminal requests that comply with the common consumption pattern, they are divided based on the frequency of occurrence within a certain period of time or the required processing time. Terminal requests with a higher frequency of occurrence or a longer processing time within a certain period of time are set as requests that comply with the common consumption pattern, and the remaining types of terminal requests are independent requests.
2. The method according to claim 1, characterized in that When allocating tokens to each terminal request, it is performed based on a token bucket algorithm.
3. The method according to claim 1, characterized in that When the terminal request is not allocated with the token, an operation of refusing to process the terminal request is performed.
4. The method according to claim 1, characterized in that: When the terminal request is stored in the circular queue in the circular buffer, the terminal request is converted into an event to be consumed based on the Disruptor framework.
5. A playback control management system, applied to a server platform, characterized in that: Including current limiting module and circulation buffer module; The current limiting module is configured to obtain terminal requests sent by each terminal system and allocate a token to each terminal request; The circular buffer module is configured to store the terminal request into a circular queue in a circular buffer after the terminal request is allocated the token; Processing each terminal request in the circular queue so that each terminal request obtains corresponding target data, and returning the requested completed data to the corresponding terminal system; wherein processing each terminal request in the circular queue so that each terminal request obtains corresponding target data includes: According to the type of each terminal request, the server platform reads the corresponding target data and sends the target data to the corresponding terminal system; The types of terminal requests include independent requests and common requests; There are two consumption modes when processing terminal requests added to the circular queue, one is the independent consumption mode and the other is the common consumption mode; the independent consumption mode means that each terminal request added to the circular queue is processed in sequence by a single thread; when the common consumption mode is adopted, the terminal requests of the same type are processed simultaneously by multi-threading; when the common consumption mode is adopted to process the terminal requests, the request type of the terminal requests added to the circular queue is first identified and judged, and after the terminal requests that meet the common consumption mode are identified from the terminal requests added to the circular queue, the identified terminal requests are processed by the common consumption mode, and the remaining terminal requests are directly processed by the independent consumption mode; Independent requests adopt an independent consumption mode, and common requests adopt a common consumption mode; wherein, when identifying and judging the request type of each terminal request in the circular queue, it is achieved by extracting a corresponding identifier that can characterize the request type from the terminal request; The identifier that can characterize the request type is the command prompt in the terminal request; that is, the character string of each terminal request includes a command prompt, and the request type is determined to be an independent request or a common request by the command prompt; When determining terminal requests that comply with the common consumption pattern, they are divided based on the frequency of occurrence within a certain period of time or the required processing time. Terminal requests with a higher frequency of occurrence or a longer processing time within a certain period of time are set as requests that comply with the common consumption pattern, and the remaining types of terminal requests are independent requests.
6. The system according to claim 5, characterized in that The current limiting module allocates tokens to each terminal request based on a token bucket algorithm.
7. A playback control management device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 4 when executing the executable instructions.
8. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 4 is implemented.
