Query command processing method and device, and electronic equipment

By setting temporary queue interception thresholds and priority management in query command-line systems, combined with multi-threaded processing, the overload problem of query command-line systems was solved, improving operating efficiency and user experience.

CN119883135BActive Publication Date: 2025-12-19INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510081511.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-12-19
Estimated Expiration
2045-01-17

AI Technical Summary

Technical Problem

Query-based command-line systems are prone to overload when receiving a large number of query commands in a short period of time, leading to reduced operating efficiency and a degraded user experience.

Method used

By setting a threshold for intercepting temporary queues in the query command-line system, the number of query commands can be dynamically managed, new query commands exceeding the threshold can be intercepted, and the threshold can be adjusted based on priority and processor core utilization. Query commands in the priority queue can be processed using a multi-threaded mechanism.

Benefits of technology

It effectively avoids overloading of the query command line system, ensures running efficiency, reduces the waiting time of query commands, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883135B_ABST
    Figure CN119883135B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data query, in particular to a query command processing method and device and electronic equipment, wherein the method comprises the following steps: acquiring the quantity of query commands waiting for processing in a temporary queue of a query command line system; if the quantity of query commands waiting for processing reaches an interception threshold of the temporary queue, intercepting a new query command issued by a user to a storage system, wherein the interception threshold represents the upper limit of the cache quantity of the temporary queue; and if the quantity of query commands waiting for processing does not reach the interception threshold of the temporary queue, putting the new query command issued by the user to the storage system into the temporary queue. Thus, the query command line system in the related art is prevented from being overloaded and the running efficiency and the like are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data query, in particular to a query command processing method and device and electronic equipment. BACKGROUND

[0002] A storage system implements saving, management and access of data by managing a disk array. In order to provide interactive services for users, the storage system usually sets a query command line system. The query command line system feeds back a query result to a user in response to a query command input by the user.

[0003] In the related art, the query command line system puts a received query command into a queue and executes the query command according to the queue. However, once a large number of query commands are received within a short time, the processing upper limit of the query command line system is easily exceeded, which causes the query command line system to be overloaded and reduces the running efficiency of the query command line system. SUMMARY

[0004] The present application provides a query command processing method, device and electronic equipment to solve the problem of the query command line system being easily overloaded in the related art, which causes the running efficiency to be reduced.

[0005] The first aspect of the present application provides a query command processing method. The method 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 for processing in a temporary queue of the query command line system; if the number of query commands waiting for processing reaches an interception threshold of the temporary queue, intercepting a new query command issued by a user to the storage system, wherein the interception threshold represents the upper limit of the cache number of the temporary queue; and if the number of query commands waiting for processing does not reach the interception threshold of the temporary queue, putting the new query command issued by the user to the storage system into the temporary queue.

[0006] Optionally, before intercepting the new query command issued by the user to the storage system, the method further includes: setting the interception threshold of the temporary queue in a programming stage of the query command line system and adjusting the interception threshold of the temporary queue in a running stage of the query command line system.

[0007] Optionally, setting the interception threshold of the temporary queue in the programming stage of the query command line system includes: obtaining the average number of commands processed by the query command line system and the acceptable delay time; and determining 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 time.

[0008] Optionally, adjusting the interception threshold of the temporary queue in the running stage of the query command line system includes: obtaining the usage rate of a processor core of the query command line system; and adjusting the interception threshold of the temporary queue according to the usage rate of the processor core.

[0009] Optionally, after putting the new query command issued by the user to the storage system into the staging queue, further comprising: identifying the priority of the query command in the staging queue; and performing the target query action based on the priority of the query command.

[0010] Optionally, performing the query action based on the priority of the query command comprises: putting the query command into a corresponding priority queue according to the priority of the query command; and performing the target query action according to the priority of the priority queue and a processing weight, 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 comprises: processing the query command waiting for execution in the priority queue through a multi-thread mechanism.

[0012] Optionally, the thread in the multi-thread mechanism is correspondingly bound to a processor core, and processing the query command waiting for execution in the priority queue through the multi-thread mechanism comprises: obtaining the number of query commands being processed on the plurality of threads; allocating the query command waiting for execution to the plurality of threads based on the number of query commands being processed on the plurality of threads and a preset allocation principle, wherein the preset allocation principle is to keep the difference between the total number of query commands between threads less than an equilibrium threshold, and 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 processing the query command in parallel using the plurality of threads.

[0013] The second aspect embodiment of the present application provides a query command processing device, which is applied to a query command line system arranged in a storage system, and comprises: an obtaining module, configured to obtain the number of query commands waiting for processing in a staging queue of the query command line system; an intercepting module, configured to intercept a new query command issued by a user to the storage system if the number of query commands waiting for processing reaches an intercept threshold of the staging queue, wherein the intercept threshold represents an upper limit of the cache quantity of the staging queue; and a processing module, configured to put the new query command issued by the user to the storage system into the staging queue if the number of query commands waiting for processing does not reach the intercept threshold of the staging queue.

[0014] Optionally, the query command processing device further comprises a setting module, configured to set the intercept threshold of the staging 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 intercept threshold of the staging queue in the running stage of the query command line system.

[0015] Optionally, the setting module is further configured to obtain the average number of commands processed by the query command line system and the acceptable delay time; and determine the intercept threshold of the staging queue based on the average number of commands processed by the query command line system and the acceptable delay time.

[0016] Optionally, the setting module is further configured to acquire a processor core usage rate of the query command line system, and adjust the interception threshold of the temporary queue according to the processor core usage rate.

[0017] Optionally, the processing apparatus of the query command further comprises an identifying module and an executing module, wherein the identifying module is configured to identify a priority of the query command in the temporary queue after the new query command issued by the user to the storage system is put into the temporary queue; and the executing module is configured to execute a target query action based on the priority of the query command.

[0018] Optionally, the executing module is further configured to put 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 of the priority queue and a processing weight, wherein the processing weight represents a number of query commands allowed to be processed in the corresponding priority queue.

[0019] Optionally, the target query action comprises processing the query command waiting for execution in the priority queue through a multi-thread mechanism.

[0020] Optionally, a thread in the multi-thread mechanism is correspondingly bound to a processor core, and the executing module is further configured to acquire a number of query commands being processed on the multiple threads, and distribute the query command waiting for execution to the multiple threads based on the number of query commands being processed on the multiple threads and a preset distribution principle, wherein the preset distribution principle is to keep a difference between total numbers of query commands among the threads less than an equalization threshold, the total number of query commands being a sum of the number of query commands being processed on the thread and the number of distributed query commands, and the multiple threads are used to process the query command in parallel.

[0021] The third aspect of the present application provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor executes the program to implement the query command processing method of the above-mentioned embodiments.

[0022] The fourth aspect of the present application provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the query command processing method of the above-mentioned embodiments.

[0023] The fifth aspect of the present application provides a computer program, which is executed to implement the query command processing method of the above-mentioned embodiments.

[0024] Therefore, the present application has the following beneficial effects:

[0025] The embodiment of the present application can set an interception threshold of the query command line system, dynamically manage the number of query commands in the temporary queue of the query command line system, intercept new commands when the number of query commands to be processed reaches the interception threshold of the temporary queue, effectively avoid the query command line system from being overloaded due to too many query commands, ensure the running efficiency of the query command line system, and avoid new query commands from waiting for a long time, so that the user can be fed back in time through interception, and the user experience is improved. Therefore, the query command line system in the related art is prone to overload, which causes problems such as low running efficiency.

[0026] Additional aspects and advantages of the present application will be made apparent by the following description and the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0027] 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:

[0028] Figure 1 a whole design diagram of the query command line system according to an embodiment of the present application is provided;

[0029] Figure 2 a flowchart of the processing method of the query command according to the embodiment of the present application is provided;

[0030] Figure 3 an example diagram of the temporary queue according to an embodiment of the present application is provided;

[0031] Figure 4 a block diagram of the processing device of the query command according to the embodiment of the present application is provided;

[0032] Figure 5 a structural schematic diagram of the electronic device according to the embodiment of the present application is provided. DETAILED DESCRIPTION

[0033] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the drawings, in which the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below are exemplary and are intended to explain the present application, and cannot be understood as limiting the present application.

[0034] It should be noted that the processing method of the query command in the following embodiments is applied to the 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, the processing system of the query command includes a command front end and a storage main process, and a user inputs a query command through SSH or a GUI (Graphical User Interface). There are multiple instances in the command front end, and each command pulls up an instance of the command front end, that is, the command and the command front end instance are one-to-one. The command front end instance delivers the query command to the storage main process through inter-process communication, and the storage main process calculates or queries the result and returns it to the command front end.

[0035] Based on Figure 1 the system shown, the following will be described in combination Figure 2 with the processing method of the query command, as shown in Figure 2 the processing method of the query command includes the following steps:

[0036] In step S101, the number of query commands waiting for processing in the temporary queue of the query command line system is obtained.

[0037] The temporary queue is a queue structure used for temporarily storing data, and is usually used to buffer data between different processing stages. It follows the principle of first-in first-out, that is, the data that enters the queue earliest will be processed first. The main role of the temporary queue is to smooth the difference between the processing speed and the data source, and to ensure that data is not lost or overflowed during transmission and processing.

[0038] Therefore, the embodiment of the application can temporarily store the query command input by the user through the temporary queue, and can obtain the number of temporarily stored query commands in the temporary queue by specifying the name or tool. The number of temporarily stored query commands is the number of query commands waiting for processing.

[0039] In step S102, if the number of query commands waiting for processing reaches the interception threshold of the temporary queue, the new query command issued by the user to the storage system is intercepted, wherein the interception threshold represents the upper limit of the cache number of the temporary queue.

[0040] Because the processing resources of the storage system are limited, if there are too many query commands in the temporary queue, the query command line system will be overloaded, thereby reducing the running efficiency of the query command line system, and also causing the new query command to wait for a long time, reducing the user experience.

[0041] Therefore, the embodiment of the application can set the 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 too many query commands, ensuring the running efficiency of the query command line system, and avoiding the new query command from waiting for a long time by intercepting the new query command. The user can be fed back in time through interception, and the user experience is improved.

[0042] In some embodiments, before intercepting the new query command issued by the user to the storage system, further comprising: setting the interception threshold of the staging queue in the programming stage of the query command line system, and adjusting the interception threshold of the staging queue in the running stage of the query command line system.

[0043] It can be understood that, in the programming stage, the interception threshold can be set according to the embodiments of the present application, so that the number of query commands in the staging queue can be maintained according to the interception threshold during the running process of the query command line system, and the running efficiency of the query command line system is improved; in the actual running process of the query command line system, the interception threshold of the staging queue can be adjusted in real time according to the embodiments of the present application, so that the interception threshold conforms to the actual situation of the current running, the dynamic management of the interception threshold is realized, and the applicability of the interception is improved.

[0044] In some embodiments, the setting of the interception threshold of the staging queue in the programming stage of the query command line system comprises: obtaining the average number of commands processed by the query command line system and the acceptable delay; and determining the interception threshold of the staging queue based on the average number of commands processed by the query command line system and the acceptable delay.

[0045] It can be understood that, according to the embodiments of the present application, the interception threshold of the staging queue can be set according to the average number of commands processed by the query command line system and the acceptable delay, so that the processing capacity of the query command line system and the speed of the query are considered comprehensively, the running efficiency of the query command line system is ensured, the response speed of the query is taken into account, and the query experience of the user is improved.

[0046] As shown in FIG. 1, Figure 3 The interception threshold is represented by X, and the setting rule of the interception threshold is: X = the average number of commands processed per second by the query command line system * the maximum delay acceptable by the query command line system. The unit of the maximum delay can be milliseconds or seconds, etc. For example, if the query command line system takes 100 ms to execute a command on average, and can process 10 commands per second, and the maximum delay expected by the query command line system product to present to the outside world is 1.2 seconds, then X = 10 * 1.2 = 12, so the interception threshold is 12.

[0047] In an embodiment of the present application, the adjustment of the interception threshold of the staging queue in the running stage of the query command line system comprises: obtaining the processor core usage rate of the query command line system; and adjusting the interception threshold of the staging queue according to the processor core usage rate.

[0048] It can be understood that, as the processor core usage rate changes, when the processor core usage rate is low, it indicates that the processing resources are abundant, and more processor cores can be provided for the query command line system; when the processor core usage rate is high, it indicates that the processing resources are tight, and more processor cores cannot be provided at this time. Therefore, in the actual running process of the query command line system, the interception threshold is adjusted in real time according to the processor core usage rate, to reduce the contention for processing resources, improve the running efficiency of the processor, and prevent causing more adverse effects.

[0049] In some embodiments, adjusting the interception threshold of the temporary storage queue according to the processor core usage rate comprises: obtaining a correspondence table of the processor core usage rate and the interception threshold, and determining the interception threshold corresponding to the processor core usage rate according to the correspondence table.

[0050] It can be understood that, the correspondence between the processor core usage rate and the interception threshold can be calibrated in advance in the embodiments of the present application. The correspondence can accurately reflect the relationship between the processor core usage rate and the interception threshold. Therefore, by using the correspondence table calibrated, the interception threshold can be quickly determined, and the interception threshold corresponding to the processor core usage rate can be accurately determined, to realize the quick and accurate adjustment of the interception threshold.

[0051] For example, when the processor core usage rate reaches 70%, 80%, or 90%, it indicates that the processor is under great pressure. At this time, according to the correspondence table, the upper limit X of the temporary storage queue can be dynamically reduced to half of the current value, to reduce the execution frequency of the query command line system command line, thereby reducing the pressure on the processor and preventing causing more adverse effects. Conversely, in the case of low load, the interception threshold can be appropriately increased, to fully utilize the processing resources.

[0052] In an embodiment of the present application, after intercepting the new query command issued by the user to the storage system, the method further comprises: generating a query failure prompt, and returning the failure prompt through the command front end.

[0053] The failure prompt can be a text prompt, a voice prompt, an animation prompt, etc. For example, after intercepting the new query command issued by the user to the storage system, a text prompt of “current command is busy, please try again later” can be returned.

[0054] It can be understood that, the embodiments of the present application can give the user a prompt of query failure in time after intercepting the new query command of the user, to avoid the problem of poor experience caused by long waiting of the user. Therefore, through the prompt feedback in time, the user can know the status of the query in time, and the use experience of the user is improved.

[0055] In step S103, if the number of query commands waiting for processing does not reach the interception threshold of the temporary queue, the new query command issued by the user to the storage system is put into the temporary queue.

[0056] It can be understood that if the number of query commands waiting for processing does not reach the interception threshold of the temporary queue, the new query command issued by the user to the storage system will be normally put into the temporary queue, ensuring that the command can be received and processed in order.

[0057] In some embodiments, after the new query command issued by the user to the storage system is put into the temporary queue, further comprising: identifying the priority of the query command in the temporary queue; and performing the target query action based on the priority of the query command.

[0058] It can be understood that the embodiments of the present application can set the priority of the query command, and process the query command through the priority, so as to ensure that the query command with high priority can be processed first, process important tasks in time, reduce the waiting time of important tasks, and realize the rational use of resources.

[0059] In some embodiments, identifying the priority of the query command in the temporary queue comprises: identifying the 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, and the priority identifier can be a character identifier, such as character-fast. The embodiments of the present application can set the priority identifier for the query command, and realize the quick 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, performing the query action based on the priority of the query command comprises: putting the query command into a corresponding priority queue according to the priority of the query command; and performing the target query action according to the priority of the priority queue and the processing weight, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.

[0062] The priority queue can set 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. The embodiments of the present application preferentially execute the high priority queue, so that important query commands are quickly executed. The processing weight represents the number of query commands allowed to be processed in the priority queue in 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 weight of the high priority queue can be set to be larger.

[0063] Thus, the priority can ensure that important query commands can be quickly executed, meet the query requirements of users, improve the use experience of users, and the processing weight can avoid a priority queue from occupying resources for a long time, thereby improving the overall response speed and message processing efficiency.

[0064] For example, two priority queues are set, i.e., a normal priority queue and a high priority queue. If a query command carries a "-fast" identifier, the corresponding query command is of high priority, and the corresponding query command is placed in the high priority queue. If the query command carries any identifier or carries a normal identifier, 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 that 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 a maximum of 5 commands. At this time, if the normal priority queue has a command waiting for execution, the normal priority queue gives up the execution right to the high priority queue after processing a maximum of 2 low priority queue commands. The above process is repeated. Thus, it is ensured that the high priority command can be processed in time, and the normal priority command will not be ignored for a long time.

[0066] In some embodiments, the application embodiment can set a waiting time threshold of a query command in a 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 lower than a preset level, the priority of the target query command is improved, 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 improved. The preset level can be set according to the actual situation. For example, the priority of the query command is divided into a first priority and a second priority, and the second priority is executed better than the first priority. The preset level can be set as 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 improved 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] Thus, the application embodiment can improve the priority of the query command with low priority when the waiting time of the query command is long, so that the corresponding query command can be executed preferentially to reduce the waiting time of the query command and reduce the waiting time of the user, thereby giving the user a better query experience.

[0069] In some embodiments, the target query action comprises: processing the query commands waiting for execution in the priority queue through a multi-thread mechanism to improve the processing efficiency of the query commands by using the multi-thread mechanism,

[0070] In some embodiments, the threads in the multi-thread mechanism are correspondingly bound to the processor cores, and the processing of the query commands waiting for execution in the priority queue through the multi-thread mechanism comprises: obtaining the number of query commands being processed on the multiple threads; based on the number of query commands being processed on the multiple threads and a preset allocation principle, allocating the query commands waiting for execution to the multiple threads, wherein the preset allocation principle is to keep the difference between the total number of query commands between threads less than an equilibrium threshold, the total number of query commands being the sum of the number of query commands being processed on the threads and the number of allocated query commands; and processing the query commands in parallel using the multiple threads.

[0071] The equilibrium threshold refers to a value that keeps the difference between the total number of query commands between threads within a certain range, which can be specifically calibrated or set, such as 1 or 2, so that the resource allocation between threads is balanced.

[0072] It can be understood that the embodiments of the present application correspondingly bind the threads in the multi-thread mechanism to the processor cores, such as allocating F threads, then determining F cores from the CPU (Central Processing Unit) cores, and correspondingly binding the F threads to the F cores, i.e. one core for one thread, which not only disperses the processing pressure to the F CPU cores, but also ensures that the CPU usage rate does not exceed the upper limit through core binding; at the same time, the parallel processing capability of multiple threads is used to improve the processing efficiency of query commands.

[0073] In some embodiments, the processing principle of the multiple command processing threads is to regard the execution of each command line as a task, and each task is assigned to each thread in a cyclic allocation manner, ensuring that the difference between the number of tasks being executed and the number of tasks queued on all threads does not exceed the equilibrium threshold, taking the equilibrium threshold as 1 for example, assuming 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, the allocation result of the 5 commands is: thread 1, thread 2, thread 3, thread 1, thread 2, which ensures that each thread has tasks being executed and the load is balanced, and the sum of the number of tasks being executed and the number of tasks queued on each thread is 2, 2, and 1 respectively. In the actual execution process, if the execution speed of the command on thread 2 is fast, both 2 commands are processed, and at this time, 1 new command comes, the new command will be allocated to thread 2, and the number of tasks is 2, 1, and 1 respectively, again achieving load balancing.

[0074] Therefore, by the processing manner of the dynamic command line thread, the parallel processing capability of the command is improved, the processing speed of the command is accelerated, and the execution efficiency in the scenario of executing a large number of commands is obviously improved, thereby improving the user experience.

[0075] According to the query command processing method provided in the embodiments 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, and when the number of query commands to be processed reaches the interception threshold of the temporary queue, the new command is intercepted, so that the query command line system is effectively prevented from being overloaded due to too many query commands, and the running efficiency of the query command line system is ensured, and meanwhile, by intercepting the new query command, the new query command is prevented from waiting for a long time, the user can be fed back in time through the interception, and the user experience is improved. Therefore, the problems of the related art, such as the running efficiency of the query command line system being easily affected due to the overload of the query command line system, are solved.

[0076] Secondly, the query command processing device provided in the embodiments of the present application is described with reference to the accompanying drawings. The device is applied to the query command line system set in the storage system.

[0077] Figure 4 is a block schematic diagram of the query command processing device in the embodiments of the present application.

[0078] As shown in Figure 4 , the query command processing device 10 includes an acquisition module 100, an interception module 200, and a processing module 300.

[0079] The acquisition module 100 is configured to acquire the number of query commands waiting for processing in the temporary queue of the query command line system. The interception module 200 is configured to intercept a new query command issued by a user to the storage system if the number of query commands waiting for processing reaches the interception threshold of the temporary queue, wherein the interception threshold represents the upper limit of the cache number of the temporary queue. The processing module 300 is configured to put the new query command issued by the user to the storage system into the temporary queue if the number of query commands waiting for processing does not reach the interception threshold of the temporary queue.

[0080] In an embodiment of the present application, the query command processing device 10 further includes a setting module configured 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 running stage of the query command line system.

[0081] In an embodiment of the present application, the setting module is further configured to acquire the average number of commands processed by the query command line system and the acceptable delay; and determine 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.

[0082] In an embodiment of the present application, the setting module is further configured to acquire the processor core usage rate of the query command line system; and adjust the interception threshold of the temporary queue according to the processor core usage rate.

[0083] In an embodiment of the present application, the processing apparatus 10 of the query command further comprises an identifying module and an executing module, wherein the identifying module is configured to identify the priority of the query command in the temporary queue after the new query command issued by the user to the storage system is put into the temporary queue; and the executing module is configured to execute the target query action based on the priority of the query command.

[0084] In an embodiment of the present application, the executing module is further configured to put the query command into the corresponding priority queue according to the priority of the query command; and execute the target query action according to the priority of the priority queue and the processing weight, wherein the processing weight represents the number of query commands allowed to be processed in the corresponding priority queue.

[0085] In an embodiment of the present application, the target query action comprises processing the query command waiting for execution in the priority queue through the multi-thread mechanism.

[0086] In an embodiment of the present application, the thread in the multi-thread mechanism is correspondingly bound to the processor core, and the executing module is further configured to acquire the number of query commands being processed on the multiple threads; and distribute the query command waiting for execution to the multiple threads based on the number of query commands being processed on the multiple threads and the preset distribution principle, wherein the preset distribution principle is to keep the difference between the total number of query commands between threads less than the 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 distributed query commands; and process the query command in parallel using the multiple threads.

[0087] It should be noted that the above explanation of the processing method of the query command is also applicable to the processing apparatus of the query command, which will not be described here.

[0088] According to the query command processing apparatus provided in the embodiments 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, and when the number of query commands to be processed reaches the interception threshold of the temporary queue, the new command is intercepted, thereby effectively avoiding the query command line system from being overloaded due to too many query commands, ensuring the running efficiency of the query command line system, and meanwhile, by intercepting the new query command, the new query command is prevented from waiting for a long time, the user can be fed back in time through the interception, and the user experience is improved. Therefore, the problems of the query command line system being easily overloaded and the running efficiency being affected in the related art are solved.

[0089] Figure 5 The structure schematic diagram of the electronic device provided in the embodiments of the present application is provided. The electronic device can include:

[0090] The memory 501, the processor 502 and the computer program stored in the memory 501 and executable on the processor 502.

[0091] The processor 502 implements the query command processing method provided in the above embodiments when executing the program.

[0092] Further, the electronic device further includes:

[0093] The communication interface 503 is used for communication between the memory 501 and the processor 502.

[0094] The memory 501 is used for storing the computer program executable on the processor 502.

[0095] The memory 501 can include a high-speed RAM (Random Access Memory, random access memory) memory, and can also include a non-volatile memory, for example, at least one disk memory.

[0096] If the memory 501, the processor 502 and the communication interface 503 are independently implemented, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and complete the communication between each other. The bus can be an ISA (Industry Standard Architecture, industry standard architecture) bus, a PCI (Peripheral Component, peripheral component interconnect) bus or an EISA (Extended Industry Standard Architecture, extended industry standard architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or 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 complete the communication with each other through an internal interface.

[0098] The processor 502 can be a CPU (Central Processing Unit, central processor) or an ASIC (Application Specific Integrated Circuit, specific integrated circuit) or one or more integrated circuits configured to implement the embodiments of the present application.

[0099] The embodiments of the present application further provide a computer readable storage medium, which has stored a computer program, and the program is executed by a processor to implement the query command processing method as above.

[0100] The embodiments of the present application further provide a computer program, which is executed to implement the query command processing method of the above embodiments.

[0101] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example" or "some examples" means that the specific features, structures, materials or characteristics described in connection 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 is not necessarily directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. 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.

[0102] In addition, the terms "first", "second" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "N" is at least two, for example, two, three, etc., unless otherwise specifically limited.

[0103] Any process or method described in a flowchart or otherwise described herein can be understood as representing code modules, segments, or portions of code that include one or more executable instructions for implementing the specified logical functions or steps, and the various embodiments of the application include alternative implementations of the described processes or methods, in which the order of steps can be changed, including the use of simultaneous steps or reverse order of steps, where necessary and / or desirable.

[0104] It should be understood that portions of the application can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As such, if implemented in hardware, and in another embodiment, any of the following technologies, or a combination thereof, can be used: discrete logic circuitry having logic gates for implementing logic functions upon an application of data signals, application specific integrated circuits having appropriate combinational logic gates, programmable gate arrays, field programmable gate arrays, and the like.

[0105] Those of ordinary skill in the art can understand that all or part of the steps carried out by the method of the above-mentioned embodiments can be completed by programs instructing relevant hardware, and the above-mentioned programs can be stored in a computer readable storage medium, and when executed, include one or a combination of steps of the method embodiments.

[0106] Although the embodiments of the 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 application, and those of ordinary skill in the art can make changes, modifications, replacements and variations to the above-mentioned embodiments within the scope of the application.

Claims

1. A method of processing a query command, characterized by, The method is applied to a query command line system arranged in a storage system, and comprises the following steps: acquiring the number of query commands waiting for processing in a temporary queue of the query command line system; if the number of query commands waiting for processing reaches an interception threshold of the temporary queue, intercepting a new query command issued by a user to the storage system, wherein the interception threshold represents an upper limit of the cache number of the temporary queue; if the number of query commands waiting for processing does not reach the interception threshold of the temporary queue, putting the new query command issued by the user to the storage system into the temporary queue, identifying the priority of the query command in the temporary queue, and performing a target query action based on the priority of the query command, wherein the target query action comprises: processing the query commands waiting for execution in the priority queue through a multi-thread mechanism, the threads in the multi-thread mechanism are correspondingly bound to processor cores, and the processing of the query commands waiting for execution in the priority queue through the multi-thread mechanism comprises: acquiring the number of query commands being processed on multiple threads, and allocating the query commands waiting for execution to the multiple threads based on the number of query commands being processed on the multiple threads and a preset allocation principle, wherein the preset allocation principle is to keep the difference between the total number of query commands between threads less than an equilibrium threshold, 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, and the multiple threads are used to process the query commands in parallel.

2. The method of claim 1, wherein, Before intercepting the new query command issued by the user to the storage system, the method further comprises: setting the interception threshold of the temporary queue in a programming stage of the query command line system, and adjusting the interception threshold of the temporary queue in a running stage of the query command line system.

3. The method of claim 2, wherein, The setting of the interception threshold of the temporary queue in the programming stage of the query command line system comprises: acquiring the average number of commands processed by the query command line system and the acceptable delay; determining 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.

4. The method of claim 2, wherein, The adjusting of the interception threshold of the temporary queue in the running stage of the query command line system comprises: acquiring the usage rate of the processor core of the query command line system; adjusting the interception threshold of the temporary queue according to the usage rate of the processor core.

5. The method of claim 1, wherein, The execution of the query action based on the priority of the query command comprises: putting the query command into a corresponding priority queue according to the priority of the query command; performing 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.

6. An apparatus for processing a query command, the apparatus comprising: The device is applied to a query command line system arranged in a storage system, and comprises: an acquisition module, configured to acquire the number of query commands waiting for processing in a temporary queue of the query command line system; intercepting a new query command issued by a user to a storage system if a number of query commands waiting for processing reaches an intercept threshold of the temporary queue, wherein the intercept threshold represents an upper limit of a cache number of the temporary queue; processing the new query command issued by the user to the storage system into the temporary queue if the number of query commands waiting for processing does not reach the intercept threshold of the temporary queue, identifying a priority of the query command in the temporary queue, and performing a target query action based on the priority of the query command, wherein the target query action comprises: processing the query command waiting for execution in the priority queue through a multi-thread mechanism, threads in the multi-thread mechanism are correspondingly bound to processor cores, and the processing of the query command waiting for execution in the priority queue through the multi-thread mechanism comprises: obtaining a number of query commands being processed on a plurality of threads, allocating the query command waiting for execution to the plurality of threads based on the number of query commands being processed on the plurality of threads and a preset allocation principle, wherein the preset allocation principle is to keep a difference between total numbers of query commands among threads less than a balance threshold, the total number of query commands is a sum of the number of query commands being processed on a thread and a number of allocated query commands, and the plurality of threads are used to process the query command in parallel.

7. An electronic device, comprising: comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executes the program to implement the query command processing method of any one of claims 1-5.

Citation Information

Patent Citations

  • Flow management device and method for saving cache resource

    CN102831077A

  • Task scheduling method and system, electronic equipment and computer readable storage medium

    CN115904669A