Adjustment method and device, electronic equipment and storage medium
By monitoring resource status through producers and consumers and dynamically adjusting the number of threads and their speed, the problem of speed mismatch between producers and consumers is solved, achieving rational utilization of resources and improving system stability and performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PEOPLE'S INSURANCE COMPANY OF CHINA
- Filing Date
- 2025-11-25
- Publication Date
- 2026-04-10
AI Technical Summary
The speed mismatch between producers and consumers leads to task queue backlog, delays, or resource waste, affecting system stability and resource utilization.
By having producers and consumers monitor their own resource status and dynamically adjust the number and speed of threads to match production and consumption capabilities, the rational use of resources can be achieved.
It improved the stability of task allocation and processing, optimized task rhythm, reduced resource waste, and improved system performance and resource utilization.
Smart Images

Figure CN121833151A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software development, and particularly relates to a regulation method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the task processing mode, the matching of production and consumption is the core mechanism to ensure the efficient and stable operation of the system. The producer is responsible for putting data into the queue, and the consumer is responsible for taking out the queue data and processing. When the processing capacity of the consumer cannot match the production, the task queue will be accumulated, the delay will be increased, and even the system will be crashed. When the production capacity of the producer cannot meet the consumption, the consumption resources will be wasted. Therefore, a regulation method is needed to dynamically balance the production and consumption, increase the stability, and improve the resource utilization. SUMMARY
[0003] The present application aims to at least solve one of the technical problems in the related art to some extent.
[0004] To this end, the first object of the present application is to provide a regulation method to realize the coordinated regulation on the producer side, dynamically balance the production speed and the consumption speed, ensure that the production resources or the consumption resources are fully utilized, reduce the resource waste, improve the stability of task allocation and processing, and optimize the task rhythm.
[0005] The second object of the present application is to provide a regulation device.
[0006] The third object of the present application is to provide an electronic equipment.
[0007] The fourth object of the present application is to provide a computer readable storage medium.
[0008] The fifth object of the present application is to provide a computer program product.
[0009] To achieve the above objects, the first aspect of the present application provides a regulation method, which is executed by a producer and includes the following steps. determining a first thread number of the maximum production capacity according to a first resource amount available at present; generating to-be-processed data according to the first thread number; putting the to-be-processed data into a first queue and determining a production speed of data in the first queue; monitoring a second queue fed back by a consumer and determining a consumption speed of the consumer in processing data in the first queue; adjusting the production speed or the consumption speed according to a difference between the production speed and the consumption speed.
[0010] To achieve the above object, the second aspect of the present application proposes a regulation method, executed by a consumer, comprising: determining a second thread number of maximum consumption capacity according to a second resource amount currently available; in a case where it is monitored that there is data to be processed in the first queue, obtaining data in the first queue according to the second thread number for processing, obtaining a processing result, and putting the processing result into a second queue; in a case where a first regulation instruction sent by a producer is received, reducing the second thread number based on a consumption speed reduction ratio in the first regulation instruction.
[0011] To achieve the above object, the third aspect of the present application proposes a regulation device, configured in a producer, comprising: a first determination module, configured to determine a first thread number of maximum production capacity according to a first resource amount currently available; a generation module, configured to generate data to be processed according to the first thread number; a second determination module, configured to put the data to be processed into a first queue and determine a production speed of data in the first queue; a third determination module, configured to monitor a second queue fed back by a consumer and determine a consumption speed of the consumer in processing data in the first queue; a regulation module, configured to regulate the production speed or the consumption speed according to a difference between the production speed and the consumption speed.
[0012] To achieve the above object, the fourth aspect of the present application proposes a regulation device, configured in a consumer, comprising: a fourth determination module, configured to determine a second thread number of maximum consumption capacity according to a second resource amount currently available; a first processing module, configured to, in a case where it is monitored that there is data to be processed in the first queue, obtain data in the first queue according to the second thread number for processing, obtain a processing result, and put the processing result into a second queue; a second processing module, configured to, in a case where a first regulation instruction sent by a producer is received, reduce the second thread number based on a consumption speed reduction ratio in the first regulation instruction.
[0013] To achieve the above object, the third aspect of the present application proposes an electronic device, comprising a processor and a memory in communication connection with the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to realize the regulation method in any one of the first aspect and the second aspect.
[0014] To achieve the above object, the fourth aspect of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and the computer execution instructions are used to implement the adjustment method according to any one of the first aspect and the second aspect.
[0015] To achieve the above object, the fifth aspect of the present application provides a computer program product, comprising a computer program, and the computer program is used to implement the adjustment method according to any one of the first aspect and the second aspect.
[0016] The adjustment method, device, electronic equipment and storage medium provided by the present application can improve the production capacity to the maximum value by monitoring the resource condition of the producer, determine the maximum first thread number for production, generate data and push to the to-be-processed queue, then monitor the feedback queue of the consumer, determine the consumption speed of the consumer, compare the production speed and the consumption speed, adjust the production capacity or send the consumption adjustment instruction to the consumer, so that the production and the consumption are matched, thereby the production speed and the consumption speed can be dynamically coordinated in real time at the production end, the production capacity or the consumption capacity is maximized, the resource utilization is more reasonable and sufficient, the stability of task allocation and processing is improved, and the task rhythm is optimized.
[0017] Additional aspects and advantages of the present application will be made apparent by the following description and the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0018] The above and / or additional aspects and advantages of the present application will become apparent and be readily understood from the following description, taken in conjunction with the accompanying drawings, in which: Figure 1 A flowchart of an adjustment method provided by an embodiment of the present application is shown in FIG. 1; Figure 2 A flowchart of another adjustment method provided by an embodiment of the present application is shown in FIG. 2; Figure 3 A flowchart of the interaction between a producer and a consumer provided by an embodiment of the present application is shown in FIG. 3; Figure 4 A structural diagram of an adjustment device provided by an embodiment of the present application is shown in FIG. 4; Figure 5 A structural diagram of another adjustment device provided by an embodiment of the present application is shown in FIG. 5. DETAILED DESCRIPTION
[0019] Embodiments of the present application are described below in detail, examples of which are shown in the accompanying drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.
[0020] The adjusting method and device of the embodiments of the present application are described below with reference to the accompanying drawings.
[0021] In the general producer-consumer task processing mode, the number of consumers needs to be adjusted manually according to the server condition, and is generally fixed after deployment, fixedly occupying server resources for execution. The producer does not consider the consumption condition of the consumer, and only puts data into the queue according to its own production capacity. This processing mode is easy to cause the mismatch between the production speed and the consumption speed, resulting in continuous growth of the task queue, increasing the delay and even affecting the system stability, or causing insufficient production and underutilization of consumption capacity.
[0022] To solve this problem, the embodiments of the present application provide an adjusting method to evaluate the performance of the server at the consumer end, improve or reduce the consumption capacity, and continuously adjust according to the actual condition to reasonably use the consumption capacity; the production end continuously observes the consumption queue, evaluates the contrast relationship between the consumption capacity and the production capacity, reasonably produces data to be consumed, and issues a consumption adjustment instruction to guide the consumer to adjust the consumption capacity. Finally, the production and consumption are matched, and the resources are reasonably utilized.
[0023] The well-known technologies involved in the embodiments of the present application include queues, threads, etc., which are explained as follows.
[0024] A queue is a first-in first-out (FIFO) data structure, which is a special linear list. The special place is that it only allows deletion operation at the front of the list (front), and insertion operation at the rear of the list (rear). Like a stack, a queue is a linear list with limited operations. The end for insertion operation is called the queue tail, and the end for deletion operation is called the queue head.
[0025] A thread is the smallest unit of operation scheduling by an operating system. It is contained in a process and is the actual operation unit in the process. A thread is the basic unit of independent scheduling and dispatch. Multiple threads in the same process will share all system resources in the process, such as virtual address space, file descriptor, and signal processing. However, multiple threads in the same process have their own call stack, register context, and thread-local storage.
[0026] Figure 1 This is a schematic flowchart of an adjustment method provided in an embodiment of this application.
[0027] like Figure 1 As shown, this adjustment method, performed by the producer, may include the following steps: Step 101: Determine the first number of threads with the maximum production capacity based on the currently available first resource quantity.
[0028] In this embodiment of the application, the producer can be any one of the following: data generation source, user request initiator, etc.
[0029] In this embodiment, the producer can monitor its own resource status, including CPU usage, memory usage, system input / output (IO), network usage, etc., to determine the current available first resource quantity, calculate the maximum production capacity that the first resource quantity can satisfy, and determine the first number of threads to start production. The first number of threads N = first resource quantity W / resource quantity S per thread.
[0030] Step 102: Generate data to be processed based on the first thread count.
[0031] In this embodiment of the application, after determining the first number of threads that the currently available resources can support, the producer can use the first number of threads to generate data to be processed based on its maximum production capacity. Step 103: Place the data to be processed into the first queue and determine the production rate of the data in the first queue.
[0032] The first queue, also known as the task queue or the data queue to be processed, is where producers push data to be processed, and consumers retrieve data from the first queue for processing.
[0033] In this embodiment of the application, the producer's production speed can be determined based on the number of data to be processed placed into the first queue within a unit of time (such as one minute, one hour, etc.).
[0034] Step 104: Monitor the second queue of consumer feedback to determine the consumption rate of consumers processing data in the first queue.
[0035] The second queue is where consumers process the data in the first queue and then return the results in chronological order.
[0036] In this embodiment, the consumer may be a service node, etc.
[0037] In the embodiments of the present application, the producer can monitor the second queue to obtain all the task processing details in the second queue, such as task processing status (success or failure), processing completion time, and the like, form task summary statistics, including the number of sent tasks, the number of processed tasks, sending speed, processing speed, and the like, so as to determine the number of tasks successfully processed by the consumer in a unit of time, to obtain the current consumption speed of the consumer.
[0038] In step 105, the production speed or the consumption speed is adjusted according to the difference between the production speed and the consumption speed.
[0039] In the embodiments of the present application, the producer can continuously observe the production speed and the consumption speed, and then reduce the production speed or the consumption speed according to the size relationship between the production speed and the consumption speed, so that the production resource or the consumption resource can be fully utilized, and the production speed and the consumption speed are matched. For example, if the production speed is less than the consumption speed, the consumption reduction ratio is calculated, and the reduction instruction is sent to the consumer to reduce the consumption speed; or if the production speed is greater than the consumption speed, the production speed and the consumption speed are reduced to match, a round of adjustment is completed, and the adjustment details are recorded.
[0040] Optionally, in the case that the production speed is greater than the consumption speed, the first number of threads can be reduced based on the difference.
[0041] In the embodiments of the present application, the production speed is greater than the consumption speed, in order to avoid excessive accumulation of data in the task queue, causing system burden, some threads for production can be released to reduce the production speed.
[0042] Alternatively, in the case that the consumption speed is greater than the production speed, the consumption speed reduction ratio can be calculated based on the difference, and the first adjustment instruction containing the consumption speed reduction ratio is sent to the consumer.
[0043] In the embodiments of the present application, the consumption speed is greater than the production speed, at this time, some data processing threads in the consumer are useless, causing resource waste, therefore, the producer can calculate the ratio of the difference between the consumption speed and the production speed to the current consumption speed to determine the consumption speed reduction ratio, and then send the consumption speed reduction ratio to the consumer through the first adjustment instruction to instruct the consumer to reduce the consumption speed and release idle resources.
[0044] Alternatively, in the case that the production speed is equal to the consumption speed, no adjustment is performed.
[0045] It should be noted that after completing the speed adjustment of one round, the producer resource or the consumer resource can change, so that the maximum production capacity of the producer or the maximum consumption capacity of the consumer is different from before, and therefore the production and consumption speed of the producer can be re-determined after the production capacity or the consumption capacity is increased to the maximum value, and the above adjustment is repeated. Only one round of adjustment is required for each resource change.
[0046] Optionally, the new first thread number can be determined in the case of detecting the first resource amount update, and a second adjustment instruction is sent to the consumer, wherein the second adjustment instruction is used to adjust the consumption speed to the maximum value. Then, the difference between the production speed and the consumption speed is re-determined based on the new first thread number and adjusted.
[0047] In the embodiment of the application, whether the first resource amount increases or decreases, the consumption speed of the consumer can be first restored to the maximum consumption speed corresponding to the available resource, and then adjusted, without considering the production and consumption balance state before the first resource amount update, so that the adjustment efficiency can be improved.
[0048] It should be noted that in the embodiment of the application, the first adjustment instruction and the second adjustment instruction sent by the producer to the consumer can also be sent in the form of a queue, which is not limited in the application.
[0049] Optionally, the production speed or the consumption speed can be re-adjusted based on the production speed corresponding to the first thread number in the case of detecting the consumption speed change and the consumption speed change being irrelevant to the first adjustment instruction.
[0050] In the embodiment of the application, the producer can monitor the second queue in real time to determine the consumption speed change of the consumer at each time. The consumption speed change can be caused by the adjustment instruction or the change of the available resource amount of the consumer. Therefore, after detecting the consumption speed change, it can be determined whether the changed consumption speed matches the production speed. If it matches, it is related to the first adjustment instruction, and if it does not match, it can be considered that the available resource amount of the consumer changes and is irrelevant to the first adjustment instruction. Therefore, whether the consumption speed is increased or decreased, the adjustment can be performed based on the production speed corresponding to the maximum production capacity, so that the adjustment efficiency can be improved.
[0051] In this embodiment, the producer increases the production capacity to the maximum value by monitoring the resource status of itself, determines the maximum first thread number for production, generates data and pushes it to the to-be-processed queue, then monitors the feedback queue of the consumer, determines the consumption speed of the consumer, compares the production speed and the consumption speed, adjusts the production capacity or sends the consumption adjustment instruction to the consumer, so that the production and the consumption are matched, thereby the production speed and the consumption speed can be dynamically coordinated in real time at the production end, the production capacity or the consumption capacity is maximized, the resource utilization is more reasonable and sufficient, the stability of task allocation and processing is improved, and the task rhythm is optimized.
[0052] This embodiment provides another adjustment method, Figure 2 The flowchart of another adjustment method provided by the embodiment of the application is shown.
[0053] As Figure 2 shown, the adjustment method, executed by the consumer, can include the following steps: Step 201, determining the second thread number of the maximum consumption capacity according to the currently available second resource amount.
[0054] In the embodiment of the application, the consumer can monitor the resource status of itself, including the CPU usage, the memory usage, the system IO, the network occupation and the like, determine the currently available second resource amount, calculate the maximum consumption capacity that can be met by the second resource amount, and determine the second thread number of the consumption start. The second thread number N = the first resource amount W / the resource amount occupied by a single thread S.
[0055] Step 202, in the case that it is monitored that there is to-be-processed data in the first queue, acquiring the data in the first queue for processing according to the second thread number, obtaining the processing result, and putting the processing result into the second queue.
[0056] In the embodiment of the application, the consumer can monitor the first queue where the to-be-processed data is located, when there is to-be-processed data in the first queue, can take out multiple data from the first queue and process them simultaneously according to the second thread number, after processing, put the processing result into the second queue, and feed back the processing situation to the producer, so that the producer can determine the consumption speed of the consumer according to the second queue. Step 203, in the case that the first adjustment instruction sent by the producer is received, reducing the second thread number based on the consumption speed reduction ratio in the first adjustment instruction.
[0057] In the embodiment of the application, according to the consumption speed reduction ratio in the first adjustment instruction, it can be determined that in the case that the consumption speed reduction instruction indicates a certain ratio, how many threads need to be reduced, thereby releasing these processing threads, reducing the invalid occupation of resources, and improving the resource utilization.
[0058] Optionally, if an update to the second resource quantity is detected, a new second thread number is determined, and then data from the first queue is retrieved and processed based on the new second thread number.
[0059] In this embodiment, when consumer resources change, the consumption capacity will be automatically increased to the maximum. Then, the consumption capacity will be adjusted according to the producer's adjustment instructions. After the adjustment is completed, if the resources do not change, no automatic adjustment will be made, and the adjustment will only be made according to the producer's instructions.
[0060] In this embodiment, the consumer monitors its own resource status, maximizes its consumption capacity, determines the maximum number of second threads available for consumption, retrieves data from the processing queue for processing, and sends the processing results back to the producer via a feedback queue. Then, upon receiving a speed adjustment command from the producer, the consumer adjusts its consumption speed accordingly, thereby avoiding resource waste and system overload, and significantly improving system performance, resource utilization, and stability.
[0061] The following is combined Figure 3 Explain the interaction process between producers and consumers. Figure 3 This is a schematic diagram illustrating the interaction between a producer and a consumer, provided as an embodiment of this application.
[0062] like Figure 3 As shown, producers can produce data and place it into a processing queue (i.e., the first queue in the above embodiment), which is then sent to consumers in queue form. Consumers can retrieve multiple data items from the processing queue in chronological order for processing and place the processing results into a feedback queue (i.e., the second queue in the above embodiment). Producers can then monitor the feedback queue and compare the production speed with the consumption speed in real time. If the production speed exceeds the consumption speed, the producer adjusts its production capacity to reduce the production speed; or if the consumption speed exceeds the production speed, the producer generates an adjustment instruction and sends it to the consumer through an instruction queue, instructing the consumer to adjust its processing thread to reduce the consumption speed. Alternatively, if producer resources (or consumer resources) change, the producer (or consumer) can automatically increase its production (or consumption) capacity to the maximum.
[0063] To achieve the above embodiments, this application also proposes an adjustment device.
[0064] Figure 4 This is a schematic diagram of the structure of an adjustment device provided in an embodiment of this application.
[0065] like Figure 4 As shown, the regulating device 40, configured in the producer, includes: The first determining module 401 is used to determine the first number of threads with the maximum production capacity based on the currently available first resource quantity; The generating module 402 is configured to generate the data to be processed according to the first thread number. The second determining module 403 is configured to put the data to be processed into the first queue and determine a production speed of the data in the first queue. The third determining module 404 is configured to monitor the second queue fed back by the consumer and determine a consumption speed of the data processed by the consumer in the first queue. The adjusting module 405 is configured to adjust the production speed or the consumption speed according to a difference between the production speed and the consumption speed.
[0066] Further, in a possible implementation of the embodiment of the present application, the adjusting module 405 can be specifically configured to: in the case that the production speed is greater than the consumption speed, reduce the first thread number based on the difference; in the case that the consumption speed is greater than the production speed, calculate a consumption speed adjustment reduction ratio based on the difference, and send a first adjustment instruction containing the consumption speed adjustment reduction ratio to the consumer; or in the case that the production speed is equal to the consumption speed, do not adjust.
[0067] Further, in a possible implementation of the embodiment of the present application, the adjusting module 405 can be further configured to: in the case that the first resource amount is detected to be updated, determine a new first thread number and send a second adjustment instruction to the consumer, wherein the second adjustment instruction is used to adjust the consumption speed to a maximum value; re-determine the difference between the production speed and the consumption speed based on the new first thread number and adjust.
[0068] Further, in a possible implementation of the embodiment of the present application, the adjusting module 405 can be further configured to: in the case that the consumption speed change is detected and the consumption speed change is irrelevant to the first adjustment instruction, re-adjust the production speed or the consumption speed based on the production speed corresponding to the first thread number.
[0069] It should be noted that the foregoing explanation and description of the adjusting method embodiment are also applicable to the adjusting device of the embodiment, which will not be described here again.
[0070] In this embodiment, the producer improves the production capacity to the maximum value by monitoring the resource condition of itself, determines the maximum first thread number for production, generates data and pushes to the to-be-processed queue, and then monitors the feedback queue of the consumer, determines the consumption speed of the consumer, compares the production speed and the consumption speed, adjusts the production capacity or sends the consumption adjustment instruction to the consumer, so that the production and the consumption are matched, thereby the production speed and the consumption speed can be dynamically coordinated in real time at the production end, the production capacity or the consumption capacity is maximized, the resource utilization is more reasonable and sufficient, the stability of task allocation and processing is improved, and the task rhythm is optimized.
[0071] Figure 5 Another adjustment device provided in the embodiment of the application is shown in a structural schematic diagram.
[0072] As shown in Figure 5 The adjustment device 50 configured in the consumer includes: The fourth determination module 501 is configured to determine the second thread number of the maximum consumption capacity according to the currently available second resource amount. The first processing module 502 is configured to, in a case where it is monitored that there is to-be-processed data in the first queue, acquire the data in the first queue according to the second thread number to process and obtain a processing result, and put the processing result into the second queue. The second processing module 503 is configured to, in a case where the first adjustment instruction sent by the producer is received, reduce the second thread number based on the consumption speed reduction ratio in the first adjustment instruction.
[0073] Further, in a possible implementation manner of the embodiment of the application, the fourth determination module 501 can also be configured to: In a case where the second resource amount is detected to be updated, determine a new second thread number.
[0074] It should be noted that the foregoing explanation and description of the adjustment method embodiment are also applicable to the adjustment device of this embodiment, which will not be described herein again.
[0075] In this embodiment, the consumer improves the consumption capacity to the maximum value by monitoring the resource condition of itself, determines the maximum second thread number for consumption, acquires data in the to-be-processed queue to process, and feeds back the processing result to the producer through the feedback queue. Then, after receiving the speed adjustment instruction sent by the producer, the consumption speed is adjusted according to the instruction, thereby the resource waste and system overload can be avoided, and the system performance, resource utilization and stability are significantly improved.
[0076] To achieve the above-mentioned embodiments, the present application further provides an electronic device, comprising: a processor, and a memory connected with the processor in communication; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to realize the method provided by the foregoing embodiments. To achieve the above-mentioned embodiments, the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by a processor to realize the method provided by the foregoing embodiments.
[0077] To achieve the above-mentioned embodiments, the present application further provides a computer program product, comprising a computer program, wherein the computer program is executed by a processor to realize the method provided by the foregoing embodiments.
[0078] The collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the present application comply with relevant laws and regulations and do not violate public order and good customs.
[0079] It should be noted that the personal information from the user should be collected for legal and reasonable purposes, and should not be shared or sold outside these legal uses. In addition, such collection / sharing should be carried out after the user's informed consent is received, including but not limited to informing the user to read the user agreement / user notice before the user uses the function, and signing the agreement / authorization including authorization of relevant user information. In addition, any necessary steps should be taken to safeguard and protect access to such personal information data, and ensure that other people with access to personal information data comply with their privacy policy and processes.
[0080] The present application is expected to provide embodiments in which the user can selectively prevent the use or access of personal information data. That is, the present disclosure is expected to provide hardware and / or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, the risk is minimized by limiting data collection and deleting data. In addition, such personal information is de-identified, if applicable, to protect the privacy of the user.
[0081] In the foregoing embodiment description, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present specification and the features of the different embodiments or examples, without contradiction.
[0082] Furthermore, the terms "first", "second", etc. are used herein only to describe different instances, and do not imply or suggest relative importance or a number of the indicated technical features. Thus, the features defined with "first", "second" can include at least one of the features explicitly or implicitly. In the description of the present application, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise explicitly and specifically limited.
[0083] Any process or method descriptions or descriptions of the flow diagrams described herein, or otherwise described herein, can be understood as representing modules, segments, or portions of code that include one or more executable instructions for implementing specific logical functions or steps in the processes. The various embodiments of the present application can include additional or fewer processes, steps, operations, or combinations of processes, steps, or operations as compared to those shown or described herein, and the present application's preferred embodiments should not be limited to one or more particular computer programs, set of computers, processes, operations, or steps for accomplishing the desired functionality, and one of ordinary skill in the art will recognize from the disclosure herein that the various embodiments of the present application can include any number and combination of processes, steps, operations, or computer program components as desired to implement the functionality of the various embodiments of the present application.
[0084] The logic and / or steps represented in the flow diagrams described herein, or otherwise described herein, for example, can be embodied in computer readable medium, for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor- containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions, or a combination thereof. For purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer readable medium can specifically include a hardware apparatus, such as a wired or wireless communication link, a portable computer diskette, a RAM, a ROM, an EPROM, a FLASH memory, a compact disc read-only memory (CD-ROM), or any other hardware apparatus that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by the instruction execution system, apparatus, or device, or a combination thereof. More specific examples (a non-exhaustive list) of the computer readable medium include the following: a wired or wireless communication link, a portable computer diskette, a RAM, a ROM, an EPROM, a FLASH memory, an optical fiber, and a portable compact disc read-only memory (CD-ROM). Additionally, the computer readable medium can even be paper or another suitable medium upon which the program can be printed, as the program can be electronically captured, for example, via the optical scanner of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and stored in a computer memory.
[0085] It should be understood that parts of the present application can be realized in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be realized as software or firmware stored in a memory and executed by a suitable instruction execution system. As such, if realized in hardware, and in another embodiment, any one or a combination of the following technologies known in the art can be used: discrete logic circuitry having logic gates for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gates, programmable gate arrays (PGA), field programmable gate arrays (FPGA), and the like.
[0086] Those skilled in the art of the present technology can understand that all or part of the steps carried out by the above-mentioned embodiment methods can be completed by a program instructing the relevant hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0087] In addition, each functional unit in each embodiment of the present application can be integrated in one processing module, or each unit can be physically present separately, or two or more units can be integrated in one module. The above-mentioned integrated module can be realized in the form of hardware or in the form of a software functional module. The integrated module, if realized in the form of a software functional module and sold or used as an independent product, can also be stored in a computer readable storage medium.
[0088] The above-mentioned storage medium can be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it should be understood that the above-mentioned embodiments are exemplary and cannot be understood as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above-mentioned embodiments within the scope of the present application.
Claims
1. A method of conditioning, characterized by, The method is executed by a producer and includes the following steps: determining a first thread number of maximum production capacity according to a first resource amount currently available; generating data to be processed according to the first thread number; putting the data to be processed into a first queue and determining a production speed of data in the first queue; monitoring a second queue of consumer feedback and determining a consumption speed of the consumer in processing data in the first queue; adjusting the production speed or the consumption speed according to a difference between the production speed and the consumption speed.
2. The method of claim 1, wherein, The adjusting of the production speed or the consumption speed according to the difference between the production speed and the consumption speed includes: in a case where the production speed is greater than the consumption speed, reducing the first thread number based on the difference; in a case where the consumption speed is greater than the production speed, calculating a consumption speed reduction ratio based on the difference and sending a first adjustment instruction containing the consumption speed reduction ratio to the consumer; or in a case where the production speed is equal to the consumption speed, not adjusting.
3. The method of claim 2, wherein, After the adjusting of the production speed or the consumption speed according to the difference between the production speed and the consumption speed, the method further includes: in a case where the first resource amount is detected to be updated, determining a new first thread number and sending a second adjustment instruction to the consumer, wherein the second adjustment instruction is used to adjust the consumption speed to a maximum value; re-determining the difference between the production speed and the consumption speed based on the new first thread number and adjusting.
4. The method of claim 2, wherein, After the adjusting of the production speed or the consumption speed according to the difference between the production speed and the consumption speed, the method further includes: in a case where a consumption speed change is detected and the consumption speed change is irrelevant to the first adjustment instruction, re-adjusting the production speed or the consumption speed based on a production speed corresponding to the first thread number.
5. A method of conditioning, characterized by, The method is executed by a consumer and includes the following steps: determining a second thread number of maximum consumption capacity according to a second resource amount currently available; in a case where it is monitored that there is data to be processed in a first queue, acquiring data in the first queue for processing according to the second thread number, obtaining a processing result, and putting the processing result into a second queue; in a case where a first adjustment instruction sent by a producer is received, reducing the second thread number based on a consumption speed reduction ratio in the first adjustment instruction.
6. The method of claim 5, wherein, The method further includes: in a case where the second resource amount is detected to be updated, determining a new second thread number; acquiring data in the first queue for processing according to the new second thread number.
7. A regulating device, characterized in that The apparatus is configured to be arranged in a producer and includes: a first determination module configured to determine a first thread number of maximum production capacity according to a first resource amount currently available; a generation module configured to generate data to be processed according to the first thread number; a second determination module configured to put the data to be processed into a first queue and determine a production speed of data in the first queue; a third determination module configured to monitor a second queue of consumer feedback and determine a consumption speed of the consumer in processing data in the first queue; An adjusting module is configured to adjust the production speed or the consumption speed according to a difference between the production speed and the consumption speed.
8. A regulating device, characterized by The device is configured to be arranged in a consumer, and the device comprises: A fourth determining module is configured to determine a second thread number of the maximum consumption capacity according to a second resource amount currently available; A first processing module is configured to, in a case where it is monitored that there is data to be processed in the first queue, acquire data in the first queue for processing according to the second thread number, obtain a processing result, and put the processing result into a second queue; A second processing module is configured to, in a case where a first adjusting instruction sent by the producer is received, reduce the second thread number based on a consumption speed reduction ratio in the first adjusting instruction.
9. An electronic device, comprising: Comprise: A processor, and a memory connected in communication with the processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the adjusting method in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the adjusting method in any one of claims 1-6.
11. A computer program product, characterised in that, Comprise a computer program, and the computer program is executed by the processor to implement the adjusting method in any one of claims 1-6.