Query command processing method and device and electronic equipment
By setting the interception threshold for the temporary queue in the query command line system, dynamically managing the number of query commands, the problem of system overload is solved, and the operation efficiency is improved and the user experience is improved.
Patent Information
- Application Number
- CN202510081511.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-01-17
AI Technical Summary
Query command line systems are prone to overload when receiving a large number of query commands in a short time, resulting in reduced operational efficiency.
By setting the interception threshold for the temporary queue, dynamically manage the number of query commands in the temporary queue of the query command line system. If the number of query commands waiting to be processed reaches the interception threshold, the new query command will be intercepted to avoid overloading.
It effectively avoids overload caused by the influx of excessive query commands, ensures the operation efficiency of query command line systems, and provides timely feedback to improve the user experience.
Smart Images

Figure CN119883135A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data query technology, and in particular to a query command processing method, device and electronic device. Background Art
[0002] The storage system saves, manages and accesses data by managing disk arrays. In order to provide interactive services to users, the storage system usually sets up a query command line system. The query command line system responds to the query commands entered by the user and feeds back the query results to the user.
[0003] In the related art, the query command line system puts the received query commands into a queue and executes the query commands according to the queue. However, once a large number of query commands are received in a short period of time, it is easy to exceed the processing limit of the query command line system, causing the query command line system to be overloaded and reducing the operating efficiency of the query command line system. Summary of the invention
[0004] The present application provides a query command processing method, device and electronic device to solve the problem of query command line system being easily overloaded and causing operating efficiency in the related art.
[0005] A first aspect of the present application provides a method for processing query commands, which is applied to a query command line system set in a storage system, and includes the following steps: obtaining the number of query commands waiting to be processed in a temporary queue of the query command line system; if the number of query commands waiting to be processed reaches an interception threshold of the temporary queue, intercepting new query commands issued by the user to the storage system, wherein the interception threshold represents an upper limit on the number of caches in the temporary queue; if the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue, placing the new query commands issued by the user to the storage system into the temporary queue.
[0006] Optionally, before intercepting a new query command sent by a user to the storage system, the method further includes: setting an interception threshold of the temporary queue during the programming phase of the query command line system, and adjusting the interception threshold of the temporary queue during the operation phase of the query command line system.
[0007] Optionally, the interception threshold of the temporary queue is set during the programming stage of the query command line system, including: obtaining the average number of commands processed by the query command line system and the acceptable delay; based on the average number of commands processed by the query command line system and the acceptable delay, determining the interception threshold of the temporary queue.
[0008] Optionally, adjusting the interception threshold of the temporary queue during the operation phase of the query command line system includes: obtaining a processor core usage rate of the query command line system; and adjusting the interception threshold of the temporary queue according to the processor core usage rate.
[0009] Optionally, after placing the new query command sent by the user to the storage system into the temporary queue, the method further includes: identifying the priority of the query command in the temporary queue; and executing the target query action based on the priority of the query command.
[0010] Optionally, a query action is executed based on the priority of the query command, including: placing the query command into a corresponding priority queue according to the priority of the query command; and executing a target query action according to the priority and processing weight of the priority queue, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.
[0011] Optionally, the target query action includes: processing query commands waiting to be executed in a priority queue through a multi-threading mechanism.
[0012] Optionally, threads in a multi-threading mechanism are bound to corresponding processor cores, and query commands waiting to be executed in a priority queue are processed through the multi-threading mechanism, including: obtaining the number of query commands being processed on multiple threads; allocating query commands waiting to be executed to multiple threads based on the number of query commands being processed on multiple threads and a preset allocation principle, wherein the preset allocation principle is: keeping the difference in the total number of query commands between threads less than a balance threshold, the total number of query commands being the sum of the number of query commands being processed on the thread and the number of allocated query commands; and using multiple threads to process query commands in parallel.
[0013] A second aspect of the present application provides a query command processing device, which is applied to a query command line system set in a storage system, including: an acquisition module, used to obtain the number of query commands waiting to be processed in a temporary queue of the query command line system; an interception module, used to intercept new query commands issued by a user to the storage system if the number of query commands waiting to be processed reaches an interception threshold of the temporary queue, wherein the interception threshold represents an upper limit on the number of caches in the temporary queue; and a processing module, used to put the new query commands issued by the user to the storage system into the temporary queue if the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue.
[0014] Optionally, the query command processing device also includes: a setting module, which is used to set the interception threshold of the temporary queue during the programming stage of the query command line system before intercepting a new query command issued by the user to the storage system, and adjust the interception threshold of the temporary queue during the operation stage of the query command line system.
[0015] Optionally, the setting module is further used to obtain the average number of commands processed by the query command line system and the acceptable delay; based on the average number of commands processed by the query command line system and the acceptable delay, determine the interception threshold of the temporary queue.
[0016] Optionally, the setting module is further used to obtain the processor core usage of the query command line system; and adjust the interception threshold of the temporary queue according to the processor core usage.
[0017] Optionally, the query command processing device also includes: an identification module and an execution module, wherein the identification module is used to identify the priority of the query command in the temporary queue after placing the new query command issued by the user to the storage system into the temporary queue; the execution module is used to execute the target query action based on the priority of the query command.
[0018] Optionally, the execution module is further used to place the query command into a corresponding priority queue according to the priority of the query command; and execute the target query action according to the priority and processing weight of the priority queue, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.
[0019] Optionally, the target query action includes: processing query commands waiting to be executed in a priority queue through a multi-threading mechanism.
[0020] Optionally, threads in the multi-threading mechanism are bound to corresponding processor cores, and the execution module is further used to obtain the number of query commands being processed on multiple threads; based on the number of query commands being processed on multiple threads and a preset allocation principle, query commands waiting to be executed are allocated to multiple threads, wherein the preset allocation principle is: keeping the difference in the total number of query commands between threads less than a balance threshold, the total number of query commands is the sum of the number of query commands being processed on the thread and the number of allocated query commands; and using multiple threads to process query commands in parallel.
[0021] The third aspect of the present application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a method for processing query commands as described in the above embodiment.
[0022] The fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. The program is executed by a processor to implement a method for processing a query command as described in the above embodiment.
[0023] The fifth aspect of the present application provides a computer program, which, when executed, is used to implement the query command processing method of the above embodiment.
[0024] Therefore, this application includes the following beneficial effects:
[0025] The embodiment of the present application can dynamically manage the number of query commands in the temporary queue of the query command line system by setting the interception threshold of the query command line system. When the number of query commands to be processed reaches the interception threshold of the temporary queue, the new command is intercepted, effectively avoiding the query command line system from being overloaded due to the influx of too many query commands, ensuring the operating efficiency of the query command line system, and at the same time, by intercepting new query commands, avoiding the new query commands from entering a long waiting time, and timely providing feedback to the user through interception, thereby improving the user's experience. Thus, the problem of the query command line system being easily overloaded and causing operating efficiency in the related art is solved.
[0026] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0028] Figure 1 This is an overall design diagram of a query command line system provided according to an embodiment of the present application;
[0029] Figure 2 A flowchart of a method for processing a query command provided according to an embodiment of the present application;
[0030] Figure 3 This is an example diagram of a temporary storage queue provided according to an embodiment of the present application;
[0031] Figure 4 A block diagram of a query command processing device provided according to an embodiment of the present application;
[0032] Figure 5 Schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0034] It should be noted that the query command processing method in the following embodiments is applied to a query command line system, and the query command line system is set in the storage main process of the storage system, such as Figure 1As shown in the figure, the query command processing system includes a command front end and a storage main process. Users enter query commands through SSH or GUI (Graphical User Interface). There are multiple instances in the command front end. Each command will pull up an instance of the command front end, that is, there is a one-to-one correspondence between the command and the command front end instance. The command front end instance will pass the query command to the storage main process through inter-process communication. After the calculation or query results in the storage main process are obtained, they will be returned to the command front end.
[0035] based on Figure 1 The system shown below will be combined with Figure 2 The processing method of the query command is explained, such as Figure 2 As shown, the query command processing method includes the following steps:
[0036] In step S101, the number of query commands waiting to be processed in the temporary storage queue of the query command line system is obtained.
[0037] A temporary queue is a queue structure used to temporarily store data, usually used to buffer data between different processing stages. It follows the first-in-first-out principle, that is, the data that enters the queue first will be processed first. The main function of the temporary queue is to smooth the differences between processing speeds and data sources, ensuring that data is not lost or overflowed during transmission and processing.
[0038] Therefore, the embodiment of the present application can temporarily store the query commands input by the user through the temporary queue, and can obtain the number of query commands temporarily stored in the temporary queue by specifying a name or tool. The number of query commands temporarily stored is the number of query commands waiting to be processed.
[0039] In step S102, if the number of query commands waiting to be processed reaches the interception threshold of the temporary storage queue, new query commands sent by the user to the storage system are intercepted, wherein the interception threshold represents the upper limit of the buffer quantity of the temporary storage queue.
[0040] Since the processing resources of the storage system are limited, if there are too many query commands in the temporary queue, it is easy to cause the query command line system to be overloaded, thereby reducing the operating efficiency of the command line system. At the same time, it will also cause new query commands to wait for a long time, reducing the user experience.
[0041] To this end, the embodiment of the present application can set an interception threshold of the temporary queue so that the number of query commands in the temporary queue is kept within the interception threshold, effectively avoiding the overload of the query command line system caused by the influx of too many query commands, ensuring the operating efficiency of the query command line system, and at the same time, by intercepting new query commands, avoiding new query commands from entering a long waiting time, and providing users with timely feedback through interception, thereby improving the user experience.
[0042] In some embodiments, before intercepting a new query command sent by a user to the storage system, it also includes: setting an interception threshold of the temporary queue during the programming phase of the query command line system, and adjusting the interception threshold of the temporary queue during the operation phase of the query command line system.
[0043] It can be understood that the embodiments of the present application can set an interception threshold during the programming stage, so that during the operation of the query command line system, the number of query commands in the temporary queue can be maintained according to the interception threshold, thereby improving the operating efficiency of the query command line system; during the actual operation of the query command line system, the embodiments of the present application can adjust the interception threshold of the temporary queue in real time, so that the interception threshold conforms to the actual situation of the current operation, realizes dynamic management of the interception threshold, and improves the applicability of interception.
[0044] In some embodiments, the interception threshold of the temporary queue is set during the programming stage of the query type command line system, including: obtaining the average number of commands processed by the query type command line system and the acceptable delay; based on the average number of commands processed by the query type command line system and the acceptable delay, determining the interception threshold of the temporary queue.
[0045] It can be understood that the embodiments of the present application can set the interception threshold of the temporary queue based on the average number of commands processed by the query command line system and the acceptable delay, thereby comprehensively considering the processing capacity of the query command line system and the query speed, while ensuring the operating efficiency of the query command line system, taking into account the query response speed to improve the user's query experience.
[0046] like Figure 3 As shown, the interception threshold is represented by X, and the interception threshold setting rule is: X = the average number of commands that the query command line system can process per second * the maximum delay that the query command line system can accept, and the unit of the maximum delay can be milliseconds or seconds, etc. For example: if the query command line system takes an average of 100ms to execute a command, and can process 10 commands per second, assuming that the query command line system product expects the maximum delay to be presented to the outside world is 1.2 seconds, then X = 10 * 1.2 = 12, so the interception threshold is 12.
[0047] In one embodiment of the present application, the interception threshold of the temporary queue is adjusted during the operation phase of the query command line system, including: obtaining the processor core usage of the query command line system; and adjusting the interception threshold of the temporary queue according to the processor core usage.
[0048] It is understandable that since the processor core utilization rate will change, when the processor core utilization rate is low, it means that the processing resources are abundant, and more processor cores can be provided to the query command line system; when the processor core utilization rate is high, it means that the processing resources are tight, and more processor cores cannot be provided at this time. Therefore, during the actual operation of the query command line system, the embodiment of the present application timely adjusts the interception threshold according to the processor core utilization rate to reduce the competition for processing resources, improve the operating efficiency of the processor, and prevent more severe effects.
[0049] In some embodiments, adjusting the interception threshold of the temporary queue according to the processor core usage includes: obtaining a correspondence table between the processor core usage and the interception threshold, and determining the interception threshold corresponding to the processor core usage according to the correspondence table.
[0050] It can be understood that the embodiment of the present application can pre-calibrate the correspondence between the processor core usage and the interception threshold, and the correspondence can accurately reflect the relationship between the processor core usage and the interception threshold. Therefore, through the calibrated correspondence table, not only the interception threshold can be quickly determined, but also the interception threshold corresponding to the processor core usage can be accurately determined, thereby realizing fast and accurate adjustment of the interception threshold.
[0051] For example, when the processing core usage reaches 70%, 80%, and 90%, it means that the processor is under great pressure. At this time, the upper limit X of the temporary queue can be dynamically reduced to half of the current value according to the corresponding relationship table to reduce the execution frequency of the query command line system command line, thereby reducing the pressure on the processor and preventing worse effects. On the contrary, the interception threshold can be appropriately increased under low load conditions to make full use of processing resources.
[0052] In one embodiment of the present application, after intercepting a new query command sent by a user to the storage system, it also includes: generating a query failure prompt, and returning the failure prompt through the command front end.
[0053] The failure prompt may be a text prompt, a voice prompt, an animation prompt, etc. For example, after intercepting a new query command sent by a user to the storage system, a text prompt of "the current command is busy, please try again later" may be returned.
[0054] It is understandable that the embodiment of the present application can promptly prompt the user of query failure after intercepting the user's new query command, thereby avoiding the problem of poor experience caused by the user waiting for a long time, thereby providing timely prompt feedback, allowing the user to understand the status of the query in a timely manner and improving the user's usage experience.
[0055] In step S103, if the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue, the new query command sent by the user to the storage system is placed in the temporary queue.
[0056] It is understandable that if the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue, the new query command sent by the user to the storage system will be normally placed in the temporary queue, ensuring that the commands can be received and processed in an orderly manner.
[0057] In some embodiments, after placing the new query command sent by the user to the storage system into the temporary queue, the method further includes: identifying the priority of the query command in the temporary queue; and executing the target query action based on the priority of the query command.
[0058] It is understandable that the embodiments of the present application can set priorities for query commands and process query commands in a priority manner, thereby ensuring that query commands with high priorities can be processed first, important tasks can be processed in a timely manner, the waiting time of important tasks can be reduced, and rational use of resources can be achieved.
[0059] In some embodiments, identifying the priority of the query command in the temporary queue includes: identifying a priority identifier carried by the query command, and determining the priority of the query command according to the priority identifier.
[0060] It can be understood that the priority identifier is used to indicate the priority of the query command. The priority identifier can be a character identifier, such as the character -fast, etc. The embodiment of the present application can set a priority identifier for the query command, and realize rapid classification of the query command through the priority identifier, so as to quickly and accurately distinguish the importance of the query command.
[0061] In some embodiments, a query action is executed based on the priority of the query command, including: placing the query command into a corresponding priority queue according to the priority of the query command; and executing a target query action according to the priority and processing weight of the priority queue, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.
[0062] Among them, the priority queue can be set with different priorities according to actual needs, such as a normal priority queue and a high priority queue. The priority of the high priority queue is higher than that of the normal priority queue. In the embodiment of the present application, the high priority queue is executed first, so that important query commands are executed quickly. The processing right indicates the number of query commands that the priority queue is allowed to process during one execution process, which can be set according to the priority of the priority queue. For example, the query command of the high priority queue is more important, and the processing right of the high priority queue can be set to be greater.
[0063] Therefore, priority can ensure that important query commands can be executed quickly, meet users' query needs, and improve users' experience. Processing weight can prevent a priority queue from occupying resources for a long time, thereby improving the overall response speed and message processing efficiency.
[0064] For example, if two priority queues are set, namely the normal priority queue and the high priority queue, if the query command carries the "-fast" flag, it means that the corresponding query command is of high priority and is placed in the high priority queue. If the query command carries any flag or carries the normal flag, the corresponding query command is placed in the normal priority queue. The weight of the normal priority queue is M, and the weight of the high priority queue is N.
[0065] The processing principle of the two priority queues is: the ratio of the maximum number of commands processed by the two queues is allocated according to the weight value. For example, when M is 2 and N is 5, the high priority queue must give up the execution right after processing up to 5 commands. At this time, if it is judged that there are commands waiting to be executed in the ordinary priority queue, the execution right will be given to the high priority queue after processing up to 2 commands from the low priority queue, and the cycle will be repeated. In this way, it is ensured that high priority commands can be processed in time, and ordinary priority commands will not be ignored for a long time.
[0066] In some embodiments, the embodiments of the present application can set a waiting time threshold for the query command in the temporary queue. When the actual waiting time of the query command in the temporary queue reaches the waiting time threshold, the priority of the target query command whose actual waiting time reaches the waiting time threshold is identified. If the priority of the target query command is less than the preset level, the priority of the target query command is increased, otherwise the priority of the target query command remains unchanged.
[0067] The preset level is used to indicate whether the priority of the target query command is allowed to be upgraded. It can be set according to the actual situation. For example, the priority of the query command is divided into the first priority and the second priority. The second priority is executed before the first priority. Then the preset level can be set to the second priority. If the priority of the target query command is the first priority at this time, the priority of the target query command is upgraded to the second priority; if the priority of the target query command is the second priority at this time, the priority of the target query command remains unchanged.
[0068] Therefore, the embodiment of the present application can increase the priority of query commands with low priority when the waiting time of the query command is long, so that the corresponding query command can be executed first, thereby reducing the waiting time of the query command, reducing the user's waiting time, and giving the user a better query experience.
[0069] In some embodiments, the target query action includes: processing query commands waiting to be executed in a priority queue through a multi-threading mechanism, so as to improve the processing efficiency of the query commands by adopting the multi-threading mechanism,
[0070] In some embodiments, threads in a multi-threading mechanism are bound to corresponding processor cores, and query commands waiting to be executed in a priority queue are processed through the multi-threading mechanism, including: obtaining the number of query commands being processed on multiple threads; based on the number of query commands being processed on multiple threads and a preset allocation principle, query commands waiting to be executed are allocated to multiple threads, wherein the preset allocation principle is: keeping the difference in the total number of query commands between threads less than a balance threshold, the total number of query commands being the sum of the number of query commands being processed on the thread and the number of allocated query commands; and using multiple threads to process query commands in parallel.
[0071] The balance threshold refers to a value that keeps the difference in the total number of query commands between threads within a certain range, and can be specifically calibrated or set. For example, the balance threshold can be set to 1 or 2, etc., so that resources are evenly allocated between threads.
[0072] It can be understood that the embodiment of the present application binds the threads in the multi-threading mechanism to the processor cores. For example, if the number of allocated threads is F, F cores are determined from the CPU (Central Processing Unit) core, and the F threads are bound to the F cores one by one, that is, one core is one thread. This not only disperses the processing pressure to the F CPU cores, but also ensures that the CPU utilization rate does not exceed the upper limit through core binding; at the same time, the parallel processing capabilities of multiple threads are used to improve the processing efficiency of query commands.
[0073] In some embodiments, the processing principle of multiple command processing threads is: the execution of each command line is regarded as a task, and each task is assigned to each thread in a circular manner to ensure that the sum of the number of tasks being executed and the number of tasks in queue on all threads does not exceed the balance threshold. Taking the balance threshold as 1 as an example, assuming that F is 3, then there are 3 threads processing command lines in parallel. If there are a total of 5 commands in the priority queue, then the distribution results of these 5 commands are: thread 1, thread 2, thread 3, thread 1, thread 2, ensuring that each thread has a task to execute and the load is balanced, and the sum of the number of tasks being executed and the number of tasks in queue on each thread is 2, 2, and 1 respectively. In the actual execution process, if the command execution speed on thread 2 is faster, both commands are processed, and at this time a new command comes, then the newly added command will be assigned to thread 2, and the number of tasks at this time is 2, 1, and 1 respectively, and the load is balanced again.
[0074] Therefore, through the processing method of dynamic command line threads, the parallel processing capability of commands is improved, the processing speed of commands is accelerated, especially the execution efficiency in the scenario of large-scale execution of commands is significantly improved, thereby improving the user experience.
[0075] According to the query command processing method proposed in the embodiment of the present application, the number of query commands in the temporary queue of the query command line system can be dynamically managed by setting the interception threshold of the query command line system. When the number of query commands to be processed reaches the interception threshold of the temporary queue, the new command is intercepted, which effectively avoids the query command line system from being overloaded due to the influx of too many query commands, ensures the operating efficiency of the query command line system, and at the same time, by intercepting new query commands, avoids the new query commands from entering a long waiting time, and can timely provide user feedback through interception to improve the user experience. In this way, the problem of query command line system being easily overloaded and causing operating efficiency in the related art is solved.
[0076] Next, a query command processing device according to an embodiment of the present application is described with reference to the accompanying drawings. The device is applied to a query command line system set in a storage system.
[0077] Figure 4 It is a block diagram of a query command processing device according to an embodiment of the present application.
[0078] like Figure 4 As shown, the query command processing device 10 includes: an acquisition module 100, an interception module 200 and a processing module 300.
[0079] Among them, the acquisition module 100 is used to obtain the number of query commands waiting to be processed in the temporary queue of the query command line system; the interception module 200 is used to intercept new query commands issued by the user to the storage system if the number of query commands waiting to be processed reaches the interception threshold of the temporary queue, wherein the interception threshold represents the upper limit of the cache quantity of the temporary queue; the processing module 300 is used to put the new query commands issued by the user to the storage system into the temporary queue if the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue.
[0080] In one embodiment of the present application, the query command processing device 10 also includes: a setting module, which is used to set the interception threshold of the temporary queue in the programming stage of the query command line system before intercepting the new query command issued by the user to the storage system, and adjust the interception threshold of the temporary queue in the operation stage of the query command line system.
[0081] In one embodiment of the present application, the setting module is further used to obtain the average number of commands processed by the query type command line system and the acceptable delay; based on the average number of commands processed by the query type command line system and the acceptable delay, determine the interception threshold of the temporary queue.
[0082] In one embodiment of the present application, the setting module is further used to obtain the processor core usage of the query command line system; and adjust the interception threshold of the temporary queue according to the processor core usage.
[0083] In one embodiment of the present application, the query command processing device 10 also includes: an identification module and an execution module, wherein the identification module is used to identify the priority of the query command in the temporary queue after placing the new query command issued by the user to the storage system into the temporary queue; the execution module is used to execute the target query action based on the priority of the query command.
[0084] In one embodiment of the present application, the execution module is further used to place the query command into a corresponding priority queue according to the priority of the query command; and execute the target query action according to the priority and processing weight of the priority queue, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.
[0085] In one embodiment of the present application, the target query action includes: processing query commands waiting to be executed in a priority queue through a multi-threading mechanism.
[0086] In one embodiment of the present application, threads in a multi-threading mechanism are bound to corresponding processor cores, and an execution module is further used to obtain the number of query commands being processed on multiple threads; based on the number of query commands being processed on multiple threads and a preset allocation principle, query commands waiting to be executed are allocated to multiple threads, wherein the preset allocation principle is: keeping the difference in the total number of query commands between threads less than a balance threshold, the total number of query commands being the sum of the number of query commands being processed on the thread and the number of allocated query commands; and using multiple threads to process query commands in parallel.
[0087] It should be noted that the above explanation of the embodiment of the method for processing a query command is also applicable to the device for processing a query command of this embodiment, and will not be repeated here.
[0088] According to the query command processing device proposed in the embodiment of the present application, the number of query commands in the temporary queue of the query command line system can be dynamically managed by setting the interception threshold of the query command line system. When the number of query commands to be processed reaches the interception threshold of the temporary queue, the new command is intercepted, which effectively avoids the query command line system from being overloaded due to the influx of too many query commands, ensures the operating efficiency of the query command line system, and at the same time, by intercepting new query commands, avoids the new query commands from entering a long waiting time, and can timely provide user feedback through interception, thereby improving the user experience. In this way, the problem of query command line system being easily overloaded and causing operating efficiency in the related art is solved.
[0089] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0090] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .
[0091] When the processor 502 executes the program, the query command processing method provided in the above embodiment is implemented.
[0092] Furthermore, the electronic device further comprises:
[0093] The communication interface 503 is used for communication between the memory 501 and the processor 502 .
[0094] The memory 501 is used to store computer programs that can be executed on the processor 502 .
[0095] The memory 501 may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory.
[0096] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0097] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.
[0098] The processor 502 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0099] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for processing the query command as described above is implemented.
[0100] The embodiment of the present application also provides a computer program, which, when executed, is used to implement the query command processing method as described in the above embodiment.
[0101] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. 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 this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0102] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0103] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0104] It should be understood that the various parts of the present application can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, the steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0105] A person of ordinary skill in the art may understand that all or part of the steps carried by the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the above-mentioned program may be stored in a computer-readable storage medium, which, when executed, includes one of the steps of the method embodiment or a combination thereof.
[0106] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for processing a query command, characterized in that: The method is applied to a query command line system set in a storage system, and includes the following steps: Get the number of query commands waiting to be processed in the temporary queue of the query command line system; If the number of query commands waiting to be processed reaches the interception threshold of the temporary storage queue, intercepting new query commands sent by the user to the storage system, wherein the interception threshold represents the upper limit of the cache quantity of the temporary storage queue; If the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue, the new query command sent by the user to the storage system is placed in the temporary queue.
2. The method for processing a query command according to claim 1, characterized in that: Before intercepting new query commands sent by users to the storage system, the following are also included: The interception threshold of the temporary queue is set during the programming phase of the query command line system, and the interception threshold of the temporary queue is adjusted during the running phase of the query command line system.
3. The method for processing a query command according to claim 2, characterized in that: The step of setting the interception threshold of the temporary queue in the programming stage of the query command line system includes: Get the average number of commands processed by the query command line system and the acceptable delay; The interception threshold of the temporary queue is determined based on the average number of commands processed by the query command line system and the acceptable delay.
4. The method for processing a query command according to claim 2, characterized in that: The step of adjusting the interception threshold of the temporary queue during the query command line system operation phase includes: Obtaining the processor core usage rate of the query command line system; The interception threshold of the temporary queue is adjusted according to the core usage of the processor.
5. The method for processing a query command according to claim 1, characterized in that: After placing the new query command sent by the user to the storage system into the temporary storage queue, the method further includes: Identifying the priority of the query command in the temporary queue; A target query action is executed based on the priority of the query command.
6. The method for processing a query command according to claim 5, characterized in that: The performing the query action based on the priority of the query command includes: Putting the query command into a corresponding priority queue according to the priority of the query command; The target query action is executed according to the priority and processing weight of the priority queue, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.
7. The method for processing a query command according to claim 6, characterized in that: The target query action includes: processing the query commands waiting to be executed in the priority queue through a multi-thread mechanism.
8. The method for processing a query command according to claim 7, characterized in that: The threads in the multi-thread mechanism are bound to the processor cores accordingly, and the processing of the query commands waiting to be executed in the priority queue by the multi-thread mechanism includes: Get the number of query commands being processed on multiple threads; Based on the number of query commands being processed on the multiple threads and a preset allocation principle, query commands waiting to be executed are allocated to the multiple threads, wherein the preset allocation principle is: keeping the difference in the total number of query commands between the threads smaller than a balance threshold, and the total number of query commands is the sum of the number of query commands being processed on the threads and the number of allocated query commands; The query commands are processed in parallel using the multiple threads.
9. A query command processing device, characterized in that: The device is applied to a query command line system set in a storage system, and includes: An acquisition module is used to obtain the number of query commands waiting to be processed in the temporary queue of the query command line system; An interception module, configured to intercept a new query command issued by a user to the storage system if the number of query commands waiting to be processed reaches an interception threshold of the temporary storage queue, wherein the interception threshold represents an upper limit of the cache quantity of the temporary storage queue; The processing module is configured to put a new query command sent by a user to the storage system into the temporary queue if the number of query commands waiting to be processed does not reach the interception threshold of the temporary queue.
10. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for processing the query command according to any one of claims 1 to 8.
Citation Information
Patent Citations
Resource proxy machine facing illumination variant equipment
CN101196832A
Flow management device and method for saving cache resource
CN102831077A
Distributed cache high-availability processing method and system based on multithreading asynchronous double writing
CN103500120A
Network data platform based on local area network
CN105978739A
Providing fine-grained access remote command execution for virtual machine instances in a distributed computing environment
CN108292349A