Network communication time consumption statistical method and device of database system, medium and product

By introducing a network communication time-consuming statistical method in the database system, the time information is carried in the task processing between the client and the server, and the network communication time consumption is automatically counted, which solves the problems of cumbersome operations and low statistical efficiency in the prior art, and improves statistical convenience.

CN120200934APending Publication Date: 2025-06-24CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510344890.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The prior art is time-consuming when the network communication between the client and server of the statistical database system is complicated to operate and has low statistical efficiency.

Method used

By introducing a network communication time-consuming statistics method in the database system, the client sends the start message to the server and carries the client's sending time, the server records the reception time and calculates the network time, and the server then sends the end message to the client and carries the server's sending time and the network time, the client records the reception time and calculates the network time of the end message.

Benefits of technology

It realizes that the message transmission time is automatically counted during task processing between the client and the server, which improves the statistical convenience of network communication time and avoids the cumbersome steps of using logs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120200934A_ABST
    Figure CN120200934A_ABST
Patent Text Reader

Abstract

The invention provides a network communication time consumption statistical method and device of a database system, a medium and a product. The database system comprises a client side and a server side, and the network communication time consumption statistical method comprises the steps that the client side sends a starting message to the server side, and the starting message carries client side sending time; the server side receives the initial message and records the receiving time of the server side; the server side calculates the network time consumption of the initial message according to the server side receiving time and the client side sending time; the server side sends an ending message to the client side, wherein the ending message carries the sending time of the server side and the network time consumption of the starting message; the client receives the ending message and records the receiving time of the client; and the client calculates the network time consumption for ending the message according to the client receiving time and the server sending time. Related time information is carried in the process of performing task processing by utilizing the message between the client and the server, so that the message transmission time is calculated, and the convenience of counting the time consumption of network communication is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and in particular, to a method, device, medium and product for statistically calculating the network communication time consumption of a database system. Background Art

[0002] During the interaction between the client and the server of the database system, the client and the server need to communicate through the network, that is, the client sends a task request to the server through the network, and the server sends the task execution result to the client through the network. Therefore, during the performance analysis of the database system, as part of the time consumption of the task execution process, the network time consumption also needs to be statistically calculated, so as to better determine the root cause of the time consumption during the execution of different types of tasks.

[0003] Currently, the method for statistically calculating the network time consumption is usually to find the time of various actions by printing logs at the driver end and the server end respectively, and then calculate the network time consumption. The operation is relatively cumbersome and the statistical efficiency is low. Summary of the Invention

[0004] An object of the present invention is to provide a method, device, medium and product for statistically calculating the network communication time consumption of a database system, which helps to improve the convenience of statistically calculating the network communication time consumption between the client and the server.

[0005] In particular, the present invention provides a method for statistically calculating the network communication time consumption of a database system, the database system includes a client and a server, wherein, the method for statistically calculating the network communication time consumption of the database system includes:

[0006] The client sends a start message to the server, and the start message carries the client sending time;

[0007] The server receives the start message and records the server receiving time;

[0008] The server calculates the network time consumption of the start message according to the server receiving time and the client sending time;

[0009] The server sends an end message to the client, and the end message carries the server sending time and the network time consumption of the start message;

[0010] The client receives the end message and records the client receiving time;

[0011] The client calculates the network time consumption of the end message according to the client receiving time and the server sending time.

[0012] Optionally, the database system predefines a time information message for carrying time information and sending it along with the task message.

[0013] In the step of the client sending a start message to the server, the start message includes a task request message and a time information message recording the sending time of the client.

[0014] In the step of the server sending an end message to the client, the end message includes a task result message and a time information message recording the sending time of the server and the network consumption time of the start message.

[0015] Optionally, in the step of the client sending a start message to the server, the time information message further includes the network consumption time of the start message and the network consumption time of the end message generated by the last completed task.

[0016] After receiving the start message, the server stores the network consumption time of the start message and the network consumption time of the end message generated by the last completed task on disk.

[0017] Optionally, after the step of the client calculating the network consumption time of the end message based on the client receiving time and the server sending time, the following steps are included:

[0018] The client detects that the time without network interaction with the server reaches a preset time threshold.

[0019] The client sends a message carrying the network consumption time of the start message and the network consumption time of the end message generated by the last completed task to the server.

[0020] Optionally, after the step of the client sending a message carrying the network consumption time of the start message and the network consumption time of the end message generated by the last completed task to the server, the following steps are included:

[0021] Clear the sending record.

[0022] Optionally, after the client and the server establish a connection, the client detects whether the protocol version for sending the time information message is supported. If so, the client sends a start message carrying the protocol version to the server. If not, an exception message is thrown.

[0023] The server receives the start message and detects whether the protocol version is supported. If so, the server sends a reply message to the client to inform the client that the protocol version is supported. If not, an exception message is thrown.

[0024] Optionally, the network communication consumption time statistical method of the database system further includes:

[0025] The server calibrates the time of the server where the client is located and its own server. If there is a time difference, record the time difference and send the time difference to the client.

[0026] The step of the server calculating the network consumption time of the start message according to the server reception time and the client transmission time includes:

[0027] Use the time difference to correct the difference between the server reception time and the client transmission time.

[0028] The step of the client calculating the network consumption time of the end message according to the client reception time and the server transmission time includes:

[0029] Use the time difference to correct the difference between the client reception time and the server transmission time.

[0030] According to another aspect of the present invention, there is also provided a computer device, including a memory, a processor, and a computer executable program stored on the memory and running on the processor, and when the processor executes the computer executable program, it implements the network communication consumption time statistical method of the database system according to any one of the above.

[0031] According to another aspect of the present invention, there is also provided a computer-readable storage medium, on which a computer executable program is stored, and when the computer executable program is executed by a processor, it implements the network communication consumption time statistical method of the database system according to any one of the above.

[0032] According to another aspect of the present invention, there is also provided a computer program product, including a computer executable program, and when the computer executable program is executed by a processor, it implements the network communication consumption time statistical method of the database system according to any one of the above.

[0033] The method, device, medium and product for statistically calculating the network communication time consumption of the database system of the present invention utilize the start message sent by the client to the server to carry the client sending time, record the server receiving time after the server receives the start message, and the server can calculate the network time consumption of the start message according to the server receiving time and the client sending time. The server then sends an end message to the client. The end message carries the server sending time and the network time consumption of the start message. The client receives the end message and records the client receiving time, and the client calculates the network time consumption of the end message according to the client receiving time and the server sending time. That is to say, during the process of task processing using messages between the client and the server, relevant time information is carried at the same time, so that the statistical calculation of the message transmission time can be completed while the task is being executed, without the need to use logs, which helps to improve the convenience of statistically calculating the network communication time consumption between the client and the server.

[0034] Further, the method, device, medium and product for statistically calculating the network communication time consumption of the database system of the present invention predefine a time information message in the database system. The time information message is used to carry time information and is sent along with the task message. In the step of the client sending a start message to the server, the start message includes a task request message and a time information message recording the client sending time. In the step of the server sending an end message to the client, the end message includes a task result message and a time information message recording the server sending time and the network time consumption of the start message. That is to say, an additional time information message is newly added outside the original types of task processing messages in the database system. The time information message can be sent along with each task processing message, thus realizing the transmission of time information. Since the types of task processing messages in the database system are diverse and the quantity is huge, if all types of messages are to be configured to be able to carry time information simultaneously, it will consume a large amount of program resources and the work is rather cumbersome. Therefore, by newly adding message definition and creating a time information message to carry time information separately, it only needs to ensure that the protocol version between the client and the server is supported, and there is no need to change the processing flow of the task message, further improving the convenience of statistically calculating the network communication time consumption between the client and the server.

[0035] Based on the following detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more clear about the above and other objects, advantages and features of the present invention. Description of the Drawings

[0036] Some specific embodiments of the present invention will be described in detail hereinafter with reference to the accompanying drawings in an exemplary but non-limiting manner. The same reference numerals in the drawings denote the same or similar components or parts. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0037] Figure 1 is a schematic flowchart of a method for counting network communication time consumption according to an embodiment of the present invention;

[0038] Figure 2 is a schematic flowchart of a method for counting network communication time consumption according to another embodiment of the present invention;

[0039] Figure 3 is a schematic flowchart of a method for counting network communication time consumption according to yet another embodiment of the present invention;

[0040] Figure 4 is a schematic flowchart of a method for counting network communication time consumption according to yet another embodiment of the present invention;

[0041] Figure 5 is a schematic flowchart of a method for counting network communication time consumption according to yet another embodiment of the present invention;

[0042] Figure 6 is a schematic flowchart of a method for counting network communication time consumption according to yet another embodiment of the present invention;

[0043] Figure 7 is a schematic diagram of a computer device according to an embodiment of the present invention;

[0044] Figure 8 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention;

[0045] Figure 9 is a schematic diagram of a computer program product according to an embodiment of the present invention. Detailed implementation manners

[0046] Those skilled in the art should understand that the embodiments described below are only a part of the embodiments of the present invention, rather than all the embodiments of the present invention. This part of the embodiments is intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts should still fall within the protection scope of the present invention.

[0047] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from the instruction execution system, apparatus or device and execute the instructions), or used in combination with these instruction execution systems, apparatus or devices.

[0048] The flowcharts provided by the present invention are not intended to indicate that the operations of the method will be executed in any specific order, or that all operations of the method are included in every case. In addition, the method may include additional operations. Within the scope of the technical concept provided by the method of this embodiment, additional changes may be made to the above method.

[0049] As Figure 1 shown, in one embodiment, the method for statistically calculating the network communication time consumption of a database system generally includes:

[0050] Step S101, the client sends a start message to the server, and the start message carries the client sending time. Specifically, the server is the database that stores data, and the client is an application program that interacts with the database, etc. After the client and the server establish a connection, tasks are executed between the client and the server through messages. The client can send a message with an SQL (Structured Query Language, abbreviated as SQL) statement to the server, and the server performs corresponding task operations in the database according to the SQL statement, such as query operations, etc. Then the server will send the execution result back to the client in the form of a message.

[0051] In one embodiment, the database system predefines a time information message, which is used to carry time information and is sent along with the task message. Specifically, the time information message structure includes a message identifier, a message length, the number of time information carried, and the name and timestamp of each time information. In this step, the start message includes a task request message and a time information message recording the client sending time.

[0052] Specifically, in the existing database system, there are multiple types of task messages configured, and each type of task message has its own message identifier. Different identifier task messages will be sent for different task scenarios between the client and the server. This embodiment is to add an additional message outside the existing task message types, that is, the time information message, which is only used to carry relevant time information and is sent along with the original task message during the process of a task between the client and the server.

[0053] Exemplarily, for a query task between the client and the server, the start message includes a query task request message and a time information message carrying the client sending time. The number of time information carried in the structure of the time information message is 1, the name of the time information can be "sendtime - driver", and the timestamp is the specific time of sending.

[0054] Step S102: The server receives the start message and records the server reception time. Specifically, after the server receives the start message, that is, the task request message and the time information message, it records the server reception time, which can be denoted as "receivetime-db".

[0055] Step S103: The server calculates the network latency of the start message based on the server reception time and the client sending time. Specifically, the difference between the server reception time and the client sending time is the network latency for transmitting the start message between the client and the server. Additionally, the server performs corresponding task operations according to the task request message.

[0056] Step S104: The server sends an end message to the client. The end message carries the server sending time and the network latency of the start message. Specifically, under the implementation method where a time information message is predefined in the database system, in this step, the end message includes a task result message and a time information message recording the server sending time and the network latency of the start message.

[0057] Exemplarily, for a query task between the client and the server, the end message includes an end message carrying the query result and a time information message carrying the server sending time and the network latency of the start message. The number of time information carried in the structure of the time information message is 2. The names of the time information can be "sendtime-db" and "transtime-send", and the time stamps are the specific times corresponding to the two pieces of time information.

[0058] Step S105: The client receives the end message and records the client reception time. Specifically, after the client receives the end message, that is, the task result message and the time information message carrying the server sending time and the network latency of the start message, it records the client reception time, which can be denoted as "receivetime-driver".

[0059] Step S106: The client calculates the network latency of the end message based on the client reception time and the server sending time. Specifically, the difference between the client reception time and the server sending time is the network latency for transmitting the end message between the client and the server.

[0060] So far, a task processing between the client and the server is completed, and both the network latency for initiating the task and the network latency for replying to the task have been obtained.

[0061] In the solution of this embodiment, by using the start message sent by the client to the server to carry the client sending time, recording the server receiving time after the server receives the start message, the server can calculate the network latency of the start message based on the server receiving time and the client sending time. The server then sends an end message to the client. The end message carries the server sending time and the network latency of the start message. The client receives the end message and records the client receiving time. The client calculates the network latency of the end message based on the client receiving time and the server sending time. That is to say, during the process of task processing using messages between the client and the server, relevant time information is carried simultaneously, so that the statistics of the message transmission time can be completed while the task is being executed, without the need to use logs, which helps to improve the convenience of statistics on the network communication latency between the client and the server.

[0062] Furthermore, by predefined a time information message in the database system, the time information message is used to carry time information and is sent along with the task message. In the step of the client sending the start message to the server, the start message includes a task request message and a time information message recording the client sending time. In the step of the server sending the end message to the client, the end message includes a task result message and a time information message recording the server sending time and the network latency of the start message. That is to say, an additional time information message is newly added outside the original types of task processing messages in the database system. The time information message can be sent along with each task processing message, thus realizing the transmission of time information. Since there are various types and a large number of task processing messages in the database system, if all types of messages are to be configured to carry time information simultaneously, it will consume a large amount of program resources and the work is rather cumbersome. Therefore, by adding a new message definition to create a time information message to carry time information alone, only the protocol version support between the client and the server needs to be ensured, and the processing flow of the task message does not need to be changed, which further improves the convenience of statistics on the network communication latency between the client and the server.

[0063] It should be noted that in some other embodiments, the start message can also be a task request message directly adding the client sending time data, and the end message can also be a task result message directly adding the server sending time and the network latency of the start message.

[0064] As Figure 2 shown, in one embodiment, in the step of the client sending the start message to the server, the time information message further includes the network latency of the start message and the network latency of the end message generated by the last completed task. After the server receives the start message, it stores the network latency of the start message and the network latency of the end message generated by the last completed task.

[0065] Reference Figure 2 As shown, taking the scenario of performing two task processes between the client 100 and the server 200 as an example, the two tasks are respectively recorded as the first task and the second task.

[0066] Step S201, the client 100 sends a first start message to the server 200. The first start message includes a first task request message and a time information message carrying the client sending time. Specifically, the client 100 simultaneously sends a first task request message and a time information message carrying the client sending time (i.e., the time when the task request message and the time information message are sent from the client) to the server 200.

[0067] Step S202, the server 200 performs a task operation and calculates the network latency of the first start message. Specifically, that is, after the server 200 receives the first task request message and the time information message, it performs the corresponding task operation according to the task request, and calculates the network latency of the first start message, that is, the first task request message, based on the client sending time and the server receiving time (i.e., the time when the server 200 receives the first task request message and the time information message).

[0068] Step S203, the server 200 sends a first end message to the client 100. The first end message includes a first task result message and a time information message carrying the server sending time and the first task request network latency. Specifically, the server 200 performs the corresponding task operation according to the task request of the first task request message, and after obtaining the corresponding task result, sends it to the client 100 in the form of a first task result message, and at the same time sends a time information message carrying the server sending time (i.e., the time when the server 200 sends the first task result message) and the first task request network latency.

[0069] Step S204, the client 100 calculates the network latency of the first end message. Specifically, the client calculates the network latency of the first end message, that is, the first task result message, based on the server sending time and the client receiving time (i.e., the time when the client 100 receives the first task result message and the time information message).

[0070] So far, the first task process is completed, and the network latencies of the two transmissions are obtained.

[0071] When the second task is executed:

[0072] Step S205: The client 100 sends a second start message to the server 200. The second start message includes a second task request message and a time information message carrying the client sending time, the network latency of the first start message, and the network latency of the first end message. Since when the second task is executed, the first task is the last completed task, the network latency of the first start message and the network latency of the first end message are the network latency of the start message and the network latency of the end message generated by the last completed task.

[0073] Step S206: The server 200 stores the network latency of the first start message and the network latency of the first end message on disk. That is, after receiving the network latency of the first start message and the network latency of the first end message, the server 200 permanently stores the two time information.

[0074] Step S207: The server 200 performs a task operation and calculates the network latency of the second start message. Specifically, after receiving the second task request message and the time information message, the server 200 performs a corresponding task operation according to the task request, and calculates the network latency of the second start message, that is, the second task request message, based on the client sending time and the server receiving time (i.e., the time when the server 200 receives the second task request message and the time information message).

[0075] Step S208: The server 200 sends a second end message to the client 100. The second end message includes a second task result message and a time information message carrying the server sending time and the network latency of the second task request. Specifically, after performing a corresponding task operation according to the task request of the second task request message and obtaining the corresponding task result, the server 200 sends it to the client 100 in the form of a second task result message, and at the same time sends a time information message carrying the server sending time (i.e., the time when the server 200 sends the second task result message) and the network latency of the second task request.

[0076] Step S209: The client 100 calculates the network latency of the second end message. Specifically, the client calculates the network latency of the second end message, that is, the second task result message, based on the server sending time and the client receiving time (i.e., the time when the client 100 receives the second task result message and the time information message).

[0077] At this point, the second task processing is completed, and the network latencies of two transmissions are obtained.

[0078] In the solution of this embodiment, in the step of the client sending a start message to the server, the time information message therein carries the network consumption time of the start message generated by the last completed task and the network consumption time of the end message. After the server receives the start message, it stores the network consumption time of the start message generated by the last completed task and the network consumption time of the end message to disk. That is, the network consumption time of the current task is stored to disk when the next task is executed and sent to the server, thus eliminating the need for an additional transmission, which helps reduce the occupation of operating resources.

[0079] As Figure 3 shown, in one embodiment, after the step of the client calculating the network consumption time of the end message based on the client receiving time and the server sending time, it includes:

[0080] Step S301, the client detects that the time without network interaction with the server reaches a preset time threshold. Specifically, that is, after the client and the server complete a task, the client starts to record the duration without network interaction with the server. When the detected duration reaches the preset time threshold, the next step is executed.

[0081] Step S302, the client sends a message to the server carrying the network consumption time of the start message generated by the last completed task and the network consumption time of the end message. Specifically, after the client detects that the time without network interaction with the server reaches the preset time threshold, that is, when there is no next task execution for a long time, it sends a message to the server recording the network consumption time of the start message generated by the last completed task and the network consumption time of the end message, so as to send the network consumption time of the start message generated by the last completed task and the network consumption time of the end message to the server for disk storage, avoiding the situation where the network consumption time of the start message generated by the last completed task and the network consumption time of the end message cannot be stored to disk due to the disconnection between the client and the server when there is no next task execution for a long time, which helps ensure the integrity of network consumption statistics. The message at this time can be the time information message in the previous text, or other messages such as a probing message can carry the time information.

[0082] Continue to refer to Figure 3 shown. Further, after the step of the client sending a probing message and a time information message recording the network consumption time of the start message generated by the last completed task and the network consumption time of the end message to the server, it includes:

[0083] Step S303, clear the sending record. Specifically, that is, clear the historical cache of the message sent this time to avoid occupying memory resources and causing unnecessary interference to the memory.

[0084] As Figure 4As shown, in one embodiment, the method for statistically calculating the network communication time consumption of a database system generally includes:

[0085] Step S401, the client establishes a connection with the server.

[0086] Step S402, the client detects whether the protocol version for sending time information packets is supported. If so, step S403 is executed; if not, step S406 is executed. Specifically, it is to detect whether the protocol version of the client supports sending time information packets while sending task packets.

[0087] Step S403, send a start packet carrying the protocol version to the server. Specifically, when the client protocol version supports sending time information packets, the client sends a start packet carrying the protocol version to the server, that is, sends the protocol version to the server so that the server can confirm whether it conforms to the protocol version.

[0088] Step S404, the server receives the start packet and detects whether the protocol version is supported. If so, step S405 is executed; if not, step S406 is executed. After the server receives a packet carrying a compliant protocol version, it can detect whether its own protocol version meets the requirements according to the received protocol version, that is, detect whether it supports sending time information packets.

[0089] Step S405, send a reply packet to the client to inform the client that the protocol version is supported. When the server supports the protocol version, send a reply packet confirming support to the client to inform the client that subsequent actions can be taken.

[0090] Step S406, throw an exception message. Specifically, when the protocol version does not support sending time information packets, an exception message is thrown to prompt to replace the client driver version or upgrade the server version.

[0091] In the solution of this embodiment, after the client and the server establish a connection, it is first detected whether the client and the server support the protocol version for sending time information packets, avoiding the situation that the time information packet is not sent due to the client and the server not supporting the protocol version, resulting in no statistical network time consumption.

[0092] As Figure 5 shown, in one embodiment, the method for statistically calculating the network communication time consumption of a database system generally includes:

[0093] Step S501, the server calibrates the time of the server where the client is located and its own server. Specifically, the method for calibrating the time between the server of the server and the client server is a prior art and will not be elaborated here.

[0094] Step S502: If there is a time difference, record the time difference and send it to the client. Specifically, if there is a time difference between the server and the client, the server records the time difference and sends it to the client.

[0095] In the case where there is a time difference between the server and the client, the steps for the server to calculate the network latency of the start message based on the server reception time and the client transmission time include: correcting the difference between the server reception time and the client transmission time using the time difference.

[0096] The steps for the client to calculate the network latency of the end message based on the client reception time and the server transmission time include: correcting the difference between the client reception time and the server transmission time using the time difference.

[0097] By enabling the server to calibrate the time of the client's server and its own server, in the case of a time difference, record the time difference and send it to the client, so that the client and the server can use the time difference for correction during the calculation of network latency, ensuring the accuracy of network latency statistics.

[0098] It should be noted that the timing for the server to send the time difference to the client can be when the server replies to the message supporting the protocol version to the client, or when the server sends the first task result message to the client.

[0099] Such as Figure 6 shown, in one embodiment, the method for statistically calculating the network communication latency of a database system generally includes:

[0100] Step S601: The client establishes a connection with the server.

[0101] Step S602: The client detects whether it is a protocol version that supports sending time information messages. If so, execute Step S603; if not, execute Step S607. Specifically, that is, to detect whether the client's protocol version supports sending task messages while sending time information messages.

[0102] Step S603: Construct and send a start message carrying the protocol version to the server. Specifically, in the case where the client protocol version supports sending time information messages, the client sends a start message carrying the protocol version to the server, that is, sends the protocol version to the server to enable the server to confirm whether it conforms to the protocol version.

[0103] Step S604, the server receives the start message and checks whether it supports the protocol version. If so, step S605 is executed; if not, step S607 is executed. After the server receives a message carrying a compliant protocol version, it can check whether its own protocol version meets the requirements based on the received protocol version, that is, check whether it supports sending time information messages.

[0104] Step S605, calibrate with the client server time. Specifically, the method of time calibration between the server and the client server is a prior art and will not be elaborated here.

[0105] Step S606, construct and send a reply message to the client. Specifically, the server replies to the client that it supports the protocol version, and if there is a time difference between the server and the client server, the time difference is also sent to the client.

[0106] Step S607, throw an exception message. Specifically, in the case where the protocol version does not support sending time information messages, an exception message is thrown to prompt to replace the client's driver version or upgrade the server version.

[0107] Step S608, monitor whether the connection between the client and the server needs to be closed. If so, step S609 is executed; if not, step S610 is executed. Specifically, it can be determined whether the connection between the client and the server needs to be closed by monitoring whether the non-interaction time between the client and the driver end reaches the time threshold. If the time threshold is reached, it is determined that the client and the server are about to disconnect.

[0108] Step S609, send the network consumption time of the last completed task to the server. Specifically, before the client and the server disconnect, the network consumption time of the last completed task is sent, that is, the network consumption time of the task request message and the network consumption time of the task result message.

[0109] Step S610, the client sends a message. Specifically, the client sends a task request message and a time information message to the server. If it is the first task between the client and the server, the time information message only carries the client sending time. If it is not the first task between the client and the server, the time information message carries the client sending time of this task and the network consumption time of the previous task.

[0110] Step S611, the server receives the message. Specifically, if it is the first task between the client and the server, the server executes the task, calculates the network consumption time of the task request message, and then sends the task result message and the time information message carrying the server sending time and the network consumption time of the task request message to the client.

[0111] If it is not the first task between the client and the server, the server stores the network time consumption of the previous task to disk. Then, the server executes the task, calculates the network time consumption of the task request message, and then sends the task result message and the time information message carrying the server sending time and the network time consumption of the task request message to the client.

[0112] In addition, after receiving the message from the server, the client calculates the network time consumption of the task result message.

[0113] By using the message sent by the client to the server to carry the client sending time, recording the server receiving time after the server receives the message, the server can calculate the network time consumption based on the server receiving time and the client sending time. The server then sends a message to the client, and the message carries the server sending time and the network time consumption. The client receives the message and records the client receiving time, and the client calculates the network time consumption based on the client receiving time and the server sending time. That is to say, during the process of task processing between the client and the server using messages, relevant time information is carried at the same time, so that the statistics of the message transmission time can be completed while the task is being executed, without the need to use logs, which helps to improve the convenience of statistics on the network communication time consumption between the client and the server.

[0114] This embodiment also provides a computer device and a computer-readable storage medium. Figure 7 It is a schematic diagram of a computer device 10 according to an embodiment of the present invention. Figure 8 It is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention.

[0115] The computer device 10 may include a memory 110, a processor 120, and a computer executable program 11 stored on the memory 110 and running on the processor 120, and when the processor 120 executes the computer executable program 11, it implements the network communication time consumption statistics method of the database system in any of the above embodiments.

[0116] The computer-readable storage medium 20 stores a computer executable program 11 thereon, and when the computer executable program 11 is executed by a processor, it implements the network communication time consumption statistics method of the database system in any of the above embodiments.

[0117] This embodiment also provides a computer program product. Figure 9 It is a schematic diagram of a computer program product 30 according to an embodiment of the present invention. The computer program product 30 includes a computer executable program 11, and when the computer executable program 11 is executed by a processor 120, it implements any of the above-mentioned network communication time consumption statistics methods of the database system.

[0118] Specifically, the computer-executable program 11 for performing the operations of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state-setting data, or source code or object code written in any combination of one or more programming languages.

[0119] For the purposes of this embodiment description, the computer-readable storage medium 20 can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable storage medium 20 can even be paper or other suitable medium on which the program can be printed, as the program can be obtained electronically, for instance, by optically scanning the paper or other medium, followed by editing, interpretation, or, as necessary, other suitable processing, and then stored in a computer memory.

[0120] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0121] The computer device 10 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smart phone. In some examples, the computer device 10 can be a cloud acquisition node. The computer device 10 can be described in the general context of computer system-executable instructions, such as program modules, executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., that perform particular tasks or implement particular abstract data types. The computer device 10 can be implemented in a distributed cloud acquisition environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud acquisition environment, program modules can be located on local or remote acquisition system storage media including storage devices.

[0122] The computer device 10 may include a processor 120 adapted to execute stored instructions and a memory 110 that provides temporary storage space for the operation of the instructions during operation. The processor 120 may be a single-core processor, a multi-core processor, an acquisition cluster, or any number of other configurations. The memory 110 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0123] The processor 120 may be connected through a system interconnect (such as PCI, PCI-Express, etc.) to an I / O interface (input / output interface) adapted to connect the computer device 10 to one or more I / O devices (input / output devices). The I / O devices may include, for example, a keyboard and a pointing device, where the pointing device may include a touchpad or a touch screen, etc. The I / O devices may be built-in components of the computer device 10 or may be devices externally connected to the acquisition device.

[0124] The processor 120 may also be linked through a system interconnect to a display interface adapted to connect the computer device 10 to a display device. The display device may include a display screen as a built-in component of the computer device 10. The display device may also include a computer monitor, a television, a projector, etc. externally connected to the computer device 10. In addition, a network interface controller (NIC) may be adapted to connect the computer device 10 to a network through a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as Internet Small Computer System Interface, etc.) to transmit data. The network may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, etc. A remote device may be connected to the computer device through the network.

[0125] At this point, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications consistent with the principles of the present invention can still be directly determined or derived from the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and construed to cover all such other variations or modifications.

Claims

1. A method for counting network communication time consumption of a database system, wherein the database system includes a client and a server, wherein: The network communication time consumption statistics method of the database system includes: The client sends a start message to the server, and the start message carries the time when the client sends the message. The server receives the start message and records the time when the server receives the message; The server calculates the network time consumed by the start message according to the server receiving time and the client sending time; The server sends an end message to the client, where the end message carries the server sending time and the network time consumed by the start message; The client receives the end message and records the time when the client receives the message; The client calculates the network time consumed by the end message according to the receiving time of the client and the sending time of the server.

2. The method for counting network communication time consumption of a database system according to claim 1, wherein: The database system predefines a time information message, which is used to carry time information and is sent along with the task message; In the step of the client sending a start message to the server, the start message includes a task request message and a time information message recording the time when the client sent the message; In the step of the server sending an end message to the client, the end message includes a task result message and a time information message recording the time when the server sent the message and the network time consumed by the start message.

3. The method for counting network communication time consumption of a database system according to claim 2, wherein: In the step of the client sending a start message to the server, the time information message also includes the network time consumed by the start message and the network time consumed by the end message generated by the last completed task; After receiving the start message, the server saves the network time consumed by the start message and the network time consumed by the end message generated by the last completed task to a disk.

4. The method for counting network communication time consumption of a database system according to claim 3, wherein: After the step of the client calculating the network time consumed by the end message according to the client receiving time and the server sending time, the following steps are included: The client detects that the time for which no network interaction is performed with the server reaches a preset time threshold; The client sends a message carrying the network time consumed by the start message and the network time consumed by the end message generated by the last completed task to the server.

5. The method for counting network communication time consumption of a database system according to claim 4, wherein: After the step of the client sending a message carrying the network time of the start message and the network time of the end message generated by the last completed task to the server, the following steps are included: Clear sending records.

6. The method for counting network communication time consumption of a database system according to claim 2, wherein: After the client establishes a connection with the server, the client detects whether the protocol version for sending the time information message is supported, and if so, sends a startup message carrying the protocol version to the server, and if not, throws an exception message; The server receives the startup message and detects whether the protocol version is supported. If so, a reply message is sent to the client to inform the client that the protocol version is supported. If not, an exception message is thrown.

7. The method for counting network communication time consumption of a database system according to claim 1, wherein: The network communication time-consuming statistical method of the database system also includes: The server calibrates the time between the server where the client is located and its own server, and if there is a time difference, records the time difference and sends the time difference to the client; The step of calculating the network time consumed by the server according to the reception time of the server and the sending time of the client comprises: Using the time difference to correct the difference between the receiving time of the server and the sending time of the client; The step of the client calculating the network time consumed by the end message according to the client receiving time and the server sending time comprises: The time difference is used to correct the difference between the client receiving time and the server sending time.

8. A computer device, comprising a memory, a processor, and a computer executable program stored in the memory and running on the processor, wherein the processor implements the network communication time consumption statistics method of the database system according to any one of claims 1 to 7 when executing the computer executable program.

9. A computer-readable storage medium having a computer executable program stored thereon, wherein the computer executable program, when executed by a processor, implements the method for counting network communication time consumption of a database system according to any one of claims 1 to 7.

10. A computer program product, comprising a computer executable program, wherein when the computer executable program is executed by a processor, the method for counting network communication time consumption of a database system according to any one of claims 1 to 7 is implemented.