Data processing method, device and equipment, computer storage medium and computer program product
By dynamically controlling the working mode of input and output threads, the problem of excessive CPU load caused by data processing solutions in the virtualized environment is solved, and the rational use of CPU resources and the efficiency of data processing is achieved.
Patent Information
- Application Number
- CN202411774448.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, data processing solutions in the virtualized environment cause excessive CPU load and waste of CPU resources.
By determining the performance parameters of the input and output threads, the working mode of the input and output threads is dynamically controlled to be interrupt working mode or polling working mode to match the current CPU load situation and process the client's data request.
It effectively reduces the load on the CPU, avoids the waste of CPU resources, and ensures the efficiency and performance of data processing.
Smart Images

Figure CN119938303A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data processing technology in the field of computer technology, and in particular to a data processing method, device, equipment, computer storage medium and computer program product. Background Art
[0002] With the development of cloud computing and data centers, virtualization technology has been widely used due to its flexible and convenient features. In traditional virtualization environments, virtual machines usually need to frequently access storage through the Internet Small Computer System Interface (iSCSI) / Network File System (NFS) protocol. Therefore, the length of the input / output (IO) path and the latency overhead of accessing the storage determine the IO performance of virtualization. In order to improve the IO performance of the virtualized environment, the industry generally adopts the vhost-user protocol communication solution of the Storage Performance Development Kit (SPDK); after the vhost-user protocol is connected to the storage access layer, the solution is connected from QEMU shared memory to the storage access layer, and then the central processing unit (CPU) polling method is used in the storage access layer to read and write data in the shared memory. However, this data processing solution greatly increases the CPU load and causes a waste of CPU resources. Summary of the invention
[0003] To solve the above technical problems, the embodiments of the present application hope to provide a data processing method, apparatus, device, computer storage medium and computer program product, which solve the problem of excessive CPU load in the data processing scheme in the related technology and avoid waste of CPU resources.
[0004] The technical solution of this application is implemented as follows:
[0005] A data processing method, the method comprising:
[0006] Determine the input and output threads used to process data in the client;
[0007] Determine a first performance parameter of the input-output thread; wherein the first performance parameter represents the usage of the input-output thread;
[0008] Controlling the working mode of the input and output thread to a target working mode based on the first performance parameter;
[0009] After receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed through the input and output thread in the target working mode.
[0010] In the above solution, the step of controlling the working mode of the input and output thread to be a target working mode based on the first performance parameter includes:
[0011] If the first performance parameter meets the target performance condition, controlling the working mode of the input and output thread to an interrupt working mode;
[0012] If the first performance parameter does not meet the target performance condition, the working mode of the input and output thread is controlled to be a polling working mode.
[0013] In the above scheme, after receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed by the input and output thread in the target working mode, including:
[0014] If the target working mode is an interrupt working mode, controlling the input and output thread to be in an interrupt state, and monitoring the input and output thread;
[0015] If it is detected that the input / output thread has the data processing request, the data corresponding to the data processing request in the client is processed through the input / output thread.
[0016] In the above solution, the monitoring of the input and output threads includes:
[0017] Monitoring a first event identifier corresponding to the input and output thread;
[0018] Correspondingly, if it is detected that the input / output thread has the data processing request, the input / output thread processes the data corresponding to the data processing request in the client, including:
[0019] If it is detected that the first event identifier corresponding to the input / output thread has a target event, the data corresponding to the data processing request in the client is processed through the input / output thread.
[0020] In the above scheme, after receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed by the input and output thread in the target working mode, including:
[0021] If the target working mode is the polling working mode, after receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed by the input and output thread in a polling manner.
[0022] In the above scheme, the method further includes:
[0023] Determining a second performance parameter of the input and output thread;
[0024] If the second performance parameter does not meet the target performance condition, switching the working mode of the input and output thread to the polling working mode;
[0025] If the second performance parameter meets the target performance condition, the working mode of the input and output thread is switched to the interrupt working mode.
[0026] In the above scheme, the method further includes:
[0027] If all connections of the current input and output threads are in a disconnected state, the working mode of the current input and output threads is switched to the interrupt working mode.
[0028] In the above scheme, the method further includes:
[0029] If a second event identifier corresponding to the data processing request is obtained, a message indicating that the data processing is completed is sent to the client.
[0030] A data processing device, comprising:
[0031] A first determining unit, used to determine an input and output thread for processing data in the client;
[0032] A second determining unit is used to determine a first performance parameter of the input and output thread; wherein the first performance parameter represents the usage of the input and output thread;
[0033] A control unit, configured to control the working mode of the input and output thread to be a target working mode based on the first performance parameter;
[0034] The processing unit is used to process the data corresponding to the data processing request in the client through the input and output thread and adopt the target working mode after receiving the data processing request sent by the client.
[0035] A server, comprising: a processor, a memory and a communication bus;
[0036] The communication bus is used to realize the communication connection between the processor and the memory;
[0037] The processor is used to execute the data processing program in the memory to implement the steps of the above-mentioned data processing method.
[0038] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the above-mentioned data processing method.
[0039] A computer program product comprises a computer program, wherein the computer program implements the above-mentioned data processing method when executed by a processor.
[0040] The data processing method, apparatus, device, computer storage medium and computer program product provided by the embodiments of the present application can determine the input and output thread used to process data in the client, determine the first performance parameter of the input and output thread, control the working mode of the input and output thread to the target working mode based on the first performance parameter, and after receiving the data processing request sent by the client, the input and output thread uses the target working mode to process the data corresponding to the data processing request in the client. In this way, when the data in the client is processed by the server, the target working mode of the input and output thread can be first determined according to the performance parameters of the corresponding input and output thread, and the data in the client can be processed by the input and output thread using the target working mode corresponding to the performance parameters of the input and output thread, instead of ignoring the performance parameters of the input and output thread as in the related art and processing data in a fixed polling manner, thereby solving the problem of excessive CPU load in the data processing scheme in the related art and avoiding waste of CPU resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0042] Figure 2 A flowchart of another data processing method provided in an embodiment of the present application;
[0043] Figure 3 A schematic diagram of the interaction between a virtual machine side and a storage side in a data processing method provided in an embodiment of the present application;
[0044] Figure 4 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0045] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0047] It should be understood that the "embodiments of the present application" or "the aforementioned embodiments" mentioned throughout the specification mean that specific features, structures or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, "in the embodiments of the present application" or "in the aforementioned embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0048] Unless otherwise specified, any step in the embodiments of the present application may be performed by a processor of the device. It is also worth noting that the embodiments of the present application do not limit the order in which the device executes the following steps. In addition, the methods used to process data in different embodiments may be the same method or different methods. It should also be noted that any step in the embodiments of the present application can be independently executed by the device, that is, when the device executes any step in the following embodiments, it may not rely on the execution of other steps.
[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] The present application embodiment provides a data processing method, which can be applied to a server, referring to Figure 1 As shown, the method may include the following steps:
[0051] Step 101: Determine an input and output thread for processing data in a client.
[0052] In the embodiment of the present application, the input-output thread may refer to a thread in the server used to process data stored in the client; wherein the input-output thread may refer to an IO thread.
[0053] It should be noted that the client and the server can establish a vhost-user protocol connection in advance through a local Unix domain socket (Unix domainsocket) (unix socket), and the client's memory can be mapped to the server side for use (i.e., shared memory mapping is completed). The input and output thread can be any thread among all idle IO threads. Specifically, the server can select any thread from all idle IO threads to bind the currently established connection, and determine the input and output thread used to process the data in the client. Among them, the IO thread can include multiple, and the number of IO threads can be determined based on the overall IO performance.
[0054] Step 102: Determine a first performance parameter of an input / output thread.
[0055] The first performance parameter represents the usage of the input and output threads.
[0056] In the embodiment of the present application, the first performance parameter may refer to a parameter that can characterize the current usage of the IO thread. In a feasible implementation, the first performance parameter may include parameters such as IO throughput, IO rate, IO depth, and IO average block size.
[0057] It should be noted that the first performance parameter may refer to the performance parameter of the IO thread within the target time, that is, obtaining the IO throughput, IO rate, IO depth, IO average block size and other parameters of the IO thread within the target time; the IO average block size may refer to the average size calculated based on the IO block size within the target time. Among them, the target time may be a period of time determined according to specific needs and application scenarios. Of course, the performance parameters of the IO thread within the target time may be periodically counted to obtain the first performance parameter.
[0058] Step 103: Control the working mode of the input and output thread to be a target working mode based on the first performance parameter.
[0059] In the embodiment of the present application, the first performance parameter and the target performance condition may be analyzed, and then the target working mode of the IO thread may be determined according to the analysis result of the first performance parameter and the target performance condition.
[0060] It should be noted that the target working mode is the working mode corresponding to the first performance parameter; that is, under the target working mode, the data processing efficiency of the server can be guaranteed to be the highest, and excessive use of the CPU can be avoided, thereby ensuring the rational use of CPU resources.
[0061] Step 104: After receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed through the input and output thread in the target working mode.
[0062] In the embodiment of the present application, the data processing request may refer to an operation request for performing a read operation and / or a write operation on data stored in the memory of the client; specifically, the write operation may include an operation of writing new data to the memory of the client and an operation of modifying data already stored in the memory of the client. In a feasible implementation, the client may refer to a virtual machine, and the server may refer to a storage-side device having a storage access layer.
[0063] It should be noted that after the IO thread is controlled to be in the target working mode, the IO thread can use the processing method corresponding to the target working mode to perform read operations and / or write operations on the data corresponding to the data processing request in the client's memory. In addition, using the processing method corresponding to the target working mode to process the data in the client's memory can ensure that the current processing method for the data in the client's memory is the method that best matches the current usage of the IO thread, thereby reducing the CPU load while ensuring that the IO performance does not decrease.
[0064] The data processing method provided in the embodiment of the present application can first determine the target working mode of the input / output thread according to the performance parameters of the corresponding input / output thread when processing the data in the client through the server, and use the target working mode corresponding to the performance parameters of the input / output thread to process the data in the client through the input / output thread, instead of ignoring the performance parameters of the input / output thread as in the related art and processing the data in a fixed polling manner, thereby solving the problem of excessive CPU load in the data processing scheme in the related art and avoiding waste of CPU resources.
[0065] Based on the above embodiments, the present application provides a data processing method. Figure 2 As shown, the method may include the following steps:
[0066] Step 201: The server determines an input / output thread for processing data in the client.
[0067] Step 202: The server determines a first performance parameter of an input / output thread.
[0068] The first performance parameter represents the usage of the input and output thread.
[0069] It should be noted that after step 202, you can choose to execute steps 203 to 205 or steps 206 to 207.
[0070] Step 203: If the first performance parameter meets the target performance condition, the server controls the working mode of the input and output thread to be an interrupt working mode.
[0071] In the embodiment of the present application, the target performance condition may refer to a target threshold of a performance parameter of the IO thread set according to the usage of the IO thread, and the optimal performance of the IO thread can be guaranteed under the target threshold.
[0072] It should be noted that if the first performance parameter meets the target performance condition, it means that the current IO thread is not used or the usage rate is not high. At this time, in order to avoid wasting CPU resources, the working mode of the IO thread can be switched to the interrupt working mode; and, in this interrupt working mode, the IO thread will not continue to process data.
[0073] In a feasible implementation, if the IO rate and the IO depth are both zero (ie, there is no IO) or the IO depth and the IO average block size are both relatively large, it can be determined that the first performance parameter meets the target performance condition.
[0074] Step 204: If the target working mode is the interrupt working mode, the server controls the input and output threads to be in an interrupt state and monitors the input and output threads.
[0075] After the IO thread switches to the interrupt working mode, the state of the IO thread is the interrupt event state (i.e., the interrupt state); at this time, the IO thread will process data only when a data processing request is detected. Specifically, the events on the IO thread can be monitored.
[0076] In the embodiment of the present application, the “monitoring input and output threads” in step 204 can be implemented in the following manner:
[0077] Step 204a: The server monitors the first event identifier corresponding to the input and output thread.
[0078] In the embodiments of the present application, Figure 3 As shown, the first event identifier and the second event identifier can be created in the client in advance, and after the server and the client establish a vhost-user protocol connection, the first event identifier and the second event identifier are mapped to the server side for use. Among them, the second event identifier is used for the server side to notify the client side after processing the IO data; the second event identifier is used for the server side to monitor whether there is a new IO arrival.
[0079] In one possible implementation, Figure 3The first event identifier shown may refer to an IO event handle, and the second event identifier may refer to an IO completion handle; and the server side uses an application programming interface (API) call to access local storage or distributed storage through the storage access layer to process the data corresponding to the data processing request. In other words, the server can monitor the IO event handle corresponding to the IO thread.
[0080] Step 205: If it is detected that there is a data processing request on the input / output thread, the server processes the data corresponding to the data processing request in the client through the input / output thread.
[0081] In an embodiment of the present application, if it is detected that there is a data processing request sent by the client on the IO thread for processing data in the client, then a read operation and / or a write operation can be performed on the data in the client's memory through the IO thread in response to the data processing request. It should be noted that it can be determined whether there is a data processing request on the IO thread by monitoring an event on the first event identifier corresponding to the IO thread.
[0082] In the embodiment of the present application, step 205 can be implemented in the following manner:
[0083] Step 205a: If it is detected that the first event identifier corresponding to the input / output thread has a target event, the server processes the data corresponding to the data processing request in the client through the input / output thread.
[0084] It should be noted that if a target event is detected on the IO event handle corresponding to the IO thread, it means that there is a data processing request on the IO thread; at this time, the data corresponding to the data processing request in the memory of the client corresponding to the IO thread can be read and / or written. In a feasible implementation, the target event may refer to a POLLIN event.
[0085] Step 206: If the first performance parameter does not meet the target performance condition, the server controls the working mode of the input and output thread to be a polling working mode.
[0086] In an embodiment of the present application, if the first performance parameter does not meet the target performance condition, it means that the current IO thread is continuously used or has a high usage rate. At this time, in order to avoid wasting CPU resources, the working mode of the IO thread can be switched to a polling working mode to minimize the switching overhead of the interrupt context; and, in this polling working mode, the IO thread will use a polling processing method to process data.
[0087] In a feasible implementation, if both the IO rate and the IO depth are not zero (ie, there are continuous IOs) and the IO depth or the IO average block size is small, it can be determined that the first performance parameter does not meet the target performance condition.
[0088] Step 207: If the target working mode is the polling working mode, after receiving the data processing request sent by the client, the server processes the data corresponding to the data processing request in the client in a polling manner through the input and output threads.
[0089] In an embodiment of the present application, after the IO thread switches to the polling working mode, the state of the IO thread is the polling state; at this time, the CPU load where the IO thread is located is 100% running; and the IO thread can use a polling processing method to perform read operations and / or write operations on the data in the client's memory.
[0090] In other embodiments of the present application, the method may further include the following steps:
[0091] Step 208: The server determines a second performance parameter of the input and output thread.
[0092] In the embodiment of the present application, after the working mode of the IO thread is switched to the target working mode, the second performance parameter of the IO thread can be periodically determined, wherein the specific parameters included in the second performance parameter are the same as the first performance parameter.
[0093] Step 209: If the second performance parameter does not meet the target performance condition, the server switches the working mode of the input and output thread to the polling working mode.
[0094] Step 210: If the second performance parameter meets the target performance condition, the server switches the working mode of the input and output thread to the interrupt working mode.
[0095] It should be noted that if the second performance parameter does not meet the target performance condition, the working mode of the IO thread can be switched from the interrupt working mode in the target working mode to the polling working mode; if the second performance parameter meets the target performance condition, the working mode of the IO thread can be switched from the polling working mode in the target working mode to the interrupt working mode to ensure effective use of CPU resources.
[0096] In other embodiments of the present application, the method may further include the following steps:
[0097] Step 211: If the connections of the current input and output threads are all in a disconnected state, the server switches the working mode of the current input and output threads to an interrupt working mode.
[0098] The connection status of all current IO threads is determined. If all current IO threads are in a disconnected state, in order to avoid wasting CPU resources, the working mode of the IO threads in the disconnected state may be switched to an interrupt working mode.
[0099] In other embodiments of the present application, the method may further include the following steps:
[0100] Step 212: If the second event identifier corresponding to the data processing request is obtained, the server sends a message indicating that the data processing is completed to the client.
[0101] If the IO completion handle is obtained, it means that the server has completed the processing of the data in the client's memory. The server can then notify the client that the data processing is complete, that is, it can send a message to the client that the data processing is complete.
[0102] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.
[0103] The data processing method provided in the embodiment of the present application can first determine the target working mode of the input / output thread according to the performance parameters of the corresponding input / output thread when processing the data in the client through the server, and use the target working mode corresponding to the performance parameters of the input / output thread to process the data in the client through the input / output thread, instead of ignoring the performance parameters of the input / output thread as in the related art and processing the data in a fixed polling manner, thereby solving the problem of excessive CPU load in the data processing scheme in the related art and avoiding waste of CPU resources.
[0104] Based on the above embodiments, the present invention provides a data processing device, which can be applied to Figures 1-2 In the data processing method provided in the corresponding embodiment, refer to Figure 4 As shown, the data processing device 3 may include: a first determining unit 31, a second determining unit 32, a control unit 33 and a processing unit 34, wherein:
[0105] A first determining unit 31 is used to determine an input and output thread for processing data in the client;
[0106] The second determining unit 32 is used to determine a first performance parameter of the input and output thread; wherein the first performance parameter represents the usage of the input and output thread;
[0107] A control unit 33, configured to control the working mode of the input and output thread to be a target working mode based on the first performance parameter;
[0108] The processing unit 34 is used to process the data corresponding to the data processing request in the client through the input and output threads and in the target working mode after receiving the data processing request sent by the client.
[0109] In other embodiments of the present application, the control unit 33 is further configured to perform the following steps:
[0110] If the first performance parameter meets the target performance condition, the working mode of the input and output thread is controlled to be an interrupt working mode;
[0111] If the first performance parameter does not meet the target performance condition, the working mode of the control input and output thread is a polling working mode.
[0112] In other embodiments of the present application, the processing unit 34 is further configured to perform the following steps:
[0113] If the target working mode is the interrupt working mode, the input and output threads are controlled to be in the interrupt state, and the input and output threads are monitored;
[0114] If it is detected that there is a data processing request on the input / output thread, the data corresponding to the data processing request in the client is processed through the input / output thread.
[0115] In other embodiments of the present application, the processing unit 34 is further configured to monitor a first event identifier corresponding to an input and output thread;
[0116] Correspondingly, the processing unit 34 is further configured to process the data corresponding to the data processing request in the client through the input-output thread if it is detected that the first event identifier corresponding to the input-output thread has a target event.
[0117] In other embodiments of the present application, the processing unit 34 is also used to process the data corresponding to the data processing request in the client in a polling manner through the input and output thread after receiving the data processing request sent by the client if the target working mode is the polling working mode.
[0118] In other embodiments of the present application, the processing unit 34 is further configured to perform the following steps:
[0119] determining a second performance parameter of the input-output thread;
[0120] If the second performance parameter does not meet the target performance condition, switching the working mode of the input and output thread to the polling working mode;
[0121] If the second performance parameter meets the target performance condition, the working mode of the input and output thread is switched to the interrupt working mode.
[0122] In other embodiments of the present application, the processing unit 34 is further configured to switch the working mode of the current input and output thread to the interrupt working mode if all connections of the current input and output thread are in a disconnected state.
[0123] In other embodiments of the present application, the processing unit 34 is further configured to send a message indicating that the data processing is completed to the client if a second event identifier corresponding to the data processing request is obtained.
[0124] It should be noted that the specific description of the steps performed by each unit can be found in Figures 1-2 The data processing method provided in the corresponding embodiment will not be described in detail here.
[0125] The data processing device provided in the embodiment of the present application can first determine the target working mode of the input / output thread according to the performance parameters of the corresponding input / output thread when processing the data in the client through the server, and use the target working mode corresponding to the performance parameters of the input / output thread to process the data in the client through the input / output thread, instead of ignoring the performance parameters of the input / output thread as in the related art and processing the data in a fixed polling manner, thereby solving the problem of excessive CPU load in the data processing scheme in the related art and avoiding waste of CPU resources.
[0126] Based on the above embodiments, the embodiments of the present application provide a server, which can be applied to Figures 1-2 In the data processing method provided in the corresponding embodiment, refer to Figure 5 As shown, the server 4 may include: a processor 41, a memory 42 and a communication bus 43, wherein:
[0127] The communication bus 43 is used to realize the communication connection between the processor 41 and the memory 42;
[0128] The processor 41 is used to execute the data processing program in the memory 42 to implement the following steps:
[0129] Determine the input and output threads used to process data in the client;
[0130] Determine a first performance parameter of the input-output thread; wherein the first performance parameter represents the usage of the input-output thread;
[0131] Controlling the working mode of the input and output thread to be a target working mode based on the first performance parameter;
[0132] After receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed through the input and output threads and the target working mode is adopted.
[0133] In other embodiments of the present application, the processor 41 is used to execute the data processing program in the memory 42 to control the working mode of the input and output thread to be the target working mode based on the first performance parameter, so as to implement the following steps:
[0134] If the first performance parameter meets the target performance condition, the working mode of the input and output thread is controlled to be an interrupt working mode;
[0135] If the first performance parameter does not meet the target performance condition, the working mode of the control input and output thread is a polling working mode.
[0136] In other embodiments of the present application, the processor 41 is used to execute the data processing program in the memory 42. After receiving the data processing request sent by the client, the processor 41 processes the data corresponding to the data processing request in the client through the input and output thread in the target working mode to implement the following steps:
[0137] If the target working mode is the interrupt working mode, the input and output threads are controlled to be in the interrupt state, and the input and output threads are monitored;
[0138] If it is detected that there is a data processing request on the input / output thread, the data corresponding to the data processing request in the client is processed through the input / output thread.
[0139] In other embodiments of the present application, the processor 41 is used to execute the monitoring input and output thread of the data processing program in the memory 42 to implement the following steps:
[0140] Monitoring a first event identifier corresponding to an input and output thread;
[0141] Accordingly, the processor 41 is used to execute the data processing program in the memory 42. If it is detected that there is a data processing request on the input / output thread, the data corresponding to the data processing request in the client is processed through the input / output thread to implement the following steps:
[0142] If it is monitored that the first event identifier corresponding to the input-output thread has a target event, the data corresponding to the data processing request in the client is processed through the input-output thread.
[0143] In other embodiments of the present application, the processor 41 is used to execute the data processing program in the memory 42. After receiving the data processing request sent by the client, the processor 41 processes the data corresponding to the data processing request in the client through the input and output thread in the target working mode to implement the following steps:
[0144] If the target working mode is the polling working mode, after receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed by the input and output thread in a polling manner.
[0145] In other embodiments of the present application, the processor 41 is used to execute the data processing program in the memory 42, and can also implement the following steps:
[0146] determining a second performance parameter of the input-output thread;
[0147] If the second performance parameter does not meet the target performance condition, switching the working mode of the input and output thread to the polling working mode;
[0148] If the second performance parameter meets the target performance condition, the working mode of the input and output thread is switched to the interrupt working mode.
[0149] In other embodiments of the present application, the processor 41 is used to execute the data processing program in the memory 42, and can also implement the following steps:
[0150] If the connections of the current input and output threads are all in a disconnected state, the working mode of the current input and output threads is switched to an interrupt working mode.
[0151] In other embodiments of the present application, the processor 41 is used to execute the data processing program in the memory 42, and can also implement the following steps:
[0152] If the second event identifier corresponding to the data processing request is obtained, a message indicating that the data processing is completed is sent to the client.
[0153] It should be noted that the specific description of the steps executed by the processor can be referred to Figures 1-2 The data processing method provided in the corresponding embodiment will not be described in detail here.
[0154] The server provided in the embodiment of the present application can first determine the target working mode of the input / output thread according to the performance parameters of the corresponding input / output thread when processing the data in the client through the server, and use the target working mode corresponding to the performance parameters of the input / output thread to process the data in the client through the input / output thread, instead of ignoring the performance parameters of the input / output thread as in the related art and processing the data in a fixed polling manner, thereby solving the problem of excessive CPU load in the data processing scheme in the related art and avoiding waste of CPU resources.
[0155] Based on the foregoing embodiments, the embodiments of the present application provide a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement Figures 1-2 The corresponding embodiments provide steps of the data processing method.
[0156] Based on the foregoing embodiments, the embodiments of the present application provide a computer program product, including a computer program, which can be executed by the processor 41 to complete Figures 1-2 The corresponding embodiments provide steps of the data processing method.
[0157] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0158] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data transmission device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data transmission device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0159] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data transmission device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0160] These computer program instructions may also be loaded onto a computer or other programmable data transmission device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0161] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Determine the input and output threads used to process data in the client; Determine a first performance parameter of the input-output thread; wherein the first performance parameter represents the usage of the input-output thread; Controlling the working mode of the input and output thread to a target working mode based on the first performance parameter; After receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed through the input and output thread in the target working mode.
2. The method according to claim 1, characterized in that: The controlling the working mode of the input and output thread to be a target working mode based on the first performance parameter includes: If the first performance parameter meets the target performance condition, controlling the working mode of the input and output thread to an interrupt working mode; If the first performance parameter does not meet the target performance condition, the working mode of the input and output thread is controlled to be a polling working mode.
3. The method according to claim 2, characterized in that After receiving the data processing request sent by the client, processing the data corresponding to the data processing request in the client by the input and output thread and using the target working mode includes: If the target working mode is an interrupt working mode, controlling the input and output thread to be in an interrupt state, and monitoring the input and output thread; If it is detected that the input / output thread has the data processing request, the data corresponding to the data processing request in the client is processed through the input / output thread.
4. The method according to claim 3, characterized in that The monitoring of the input and output threads includes: Monitoring a first event identifier corresponding to the input and output thread; Correspondingly, if it is detected that the input / output thread has the data processing request, the input / output thread processes the data corresponding to the data processing request in the client, including: If it is detected that the first event identifier corresponding to the input / output thread has a target event, the data corresponding to the data processing request in the client is processed through the input / output thread.
5. The method according to claim 2, characterized in that: After receiving the data processing request sent by the client, processing the data corresponding to the data processing request in the client by the input and output thread and using the target working mode includes: If the target working mode is the polling working mode, after receiving the data processing request sent by the client, the data corresponding to the data processing request in the client is processed by the input and output thread in a polling manner.
6. The method according to claim 3 or 5, characterized in that: The method further comprises: Determining a second performance parameter of the input and output thread; If the second performance parameter does not meet the target performance condition, switching the working mode of the input and output thread to the polling working mode; If the second performance parameter meets the target performance condition, the working mode of the input and output thread is switched to the interrupt working mode.
7. The method according to claim 2, characterized in that The method further comprises: If all connections of the current input and output threads are in a disconnected state, the working mode of the current input and output threads is switched to the interrupt working mode.
8. The method according to claim 1, characterized in that The method further comprises: If a second event identifier corresponding to the data processing request is obtained, a message indicating that the data processing is completed is sent to the client.
9. A data processing device, characterized in that: The device comprises: A first determining unit, used to determine an input and output thread for processing data in the client; A second determining unit is used to determine a first performance parameter of the input and output thread; wherein the first performance parameter represents the usage of the input and output thread; A control unit, configured to control the working mode of the input and output thread to be a target working mode based on the first performance parameter; The processing unit is used to process the data corresponding to the data processing request in the client through the input and output thread and adopt the target working mode after receiving the data processing request sent by the client.
10. A server, characterized in that: The server includes: a processor, a memory and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the data processing program in the memory to implement the steps of the data processing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the data processing method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 8.