CN110808877A - Statistical analysis method and device based on interface response duration and computer equipment - Google Patents

Statistical analysis method and device based on interface response duration and computer equipment Download PDF

Info

Publication number
CN110808877A
CN110808877A CN201911045995.2A CN201911045995A CN110808877A CN 110808877 A CN110808877 A CN 110808877A CN 201911045995 A CN201911045995 A CN 201911045995A CN 110808877 A CN110808877 A CN 110808877A
Authority
CN
China
Prior art keywords
interface
time
request
client
response
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911045995.2A
Other languages
Chinese (zh)
Inventor
陈润
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhai Huanlianyi Information Technology Service Co Ltd
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanlianyi Information Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhai Huanlianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanlianyi Information Technology Service Co Ltd
Priority to CN201911045995.2A priority Critical patent/CN110808877A/en
Publication of CN110808877A publication Critical patent/CN110808877A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0852Delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/142Network analysis or design using statistical or mathematical methods

Abstract

The embodiment of the invention discloses a statistical analysis method, a statistical analysis device and computer equipment based on interface response duration, wherein the method comprises the steps of controlling a client to package a request interceptor; calling a request interception function in a request interceptor to obtain the initiation time of the interface request, and determining the initiation time as a starting time point; calling a callback function in a request interceptor to acquire the receiving time of the response data information received by the client, and determining the receiving time as an end time point; subtracting the ending time point from the starting time point to obtain a time difference, determining the time difference as the interface response duration of the corresponding interface, and storing the time difference in a Session storage medium; and determining the interface response time length with the maximum value in the Session storage medium, and identifying the interface corresponding to the interface response time length with the maximum value so as to perform preset optimization processing. The invention can obtain the response time of the multiple interfaces for analysis so as to improve the stability of the performance of the corresponding interfaces.

Description

Statistical analysis method and device based on interface response duration and computer equipment
Technical Field
The invention relates to the field of data processing, in particular to a statistical analysis method and device based on interface response duration and computer equipment.
Background
The service system often calls a plurality of background interfaces in the operation process, the response durations of different background interfaces may have differences, if the background interfaces respond slowly, while the background interfaces respond quickly, and the performance optimization of response can be performed according to the response durations of the background interfaces under general conditions. However, it is still difficult to count the response durations of different interfaces of the service system in the same network environment, that is, the response duration of a single background interface can only be obtained through the console of the service system, but the statistics cannot be compared with the response conditions of other interfaces, and in this case, it is impossible to objectively reflect whether the response of the interface takes a long time, so that it is difficult to accurately determine the background interface requiring performance optimization, and at this time, the performance of some background interfaces is unstable.
Disclosure of Invention
The embodiment of the invention provides a statistical analysis method and device based on interface response duration and computer equipment, which can acquire the response duration of multiple interfaces for analysis so as to improve the stability of the performance of the corresponding interfaces.
In a first aspect, an embodiment of the present invention provides a statistical analysis method based on interface response durations, where the method includes:
controlling a client to package a request interceptor;
if the client initiates an interface request to one of the interfaces of the backend server, calling a request interception function in the request interceptor to obtain the initiation time of the interface request, and determining the initiation time as a starting time point;
if the fact that the back-end server returns response data information to the client is detected, calling a callback function in the request interceptor to obtain receiving time of the client for receiving the response data information, and determining the receiving time as an end time point;
subtracting the ending time point and the starting time point to obtain a time difference, determining the time difference as the interface response time length of the corresponding interface, and sending the interface response time length to a Session storage medium for storage;
if the number of different interface requests initiated by the client to the backend server is equal to the preset number, determining the interface response time length with the maximum value in the Session storage medium, and identifying the interface corresponding to the interface response time length with the maximum value so as to perform preset optimization processing.
In a second aspect, an embodiment of the present invention further provides a device for statistical analysis based on interface response duration, where the device includes:
the control unit is used for controlling the client side packaging request interceptor;
the first processing unit is used for calling a request interception function in the request interceptor to obtain the initiation time of the interface request and determining the initiation time as a starting time point if the client initiates the interface request to one of the interfaces of the backend server;
the second processing unit is used for calling a callback function in the request interceptor to acquire the receiving time of the response data information received by the client and determining the receiving time as an end time point if the fact that the back-end server returns the response data information to the client is detected;
the computing unit is used for subtracting the ending time point from the starting time point to obtain a time difference, determining the time difference as the interface response time length of the corresponding interface, and sending the interface response time length to a Session storage medium for storage;
and the third processing unit is configured to determine, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to a preset number, an interface response duration with a maximum value in the Session storage medium, and identify an interface corresponding to the interface response duration with the maximum value, so as to perform preset optimization processing.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the above method when executing the computer program.
The embodiment of the invention provides a statistical analysis method and device based on interface response duration and computer equipment. The embodiment of the invention can carry out statistical analysis on the response time lengths of the plurality of interfaces, thereby improving the stability of the performance of the corresponding interfaces.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a statistical analysis method based on interface response duration according to an embodiment of the present invention;
fig. 2 is a schematic sub-flow chart of a statistical analysis method based on interface response duration according to an embodiment of the present invention;
fig. 3 is a schematic sub-flow chart of a statistical analysis method based on interface response duration according to an embodiment of the present invention;
fig. 4 is a schematic sub-flow chart of a statistical analysis method based on interface response duration according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a statistical analysis apparatus based on interface response duration according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of a first processing unit of a statistical analysis device based on interface response duration according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of a second processing unit of the apparatus for statistical analysis based on interface response duration according to the embodiment of the present invention;
fig. 8 is a schematic block diagram of a third processing unit of the apparatus for statistical analysis based on interface response duration according to the embodiment of the present invention;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
Referring to fig. 1, fig. 1 is a schematic flow chart of a statistical analysis method based on interface response duration according to an embodiment of the present invention. The method can be operated in terminals such as smart phones (such as Android phones, IOS phones and the like), tablet computers, notebook computers, smart devices and the like. As shown in fig. 1, the steps of the method include steps S101 to S105.
And step S101, controlling the client to package the request interceptor.
In this embodiment, the client may be a front-end project based on a VUE framework, for example, the front-end project may be a certain background management system, the front-end project of the background management system may call an interface API in the background management system by sending an interface request, and the front-end project may also receive data information returned by the interface API to perform page rendering display. The background management system can be a background server, and the front-end engineering can carry out data communication with the background server by calling an interface in the background server. In general, the background server may include several interfaces for the client to call, and the client may initiate different interface requests for different interfaces.
The control of the client encapsulation request interceptor means that the client encapsulation request interceptor is used for encapsulating the request interceptor, and usually all interface requests pass through the request interceptor, that is, the request interceptor means that a front-end project calls a uniform inlet of an interface API of a background management system, so that uniform interception processing of the interface requests can be performed. For example, the request interceptor may be a function of the VUE framework itself, and only needs to call a VUE method vue.http.intersections function in an entry function of the VUE item, specifically, in the VUE item, the vue.http.intersections function may be defined in a main.js entry file, so that it can be known that the interceptor is an entry for all interface requests, that is, all interface requests pass through the function, and the function performs a uniform interception processing function.
Step S102, if detecting that the client initiates an interface request to one of the interfaces of the backend server, calling a request interception function in the request interceptor to obtain the initiation time of the interface request, and determining the initiation time as a starting time point.
In this embodiment, if it is detected that the client initiates an interface request to one of the interfaces of the backend server, a request interception function in the request interceptor may be called, and the initiation time of the interface request is obtained. For example, for a back-end server, page a of the client may call some interface of the back-end server to obtain form data for a form used to render the page. When a client initiates an interface request, the interface request passes through a request interceptor, the initiation time of the interface request initiated by the client can be acquired and recorded before the interface request is forwarded by the request interceptor, and the initiation time is determined as the starting time point of the interface request. In general, the starting time point may be accurate to several milliseconds, and for example, the recording of data may also be realized through a preset time recording function performance.
In an embodiment, as shown in fig. 2, the request intercepting function is a vue.http.interpenetrates function, and the step S102 may include steps S201 to S203.
Step S201, if it is detected that the client initiates an interface request to one of the interfaces of the backend server, call the vue.
In this embodiment, if it is detected that the client initiates an interface request to one of the interfaces of the backend server, a function defined in main.js entry file, vue.http.interrupts, may be called to implement interception of the interface request.
Step S202, operating the Vue, http and interrupts functions to obtain the initiation time of the interface request.
In this embodiment, the interface request can be intercepted by running the vue.http.interpenetrates function, so as to obtain the initiation time of the interface request.
Step S203, determining and recording the initiation time as a start time point of the interface request through a preset time recording function.
In this embodiment, through a preset time recording function, the initiation time may be recorded, and at the same time, the initiation time may also be determined as a starting time point of the interface request. For example, the preset time recording function may be performance.
Step S103, if it is detected that the back-end server returns response data information to the client, a callback function in the request interceptor is called to obtain the receiving time of the client for receiving the response data information, and the receiving time is determined as an end time point.
In this embodiment, if it is detected that the back-end server returns response data information to the client, it indicates that the back-end server may call corresponding response data information to return to the client after receiving an interface request, and after the response data information is sent to the client, it calls a callback function in the request connector, and after the callback function is triggered, it indicates that the interface request is completed, and at this time, it may obtain the receiving time from the client interface to the response data information, and determine the receiving time as the end time point of the interface request. In general, the ending time point may be accurate to several milliseconds, and for example, the recording of data may also be realized through a preset time recording function performance.
In one embodiment, as shown in FIG. 3, the step S103 may include steps S301 to S303.
Step S301, if it is detected that the back-end server returns response data information to the client, call a callback function in the request interceptor.
In this embodiment, if it is detected that the back-end server returns the response data information to the client, a callback function in the request interceptor may be called to obtain the response data information.
Step S302, running the callback function to obtain the receiving time of the client receiving the response data information.
In this embodiment, the callback function is run, and it can be determined that the interface request is completed, at this time, response data information returned by the back-end server may be acquired, and the receiving time of the client side receiving the response data information is determined.
Step S303, determining and recording the receiving time as an end time point of the interface request through a preset time recording function.
In this embodiment, through a preset time recording function, the receiving time may be recorded, and meanwhile, the receiving time may also be determined as the end time point of the interface request. For example, the preset time recording function may be performance.
And step S104, subtracting the ending time point and the starting time point to obtain a time difference, determining the time difference as the interface response time length of the corresponding interface, and sending the interface response time length to a Session storage medium for storage.
In this embodiment, the time difference obtained by subtracting the ending time point from the starting time point can be determined as the interface response duration after the client sends the interface request to the corresponding interface and the interface responds to the interface request and returns the response data information to the client. Since the back-end server may include a plurality of interfaces, in order to test the interface response duration between the client and different interfaces for comparison, after determining the interface response duration corresponding to one of the interfaces, the interface response duration needs to be sent to the Session storage medium for storage, so as to perform subsequent unified analysis processing. Among them, Session is called "Session control" in a computer, particularly in a network application, and Session technology saves a state by a server. We can refer to a series of actions of the server and the client browser as a Session, and the Session is a storage space opened by the server for the client, in which the information is stored for saving the state. The Session storage medium may store relevant information needed for a particular user Session.
Step S105, if the number of different interface requests initiated by the client to the backend server is detected to be equal to the preset number, determining the interface response time length with the maximum value in the Session storage medium, and identifying the interface corresponding to the interface response time length with the maximum value so as to perform preset optimization processing.
In this embodiment, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to the preset number, it indicates that the client has initiated requests to the preset number of different interfaces, and has obtained the preset number of interface response durations, and the different interface response durations correspond to different interfaces, that is, the interface response duration with the largest value stored in the Session storage medium may be determined at this time. Wherein the Session storage medium can store related information, such as interface response duration.
In one embodiment, as shown in FIG. 4, the step S105 may include steps S401 to S404.
Step S401, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to the preset number, acquiring all interface response durations in the Session storage medium.
In this embodiment, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to the preset number, all the interface response durations in the Session storage medium may be directly obtained at this time, so as to facilitate subsequent analysis processing.
Step S402, sequencing the obtained interface response time length according to the value of the numerical value so as to determine the interface response time length with the maximum numerical value.
In this embodiment, the obtained interface response durations may be sorted from left to right or from right to left according to the magnitude of the numerical value, so as to determine the interface response duration with the largest numerical value.
Step S403, determining an interface corresponding to the interface response duration with the largest value to identify the interface.
In this embodiment, the maximum interface response duration is determined, and at this time, the interface corresponding to the interface response duration with the maximum value may also be determined, and the interface is identified so as to search for confirmation.
Step S404, performing preset optimization processing on the identified interface.
In this embodiment, it is also necessary to perform preset optimization processing on the identified interface, so as to implement analysis and optimization on the interface by systematically counting and analyzing the response time of the interface.
In an embodiment, step S105 of the method may further include the following steps:
step S106, judging whether the number of the detected different interface requests initiated by the client to the backend server is equal to the preset number.
In this embodiment, the method may further include a step of determining whether the number of the detected different interface requests initiated by the client to the backend server is equal to a preset number, so as to determine whether to perform a next ranking analysis on all the interface response durations in the Session storage medium.
If it is detected that the number of the different interface requests initiated by the client to the backend server is not equal to the preset number, the step S102 is executed in a return manner.
In summary, the embodiment of the present invention can perform statistical analysis on the response durations of multiple interfaces, thereby improving the stability of the performance of the corresponding interfaces.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
Referring to fig. 5, in response to the above statistical analysis method based on interface response duration, an embodiment of the present invention further provides a statistical analysis apparatus based on interface response duration, where the apparatus 100 includes: a control unit 101, a first processing unit 102, a second processing unit 103, a calculation unit 104, and a third processing unit 105.
The control unit 101 is configured to control a client encapsulation request interceptor.
In this embodiment, the client may be a front-end project based on a VUE framework, for example, the front-end project may be a certain background management system, the front-end project of the background management system may call an interface API in the background management system by sending an interface request, and the front-end project may also receive data information returned by the interface API to perform page rendering display. The background management system can be a background server, and the front-end engineering can carry out data communication with the background server by calling an interface in the background server. In general, the background server may include several interfaces for the client to call, and the client may initiate different interface requests for different interfaces.
The control of the client encapsulation request interceptor means that the client encapsulation request interceptor is used for encapsulating the request interceptor, and usually all interface requests pass through the request interceptor, that is, the request interceptor means that a front-end project calls a uniform inlet of an interface API of a background management system, so that uniform interception processing of the interface requests can be performed. For example, the request interceptor may be a function of the VUE framework itself, and only needs to call a VUE method vue.http.intersections function in an entry function of the VUE item, specifically, in the VUE item, the vue.http.intersections function may be defined in a main.js entry file, so that it can be known that the interceptor is an entry for all interface requests, that is, all interface requests pass through the function, and the function performs a uniform interception processing function.
The first processing unit 102 is configured to, if it is detected that the client initiates an interface request to one of the interfaces of the backend server, call a request interception function in the request interceptor to obtain initiation time of the interface request, and determine the initiation time as a start time point.
In this embodiment, if it is detected that the client initiates an interface request to one of the interfaces of the backend server, a request interception function in the request interceptor may be called, and the initiation time of the interface request is obtained. For example, for a back-end server, page a of the client may call some interface of the back-end server to obtain form data for a form used to render the page. When a client initiates an interface request, the interface request passes through a request interceptor, the initiation time of the interface request initiated by the client can be acquired and recorded before the interface request is forwarded by the request interceptor, and the initiation time is determined as the starting time point of the interface request. In general, the starting time point may be accurate to several milliseconds, and for example, the recording of data may also be realized through a preset time recording function performance.
In an embodiment, as shown in fig. 6, the request intercepting function is a vue.http.interpenetrates function, and the first processing unit 102 may include a first calling unit 201, a first executing unit 202, and a first determining unit 203.
The first calling unit 201 is configured to call the vue.http.interrupts function if it is detected that the client initiates an interface request to one of the interfaces of the backend server.
In this embodiment, if it is detected that the client initiates an interface request to one of the interfaces of the backend server, a function defined in main.js entry file, vue.http.interrupts, may be called to implement interception of the interface request.
The first running unit 202 is configured to run the vue.http.interrupts function to obtain the initiation time of the interface request.
In this embodiment, the interface request can be intercepted by running the vue.http.interpenetrates function, so as to obtain the initiation time of the interface request.
The first determining unit 203 is configured to determine and record the initiation time as a starting time point of the interface request through a preset time recording function.
In this embodiment, through a preset time recording function, the initiation time may be recorded, and at the same time, the initiation time may also be determined as a starting time point of the interface request. For example, the preset time recording function may be performance.
The second processing unit 103 is configured to, if it is detected that the back-end server returns response data information to the client, call a callback function in the request interceptor to obtain receiving time of the client receiving the response data information, and determine the receiving time as an end time point.
In this embodiment, if it is detected that the back-end server returns response data information to the client, it indicates that the back-end server may call corresponding response data information to return to the client after receiving an interface request, and after the response data information is sent to the client, it calls a callback function in the request connector, and after the callback function is triggered, it indicates that the interface request is completed, and at this time, it may obtain the receiving time from the client interface to the response data information, and determine the receiving time as the end time point of the interface request. In general, the ending time point may be accurate to several milliseconds, and for example, the recording of data may also be realized through a preset time recording function performance.
In an embodiment, as shown in fig. 7, the second processing unit 103 may include a second calling unit 301, a second running unit 302, and a second determining unit 303.
The second calling unit 301 is configured to, if it is detected that the back-end server returns response data information to the client, call a callback function in the request interceptor.
In this embodiment, if it is detected that the back-end server returns the response data information to the client, a callback function in the request interceptor may be called to obtain the response data information.
The second operation unit 302 is configured to operate the callback function, so as to obtain a receiving time when the client receives the response data information.
In this embodiment, the callback function is run, and it can be determined that the interface request is completed, at this time, response data information returned by the back-end server may be acquired, and the receiving time of the client side receiving the response data information is determined.
The second determining unit 303 is configured to determine and record the receiving time as an end time point of the interface request through a preset time recording function.
In this embodiment, through a preset time recording function, the receiving time may be recorded, and meanwhile, the receiving time may also be determined as the end time point of the interface request. For example, the preset time recording function may be performance.
The calculating unit 104 is configured to subtract the ending time point from the starting time point to obtain a time difference, determine the time difference as an interface response duration of the corresponding interface, and send the interface response duration to a Session storage medium for storage.
In this embodiment, the time difference obtained by subtracting the ending time point from the starting time point can be determined as the interface response duration after the client sends the interface request to the corresponding interface and the interface responds to the interface request and returns the response data information to the client. Since the back-end server may include a plurality of interfaces, in order to test the interface response duration between the client and different interfaces for comparison, after determining the interface response duration corresponding to one of the interfaces, the interface response duration needs to be sent to the Session storage medium for storage, so as to perform subsequent unified analysis processing.
The third processing unit 105 is configured to determine an interface response duration with a largest value in the Session storage medium if it is detected that the number of different interface requests initiated by the client to the backend server is equal to a preset number, and identify an interface corresponding to the interface response duration with the largest value, so as to perform preset optimization processing.
In this embodiment, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to the preset number, it indicates that the client has initiated requests to the preset number of different interfaces, and has obtained the preset number of interface response durations, and the different interface response durations correspond to different interfaces, that is, the interface response duration with the largest value stored in the Session storage medium may be determined at this time. Wherein the Session storage medium can store related information, such as interface response duration.
In an embodiment, as shown in fig. 8, the third processing unit 105 may include a duration obtaining unit 401, a duration determining unit 402, an interface identifying unit 403, and an optimizing unit 404.
The duration obtaining unit 401 is configured to obtain all interface response durations in the Session storage medium if it is detected that the number of different interface requests initiated by the client to the backend server is equal to a preset number.
In this embodiment, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to the preset number, all the interface response durations in the Session storage medium may be directly obtained at this time, so as to facilitate subsequent analysis processing.
The duration determining unit 402 is configured to sort the obtained interface response durations according to the magnitudes of the values, so as to determine the interface response duration with the largest value.
In this embodiment, the obtained interface response durations may be sorted from left to right or from right to left according to the magnitude of the numerical value, so as to determine the interface response duration with the largest numerical value.
The interface identification unit 403 is configured to determine an interface corresponding to the interface response duration with the largest value to identify the interface.
In this embodiment, the maximum interface response duration is determined, and at this time, the interface corresponding to the interface response duration with the maximum value may also be determined, and the interface is identified so as to search for confirmation.
The optimization unit 404 is configured to perform preset optimization processing on the identified interface.
In this embodiment, it is also necessary to perform preset optimization processing on the identified interface, so as to implement analysis and optimization on the interface by systematically counting and analyzing the response time of the interface.
In an embodiment, the third processing unit 105 of the apparatus 100 may further comprise the following units before:
the determining unit 106 is configured to determine whether the number of the detected different interface requests initiated by the client to the backend server is equal to a preset number.
In this embodiment, the method may further include a step of determining whether the number of the detected different interface requests initiated by the client to the backend server is equal to a preset number, so as to determine whether to perform a next ranking analysis on all the interface response durations in the Session storage medium.
If it is detected that the number of different interface requests initiated by the client to the backend server is not equal to the preset number, the first processing unit 102 is returned to be executed.
It should be clearly understood by those skilled in the art that the above-mentioned statistical analysis device 100 based on interface response duration and the specific implementation process of each unit may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided here.
As can be seen from the above, in terms of hardware implementation, the above control unit 101, the first processing unit 102, the second processing unit 103, the computing unit 104, the third processing unit 105, and the like may be embedded in hardware or independent of the device for reporting the life insurance, or may be stored in the memory of the statistical analysis device based on the interface response time length in software, so that the processor calls to execute operations corresponding to the above units. The processor can be a Central Processing Unit (CPU), a microprocessor, a singlechip and the like.
The statistical analysis device based on the interface response time length can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in fig. 9.
Fig. 9 is a schematic structural diagram of a computer device according to the present invention. The device can be a terminal, wherein the terminal can be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device. Referring to fig. 9, the computer device 500 includes a processor 502, a memory, an internal memory 504, and a network interface 505 connected by a system bus 501, wherein the memory may include a nonvolatile storage medium 503 and the internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032, which when executed, may cause the processor 502 to perform a statistical analysis method based on the duration of the interface response.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 may be enabled to perform a statistical analysis method based on the response time of the interface.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 9 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run the computer program 5032 stored in the memory to implement the steps of the statistical analysis method based on the response time of the interface.
It should be understood that, in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable gate arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program that, when executed by a processor, causes the processor to perform the steps of the statistical analysis method based on interface response time. The storage medium is an entity and non-transitory storage medium, and may be various entity storage media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A statistical analysis method based on interface response duration, the method comprising:
controlling a client to package a request interceptor;
if the client initiates an interface request to one of the interfaces of the backend server, calling a request interception function in the request interceptor to obtain the initiation time of the interface request, and determining the initiation time as a starting time point;
if the fact that the back-end server returns response data information to the client is detected, calling a callback function in the request interceptor to obtain receiving time of the client for receiving the response data information, and determining the receiving time as an end time point;
subtracting the ending time point and the starting time point to obtain a time difference, determining the time difference as the interface response time length of the corresponding interface, and sending the interface response time length to a Session storage medium for storage;
if the number of different interface requests initiated by the client to the backend server is equal to the preset number, determining the interface response time length with the maximum value in the Session storage medium, and identifying the interface corresponding to the interface response time length with the maximum value so as to perform preset optimization processing.
2. The method of claim 1, wherein the method further comprises:
if the number of different interface requests initiated to the back-end server by the client is detected to be not equal to the preset number, executing a step of calling a request interception function in the request interceptor to obtain the initiation time of the interface request and determining the initiation time as a starting time point if the client is detected to initiate the interface request to one of the interfaces of the back-end server.
3. The method of claim 1, wherein the request interception function is a vue.http.interpenetrates function, and the step of calling the request interception function in the request interceptor to obtain the initiation time of the interface request and determine the initiation time as the start time point, if it is detected that the client initiates the interface request to one of the interfaces of the backend server, comprises:
if the client initiates an interface request to one of the interfaces of the backend server, calling the Vue.
Running the Vue, http and interpenetents functions to obtain the initiation time of the interface request;
and determining and recording the initiation time as the starting time point of the interface request through a preset time recording function.
4. The method of claim 1, wherein if it is detected that the backend server returns a response data message to the client, the step of calling a callback function in the request interceptor to obtain a receiving time when the client receives the response data message and determining the receiving time as an end time point comprises:
if the back-end server is detected to return response data information to the client, calling a callback function in the request interceptor;
the callback function is operated to acquire the receiving time of the client side for receiving the response data information;
and determining and recording the receiving time as the ending time point of the interface request through a preset time recording function.
5. The method according to claim 3 or 4, wherein the preset time recording function is performance.
6. The method according to claim 1, wherein if it is detected that the number of different interface requests initiated by the client to the backend server is equal to a preset number, determining an interface response duration with a maximum value in the Session storage medium, and identifying an interface corresponding to the interface response duration with the maximum value, so as to perform a preset optimization process, the method comprises:
if the number of different interface requests initiated by the client to the backend server is equal to the preset number, acquiring all interface response durations in the Session storage medium;
sequencing the obtained interface response time length according to the value of the numerical value so as to determine the interface response time length with the maximum numerical value;
determining an interface corresponding to the interface response duration with the maximum value to identify the interface;
and carrying out preset optimization processing on the identified interface.
7. A device for statistical analysis based on interface response duration, the device comprising:
the control unit is used for controlling the client side packaging request interceptor;
the first processing unit is used for calling a request interception function in the request interceptor to obtain the initiation time of the interface request and determining the initiation time as a starting time point if the client initiates the interface request to one of the interfaces of the backend server;
the second processing unit is used for calling a callback function in the request interceptor to acquire the receiving time of the response data information received by the client and determining the receiving time as an end time point if the fact that the back-end server returns the response data information to the client is detected;
the computing unit is used for subtracting the ending time point from the starting time point to obtain a time difference, determining the time difference as the interface response time length of the corresponding interface, and sending the interface response time length to a Session storage medium for storage;
and the third processing unit is configured to determine, if it is detected that the number of different interface requests initiated by the client to the backend server is equal to a preset number, an interface response duration with a maximum value in the Session storage medium, and identify an interface corresponding to the interface response duration with the maximum value, so as to perform preset optimization processing.
8. The apparatus of claim 7, wherein the request interception function is a vue.http.interpenetrates function, and the first processing unit includes:
the first calling unit is used for calling the Vue.
A first operation unit, configured to operate the vue.http.interpenetrates function, so as to obtain initiation time of the interface request;
and the first determining unit is used for determining and recording the initiation time as the starting time point of the interface request through a preset time recording function.
9. The apparatus of claim 7, wherein the second processing unit comprises:
the second calling unit is used for calling a callback function in the request interceptor if the back-end server is detected to return response data information to the client;
the second operation unit is used for operating the callback function so as to acquire the receiving time of the response data information received by the client;
and the second determining unit is used for determining and recording the receiving time as the ending time point of the interface request through a preset time recording function.
10. A computer arrangement, characterized in that the computer arrangement comprises a memory having stored thereon a computer program and a processor implementing the method according to any of claims 1-6 when executing the computer program.
CN201911045995.2A 2019-10-30 2019-10-30 Statistical analysis method and device based on interface response duration and computer equipment Pending CN110808877A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911045995.2A CN110808877A (en) 2019-10-30 2019-10-30 Statistical analysis method and device based on interface response duration and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911045995.2A CN110808877A (en) 2019-10-30 2019-10-30 Statistical analysis method and device based on interface response duration and computer equipment

Publications (1)

Publication Number Publication Date
CN110808877A true CN110808877A (en) 2020-02-18

Family

ID=69489558

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911045995.2A Pending CN110808877A (en) 2019-10-30 2019-10-30 Statistical analysis method and device based on interface response duration and computer equipment

Country Status (1)

Country Link
CN (1) CN110808877A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111931080A (en) * 2020-07-24 2020-11-13 上海泛微网络科技股份有限公司 Method, system and storage medium for automatically displaying time in multiple time zones
CN112311811A (en) * 2020-11-16 2021-02-02 深圳市欢太科技有限公司 Full link tracking method, device, storage medium and server
CN112559271A (en) * 2020-12-24 2021-03-26 北京百度网讯科技有限公司 Method, device, equipment and storage medium for monitoring interface performance of distributed application
CN112839096A (en) * 2021-01-14 2021-05-25 平安国际智慧城市科技股份有限公司 Method and device for monitoring function execution duration, computer equipment and storage medium
CN113316125A (en) * 2021-06-28 2021-08-27 广州小鹏汽车科技有限公司 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100056230A1 (en) * 2008-09-03 2010-03-04 Futurewei Technologies, Inc. Optimization of Power Conservation with Respect to Application Requirements
CN106803799A (en) * 2015-11-26 2017-06-06 阿里巴巴集团控股有限公司 A kind of performance test methods and device
CN107526678A (en) * 2016-06-22 2017-12-29 平安科技(深圳)有限公司 The method of testing and device of web application
CN108415847A (en) * 2018-05-08 2018-08-17 平安普惠企业管理有限公司 Performance test methods, device, computer equipment and storage medium
CN110083524A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Upload data test method, apparatus, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100056230A1 (en) * 2008-09-03 2010-03-04 Futurewei Technologies, Inc. Optimization of Power Conservation with Respect to Application Requirements
CN106803799A (en) * 2015-11-26 2017-06-06 阿里巴巴集团控股有限公司 A kind of performance test methods and device
CN107526678A (en) * 2016-06-22 2017-12-29 平安科技(深圳)有限公司 The method of testing and device of web application
CN108415847A (en) * 2018-05-08 2018-08-17 平安普惠企业管理有限公司 Performance test methods, device, computer equipment and storage medium
CN110083524A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Upload data test method, apparatus, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JSTL网络标签与SSH类参考手册: "卜炟", 《JSTL网络标签与SSH类参考手册》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111931080A (en) * 2020-07-24 2020-11-13 上海泛微网络科技股份有限公司 Method, system and storage medium for automatically displaying time in multiple time zones
CN112311811A (en) * 2020-11-16 2021-02-02 深圳市欢太科技有限公司 Full link tracking method, device, storage medium and server
CN112311811B (en) * 2020-11-16 2022-10-18 深圳市欢太科技有限公司 Full link tracking method, device, storage medium and server
CN112559271A (en) * 2020-12-24 2021-03-26 北京百度网讯科技有限公司 Method, device, equipment and storage medium for monitoring interface performance of distributed application
CN112559271B (en) * 2020-12-24 2023-10-20 北京百度网讯科技有限公司 Interface performance monitoring method, device and equipment for distributed application and storage medium
CN112839096A (en) * 2021-01-14 2021-05-25 平安国际智慧城市科技股份有限公司 Method and device for monitoring function execution duration, computer equipment and storage medium
CN112839096B (en) * 2021-01-14 2022-07-22 深圳赛安特技术服务有限公司 Method and device for monitoring function execution duration, computer equipment and storage medium
CN113316125A (en) * 2021-06-28 2021-08-27 广州小鹏汽车科技有限公司 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium
CN113316125B (en) * 2021-06-28 2022-08-16 广州小鹏汽车科技有限公司 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium

Similar Documents

Publication Publication Date Title
CN110808877A (en) Statistical analysis method and device based on interface response duration and computer equipment
EP3355187A1 (en) Loading method and device for terminal application (app)
CN107679081B (en) Information modification method and device, computer equipment and computer readable storage medium
CN107547759B (en) Quality inspection method and device for customer service staff call
CN110830577B (en) Service request call tracking method and device, computer equipment and storage medium
CN108848280B (en) Call processing method, device, storage medium and service equipment
CN105607986A (en) Acquisition method and device of user behavior log data
CN111045921A (en) Automatic interface testing method and device, computer equipment and storage medium
WO2018103402A1 (en) Wireless fidelity (wifi) scan method and related product
CN110442502B (en) Point burying method, device, equipment and storage medium
EP3828696A1 (en) Method invoke chain tracing method, electronic apparatus, and computer-readable storage medium
CN111679968A (en) Interface calling abnormity detection method and device, computer equipment and storage medium
CN110955390A (en) Data processing method and device and electronic equipment
CN112650614A (en) Call chain monitoring method and device, electronic equipment and storage medium
WO2017206244A1 (en) Method and device for accepting call
CN108418730B (en) Network flow testing method, device, equipment and computer readable storage medium
CN112241362A (en) Test method, test device, server and storage medium
CN112530074A (en) Queuing and calling reminding method, device, equipment and storage medium
WO2019062087A1 (en) Attendance check data testing method, terminal and device, and computer readable storage medium
CN115202946A (en) Automated testing method, apparatus, device, storage medium, and program product
CN112231290A (en) Method, device and equipment for processing local log and storage medium
CN110727537A (en) Method and device for uniformly processing response message, computer equipment and storage medium
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body
CN116560879B (en) Method and device for calling face recognition service, terminal equipment and storage medium
CN112749073B (en) Service testing method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200218