CN113225228B - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN113225228B
CN113225228B CN202110480414.9A CN202110480414A CN113225228B CN 113225228 B CN113225228 B CN 113225228B CN 202110480414 A CN202110480414 A CN 202110480414A CN 113225228 B CN113225228 B CN 113225228B
Authority
CN
China
Prior art keywords
statistical information
interface
target
qps
determining
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.)
Active
Application number
CN202110480414.9A
Other languages
Chinese (zh)
Other versions
CN113225228A (en
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110480414.9A priority Critical patent/CN113225228B/en
Publication of CN113225228A publication Critical patent/CN113225228A/en
Application granted granted Critical
Publication of CN113225228B publication Critical patent/CN113225228B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • H04L43/045Processing captured monitoring data, e.g. for logfile generation for graphical visualisation of monitoring data

Abstract

The disclosure discloses a data processing method and device, relates to the field of artificial intelligence in computer technology, and can be applied to cloud computing or cloud service scenes. The specific implementation scheme is as follows: receiving statistical information corresponding to at least one interface respectively sent by each second device in the device cluster, wherein the statistical information comprises an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time. And determining QPS information of the device cluster according to the statistical information corresponding to the at least one interface. By receiving the statistical information of each interface sent by each second device in the cluster, the QPS information of the cluster can be effectively determined according to the respective statistical information of each interface, and meanwhile, the respective statistical information of each interface is updated by each second device in real time according to the time when the request message is received, so that the QPS of the on-line cluster can be accurately and effectively monitored.

Description

Data processing method and device
Technical Field
The present disclosure relates to the field of artificial intelligence in computer technologies, and in particular, to a data processing method and apparatus.
Background
The distributed architecture is a mainstream architecture of the information system at present, and can provide distributed services based on the distributed architecture, and the unit for providing the services externally by the distributed services is an interface.
The request Per Second (Query Per Second, QPS) is an important performance index of the interface, can reflect the instantaneous concurrent flow of the interface, and is widely applied to numerous scenarios such as daily monitoring, capacity evaluation, pressure measurement and the like. In the related art, when monitoring the QPS, generally, a page view (pv) in a period of time is divided by a second of the period of time, and the QPS is roughly estimated using the result.
However, the above-described manner of determining the QPS only enables a rough estimation of the QPS, resulting in a lower accuracy of the determined QPS.
Disclosure of Invention
The disclosure provides a data processing method and device.
According to a first aspect of the present disclosure, there is provided a data processing method, the method comprising:
receiving statistical information corresponding to at least one interface respectively sent by each second device in a device cluster, wherein the statistical information comprises an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time; the device cluster comprises at least one second device, and the second device is used for providing services through at least one interface;
and determining QPS information of the device cluster according to the statistical information corresponding to at least one interface.
According to a second aspect of the present disclosure, there is provided a data processing method, the method comprising:
determining an interface and a receiving time corresponding to each request message in at least one request message, wherein the at least one request message is received through each interface within a preset time period, the preset time period comprises n monitoring times, and n is an integer greater than or equal to 1;
determining statistical information corresponding to at least one interface according to the interface corresponding to each request message and the receiving time, wherein the statistical information comprises the identification of the interface, at least one monitoring time corresponding to the interface and the quantity of the request messages received by the interface at each monitoring time;
and sending each piece of statistical information to a first device, wherein the statistical information is used for the first device to determine QPS information of the device cluster.
According to a third aspect of the present disclosure, there is provided a data processing apparatus, the apparatus comprising:
a receiving module, configured to receive statistical information corresponding to at least one interface respectively sent by each second device in a device cluster, where the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time; the device cluster comprises at least one second device, and the second device is used for providing services through at least one interface;
a determining module, configured to determine QPS information of the device cluster according to respective statistical information corresponding to at least one of the interfaces.
According to a fourth aspect of the present disclosure, there is provided a data processing apparatus, the apparatus comprising:
a request message determining module, configured to determine an interface and a receiving time corresponding to each request message in at least one request message, where the at least one request message is received through each interface within a preset time period, the preset time period includes n monitoring times, and n is an integer greater than or equal to 1;
a statistical information determining module, configured to determine, according to an interface and a receiving time corresponding to each request message, statistical information corresponding to at least one interface, where the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time;
a sending unit, configured to send each piece of statistical information to a first device, where the statistical information is used by the first device to determine QPS information of the device cluster.
According to a fifth aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first or second aspect.
According to a sixth aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of the first or second aspect.
According to a seventh aspect of the present disclosure, there is provided a computer program product comprising: a computer program, stored in a readable storage medium, from which at least one processor of an electronic device can read the computer program, execution of the computer program by the at least one processor causing the electronic device to perform the method of the first or second aspect.
According to the technology disclosed by the invention, the monitoring of the QPS of the on-line cluster can be accurately and effectively realized.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a system diagram of a data processing method according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a data processing method provided by an embodiment of the present disclosure;
fig. 3 is a second flowchart of a data processing method provided in the embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating an implementation of a statistical array according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram illustrating an implementation of determining first target statistical information according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram illustrating an implementation of grouping first target statistics provided by an embodiment of the present disclosure;
FIG. 7 is a schematic diagram illustrating an implementation of determining a set of corresponding total request record arrays according to an embodiment of the present disclosure;
FIG. 8 is a schematic diagram illustrating an implementation of determining a peak value QPS according to an embodiment of the present disclosure;
FIG. 9 is a schematic diagram illustrating an implementation of a peak QPS curve provided by an embodiment of the present disclosure;
fig. 10 is a flow chart three of a data processing method provided in the embodiment of the present disclosure;
fig. 11 is a fourth flowchart of a data processing method provided by the embodiment of the present disclosure;
fig. 12 is a schematic diagram illustrating an implementation of determining second target statistical information according to an embodiment of the present disclosure;
FIG. 13 is a schematic diagram illustrating an implementation of updating a target element in a statistical array according to an embodiment of the present disclosure;
fig. 14 is a processing diagram of a data processing method according to an embodiment of the disclosure;
FIG. 15 is a schematic flow chart illustrating determination of a peak QPS curve according to an embodiment of the present disclosure;
FIG. 16 is a first block diagram of a data processing apparatus according to an embodiment of the disclosure;
FIG. 17 is a second block diagram of a data processing apparatus according to an embodiment of the disclosure;
fig. 18 is a block diagram of an electronic device for implementing a data processing method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of embodiments of the present disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In order to better understand the technical solution of the present disclosure, the related art related to the present disclosure is further described below.
The distributed architecture is the mainstream architecture of the information system at present, and the unit for providing services externally by the distributed services is an interface. QPS is an important performance index of an interface, means the number of times of requests generated by the interface every second, can reflect the instantaneous concurrent flow of the interface, and is widely applied to numerous scenes such as daily monitoring, capacity evaluation, pressure measurement and the like.
Currently, several possible implementations exist in the related art for detecting QPS:
one possible implementation is to use the amount of page views over a period of time divided by the number of seconds over the period of time to use the result to roughly estimate the QPS. However, the accuracy of such a roughly estimated QPS is low.
Another possible implementation is to use a meter isometer testing tool to record the QPS during the testing phase. However, such an implementation is limited to the pressure measurement phase and cannot be used for online services
Another possible implementation is to compute the single-machine QPS by shell scripts, traversing the machine request log. However, such an implementation can only compute a single QPS, and cannot determine a clustered QPS.
Another possible implementation is to count QPS at the gateway level. However, such an implementation necessitates the use of a specific gateway product that supports QPS functionality and does not allow monitoring of inter-service calls that do not pass through the gateway
Therefore, in the related art, there is a problem of low accuracy when monitoring the QPS, and an easy-to-use monitoring scheme for the online cluster QPS is absent for the distributed system, which may affect operation and maintenance of the distributed system and troubleshooting of problems.
Aiming at the problems in the prior art, the technical concept is as follows: the method comprises the steps that each second device in a cluster monitors a request received by each interface in real time, the QPS corresponding to each interface is updated in real time according to the receiving time of the request, and then the second devices report the QPS of the corresponding interface to the first device, so that the first device monitors QPS information of the cluster according to the QPS of each interface of each second device, and monitoring of the QPS of the on-line cluster can be achieved accurately and effectively.
On the basis of the above, the following describes the data processing method provided by the present disclosure with reference to a specific embodiment, and first describes a system to which the data processing method of the present disclosure is applied with reference to fig. 1, where fig. 1 is a system schematic diagram of the data processing method provided by the embodiment of the present disclosure.
As shown in fig. 1, the data processing method provided by the embodiment of the present disclosure may be applied to a distributed system of a distributed system architecture, where one distributed system may include several distributed services, see fig. 1, for example, distributed service 1, distributed service 2, and the like may be included in the distributed system, for example, for one e-commerce system, distributed order service, distributed search service, and the like may be included.
Meanwhile, one distributed service is composed of several instances, where an instance is a basic unit for running a program, and in one possible implementation, an instance may be understood as a server in a cluster server, that is, one distributed service may be composed of several servers, and a second device in the present disclosure may be a server in a cluster server, for example, for the distributed service 1 in fig. 1, it may be composed of the second device 101, the second device 102, the second device 103, the second device 104, and so on in fig. 1, and is used to provide a specific service for the distributed service 1.
And an interface is a unit of distributed service level interaction, that is, one interface is served by several instances.
For example, referring to fig. 1, it is assumed that there are currently an interface 1A and an interface 1B for a distributed service 1, where the interface 1A may be served by a second device 101, a second device 102, a second device 103, and a second device 104, and similarly, the interface 1B may be served by the second device 101, the second device 102, the second device 103, and the second device 104.
Here, the specific meaning of providing the service is that, assuming that there is a request for the interface 1A at present, the request can be processed by any one of the second device 101, the second device 102, the second device 103, and the second device 104.
The interface, the second device in the distributed service 2 is implemented similarly. Based on the present description, it may be determined that the second device in this embodiment may provide services for at least one interface of each corresponding distributed service, where specific implementation of each distributed service and the number and type of interfaces of each second device that provide services may all be selected according to actual requirements, and this embodiment is not limited to this.
In this embodiment, the QPS of the interfaces in the distributed system needs to be determined, then each second device may acquire QPS data of the corresponding interface in real time, and then each second device uploads the acquired QPS data of the interface to the first device, and the first device analyzes all uploaded QPS data, so as to aggregate QPS data of the interfaces at the distributed service level, and thus, monitoring of the on-line cluster QPS is effectively achieved.
Based on the above description of fig. 1, the following describes in detail the data processing method provided by the present disclosure in combination with details, based on the above, it can be determined that the data processing method provided by the present disclosure has a part of operations on the first device side and the second device side, where the first device side may determine QPS information of a cluster according to data sent by each second device, and the second device side may collect the number of requests of each interface, and the following describes the operations on the first device side and the second device side, respectively.
The data processing method provided by the disclosure can be used in a cloud computing or cloud service scenario.
First, an operation of a first device side is described with reference to fig. 2, where the first device in this embodiment is configured to determine QPS information of a device cluster, and the device cluster may include at least one second device, and the second device is configured to provide a service through at least one interface, and more specific implementation may refer to the description of the foregoing embodiment, and is not described here again.
Fig. 2 is a flowchart of a data processing method provided in an embodiment of the present disclosure, and as shown in fig. 2, the method includes:
s201, receiving statistical information corresponding to at least one interface respectively sent by each second device in the device cluster, wherein the statistical information comprises an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time.
In this embodiment, the first device may receive statistical information corresponding to at least one interface sent by each second device in the device cluster, where the device cluster includes at least one second device, the second device is configured to provide a service through the at least one interface, and each second device sends the statistical information of the corresponding interface.
For example, the second device 20 and the second device 30 are currently included in the device cluster, the second device 30 corresponds to the interface 1 and the interface 2, and the second device corresponds to the interface 3, the first device may receive the statistical information of the interface 1 and the statistical information of the interface 2 sent by the second device 20, and the first device may receive the statistical information of the interface 3 sent by the second device 30.
In a possible implementation manner, the statistical information may include an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time.
The description is given by taking any interface as an example, the implementation manners of the interfaces are the same, and it is assumed that, for interface 1 at present, in the statistical information of interface 1, the identifier of the interface is used to perform unique indication on interface 1, which indicates that the current statistical information is the statistical information of interface 1, where the identifier of the interface may be, for example, an interface name, or an identifier string, and the like.
In this embodiment, the number of requests of the interface of each second device at each time needs to be determined, so that the statistical information further includes at least one monitoring time corresponding to the interface and the number of request messages received by the interface at each monitoring time.
Since QPS in this embodiment is the number of requests per second, in a possible implementation, a time unit of one monitoring time may be 1 second, for example, and the statistical information may include the number of request messages received by the interface in each second.
In one possible implementation, the statistical information stores the number of request messages received by the interface at each monitoring time, for example, as follows.
Monitoring time of day Number of request messages received
8:30:01 12
8:30:02 23
8:30:03 13
The number of request messages received by the interface at each monitoring time can be determined according to the table, and the described statistical information can be stored in a table manner, or can be stored in a key-value pair manner, for example.
In another possible implementation manner, a preset time period may also be set in the embodiment, the preset time period includes multiple monitoring times, a statistical array is set for each preset time period, and each element in the statistical array represents the number of request messages received at each monitoring time in the preset time period.
The specific implementation manner of the statistical information is not limited in this embodiment, as long as the statistical information may include an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time, and the specific implementation manner may be selected according to actual requirements.
S202, determining QPS information of the device cluster according to the statistical information corresponding to the at least one interface.
After receiving the statistical information corresponding to each interface, the QPS information of the device cluster may be determined according to the statistical information corresponding to each interface.
In a possible implementation manner, the QPS information may be, for example, a peak QPS of a certain interface in a certain period, or a peak QPS of a certain device in a certain period, or may also be a curve of the peak QPS, and the like.
For example, in addition to the peak QPS, an average QPS, etc. may be determined, in short, the number of request messages received by each interface of each second device in the device cluster at each monitoring time has been determined currently, and based on the data, any QPS information may be determined according to specific requirements, which is not limited herein.
The data processing method provided by the embodiment of the disclosure comprises the following steps: receiving statistical information corresponding to at least one interface respectively sent by each second device in the device cluster, wherein the statistical information comprises an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time. And determining QPS information of the device cluster according to the statistical information corresponding to the at least one interface. By receiving the statistical information of each interface sent by each second device in the cluster, the QPS information of the cluster can be effectively determined according to the respective statistical information of each interface, and meanwhile, the respective statistical information of each interface is updated by each second device in real time according to the time when the request message is received, so that the QPS of the on-line cluster can be accurately and effectively monitored.
On the basis of the foregoing embodiment, the data processing method provided by the present disclosure is further described in detail with reference to fig. 3 to fig. 9, fig. 3 is a second flowchart of the data processing method provided by the embodiment of the present disclosure, fig. 4 is an implementation schematic diagram of a statistical array provided by the embodiment of the present disclosure, fig. 5 is an implementation schematic diagram of determining first target statistical information provided by the embodiment of the present disclosure, fig. 6 is an implementation schematic diagram of grouping the first target statistical information provided by the embodiment of the present disclosure, fig. 7 is an implementation schematic diagram of determining a group of corresponding total request record arrays provided by the embodiment of the present disclosure, fig. 8 is an implementation schematic diagram of determining a peak value QPS provided by the embodiment of the present disclosure, and fig. 9 is an implementation schematic diagram of a peak value QPS curve provided by the embodiment of the present disclosure.
As shown in fig. 3, the method includes:
s301, receiving statistical information corresponding to at least one interface respectively sent by each second device in the device cluster, wherein the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time.
The implementation manner of S301 is similar to the implementation manner of S201, and details of the same parts are not repeated here, and on the basis of the foregoing, the statistical information in this embodiment may further include a start time of a preset time period, a device identifier of the second device corresponding to the interface, and a service identifier of a service provided by the second device.
Based on the introduction, it may be determined that the number of request messages received by the interface at each monitoring time may be stored in a statistical array, for example, the embodiment introduces an implementation manner of the statistical information by taking the case that the number of request messages is stored in the array.
For example, for interface a, the statistical information may include the following: the identifier of the interface a, the statistical array, the starting time of the preset time period, the device identifier of the second device corresponding to the interface a, and the service identifier of the service provided by the second device corresponding to the interface a.
At least one monitoring time corresponding to the interface and the number of request messages received by the interface at each monitoring time can be determined according to the statistical array and the starting time of the preset time period.
For example, in one possible implementation, the preset time period may include n monitoring times, the statistical information may include a statistical array, the statistical array includes n elements, and an ith element in the statistical array represents the number of request messages received by the interface at an ith monitoring time of the preset time period.
As can be understood by reference to fig. 4, for example, if the preset time period includes 60 monitoring times, and one monitoring time may be 1 second, then one preset time period is one minute, and if the starting time of the current preset time period is 8.
And referring to fig. 4, for example, the statistical array at the current time is q, each element in the statistical array represents the number of request messages at each monitoring time in the preset time period, for example, q [0] represents the number of request messages at the first monitoring time in the preset time period, more specifically, the number of request messages at 8.
Fig. 4 is an example of a preset time period being 1 minute, and a time unit of a monitoring time included in the preset time period being 1 second, where in an actual implementation process, a length of the preset time period and a length of a time unit corresponding to the monitoring time may be selected according to an actual requirement, for example, the length of the preset time period may also be 2 minutes, 5 minutes, 10 minutes, and the like, and this embodiment does not limit this.
Therefore, the number of the request messages received by the interface at each monitoring time can be simply and effectively determined based on the starting time of the preset time period and the statistic array.
S302, determining a query time interval and a query identifier, wherein the query identifier comprises at least one of the following: the system comprises a query interface identifier, a query device identifier and a query service identifier.
In this embodiment, after receiving the statistical information corresponding to each of the at least one interface sent by each of the second devices, the first device may determine QPS information of the device cluster according to the statistical information corresponding to each of the interfaces.
In a possible implementation manner, because each second device in the cluster continuously sends the statistics of each interface for each preset period to the first device, the time span of the statistics received by the first device is relatively long, and usually when determining the QPS information of the cluster, QPS information within a period of time is required, so that a query period can be determined, where the query period is a period in which the QPS information of the cluster needs to be determined, where the query period may include, for example, a query start time and a query end time.
And the first device may receive statistical information of each interface of each first device in the cluster, and may need to query the QPS information of the cluster corresponding to some specific identifier when determining the QPS information of the cluster.
Therefore, in this embodiment, a query identifier may also be determined, and in a possible implementation manner, the query identifier includes at least one of the following: the system comprises a query interface identifier, a query device identifier and a query service identifier.
For example, if QPS information of a service population in the cluster needs to be determined currently, the query identifier may include, for example, a query service identifier; for another example, QPS information of a certain interface of a certain service currently needed to be determined in the cluster, the query identifier may include, for example, a query service identifier and a query interface identifier; for another example, if it is currently necessary to determine the QPS information of a certain first device in the cluster as a whole, the query identifier may include, for example, a query device identifier; for another example, QPS information of a certain interface of a certain first device currently needs to be determined in the cluster, the query identifier may include, for example, a query device identifier and a query interface identifier.
In an actual implementation process, a specific implementation manner of the query identifier may be selected according to an actual requirement, which specifically depends on a specific implementation of the cluster QPS information that needs to be queried currently, and this embodiment does not particularly limit this.
S303, determining at least one first target statistical information in each statistical information according to the query time interval and the query identifier, wherein the starting time of the preset time interval of the first target statistical information is in the query time interval, and the first target statistical information meets at least one of the following conditions: the interface identification of the first target statistical information is equal to the query interface identification, the equipment identification of the first target statistical information is equal to the query equipment identification, and the service identification of the first target statistical information is equal to the query service identification.
After determining the query time interval and the query information, at least one first target statistical information may be determined from the statistical information received by the first device, where the first target statistical information is the statistical information satisfying the query time interval and the query identifier described above.
In one possible implementation, the starting time of the preset period of the first target statistic is within the query period, say, the starting time of the query period is from 7.
And then determining statistical information that the corresponding identification meets the identification in the statistical information of the time condition obtained by meeting the time condition.
Specifically, the first target statistical information satisfies at least one of the following conditions: the interface identification of the first target statistical information is equal to the query interface identification, the equipment identification of the first target statistical information is equal to the query equipment identification, and the service identification of the first target statistical information is equal to the query service identification.
The specific condition satisfied by the first target statistical information depends on the type of the cluster QPS information to be specifically determined at present.
For example, it is QPS information of a certain service population in the cluster that needs to be queried currently, the condition that the first target statistic information satisfies may be: the service identification of the first target statistical information is equal to the query service identification.
For another example, if the QPS information of a certain interface of a certain service in the cluster needs to be queried currently, the condition satisfied by the first target statistical information may be: the service identification of the first target statistic is equal to the query service identification, and the interface identification of the first target statistic is equal to the query interface identification.
For another example, what needs to be queried currently is QPS information of a certain first device population in the cluster, then the condition satisfied by the first target statistical information may be: the device identification of the first target statistical information is equal to the querying device identification.
For another example, what needs to be queried currently is QPS information of a certain interface of a certain first device in the cluster, then the condition that is met by the first target statistical information may be: the device identification of the first target statistics is equal to the query device identification, and the interface identification of the first target statistics is equal to the query interface identification.
In an actual implementation process, what condition the first target statistical information specifically needs to satisfy may depend on what QPS information in the cluster needs to be queried currently, and a corresponding identifier of the first target statistical information is only the same as the query identifier.
The above described process of determining the first target statistical information may be understood, for example, in a specific example, in conjunction with fig. 5.
As shown in fig. 5, assuming that statistical information 1 to statistical information x currently exist, for example, the statistical information of the starting time of the preset time period pair in the query time period may be determined first as the statistical information of the preliminary screening.
And then, according to the specific scene, determining the first target statistical information according to the corresponding query identifier.
For example, QPS information of the service 1 population in the cluster needs to be queried currently, it may be determined that the service identifier is equal to the statistical information of the identifier of the service 1 in the preliminarily filtered statistical information, so as to determine the first target statistical information of the service 1 population.
For another example, QPS information of interface a of service 1 in the cluster needs to be queried currently, then, in the first target statistical information of the service 1 population, statistical information that the interface identifier is equal to the identifier of interface a may be determined, so as to determine the first target statistical information of interface a of service 1.
For another example, if QPS information of the first device 50 population in the cluster needs to be queried currently, then statistical information that the device identifier is equal to the identifier of the first device 50 may be determined in the preliminarily filtered statistical information, so as to determine first target statistical information of the first device 50 population.
For another example, if the QPS information of the interface a of the first device 50 in the cluster needs to be queried currently, it may be determined that the interface identifier is equal to the statistical information of the identifier of the interface a in the first target statistical information of the first device 50 population, so as to determine the first target statistical information of the interface a of the first device 50.
In the implementation described in fig. 5, the statistical information meeting the query duration is determined first, and then the statistical information meeting the query identifier is determined, so as to obtain the first target statistical information, in another possible implementation, for example, the statistical information meeting the query identifier may be determined first, and then the statistical information meeting the query duration is determined second, this embodiment does not limit the execution order, as long as the determined first target statistical information is the statistical information meeting the query duration and the query identifier.
S304, determining QPS information according to the at least one first target statistical information.
After determining the at least one first target statistic, QPS information can be determined based on the at least one first target statistic.
In a possible implementation manner, the QPS information may be, for example, a peak QPS in the at least one first target statistic, where the implementation manner for determining the peak QPS may be, for example:
and determining the first target statistical information with the same starting time of a preset time interval as one group in the at least one first target statistical information to obtain a plurality of groups.
It can be understood that, if the starting times of the preset time periods of some first target statistical information are the same, it indicates that the first target statistical information is within the same preset time period, and the number of request messages included in the first target statistical information is the sum of the number of request messages of the corresponding determined cluster at each monitoring time, so that the first target statistical information with the same starting time period can be determined as a group, thereby obtaining a plurality of groups.
For example, as can be understood with reference to fig. 6, referring to fig. 6, assuming that the currently determined at least one first target statistic includes first target statistic 1 to first target statistic t, the currently determined at least one first target statistic having the same starting time of the preset time period is determined as a group, for example, the grouping result shown in fig. 6 may be obtained.
For example, if the starting time of the preset time period of the first target statistical information 1 and the starting time of the first target statistical information 2 are both 8; and for example, the starting times of the preset time periods of the first target statistical information 3, the first target statistical information 4 and the first target statistical information 5 are all 8.
It can be understood that the first target statistical information and the grouping manner thereof described in fig. 6 are only exemplary descriptions, and in an actual implementation process, the specific quantity and the grouping manner of the first target statistical information may be selected according to actual requirements, as long as it is ensured that the first target statistical information with the same starting time of the preset time period is determined as a group.
Next, the statistical arrays of the first target statistical information in each group may be added item by item to obtain a total request record array corresponding to each group.
Based on the grouping manner of the group determined by the first target statistical information with the same starting time of the preset time period, it can be determined that each element of the statistical array of each first target statistical information in the same group is corresponding in time.
For example, if the starting time of the preset time interval of the first target statistic 1 and the first target statistic 2 is the same, the element q [0] in the statistic array of the first target statistic 1 represents the request number of one second of 8.
Therefore, in this embodiment, the statistical arrays of the first target statistical information in the group may be added item by item to obtain the total request record array corresponding to each group, where the total request record array includes the sum of the request numbers at each monitoring time in the current preset time period.
For example, as can be understood in conjunction with fig. 7, assuming that the example of fig. 6 is continued to be followed, where the first target statistic 1 and the first target statistic 2 are determined to be group a, the statistic array of the first target statistic 1 and the statistic array of the target statistic 2 may be added item by item, so as to obtain the total request record array s corresponding to group a, and assuming that the starting time of the preset time period corresponding to group a is 8.
Fig. 7 is an introduction taking one group as an example, in a specific implementation process, implementation manners of each group are similar, and the same operation is performed on each group, so that a total request record array corresponding to each group of each group can be obtained.
It should be noted that, the number of request messages, which is recorded in the current total request record array and is specifically which aspect of the cluster, is determined according to what query identifier when determining the first target statistical information, for example, the first target statistical information determined currently is determined according to the query interface identifier, and then the first target statistical information determined currently corresponds to the statistical information of the whole of a certain service, so that each element in the current total request record array can be determined, which indicates a certain service whole, the number of request messages in each monitoring time is similar, and the implementation manners of other scenarios are similar, and are not described herein again.
Then, the maximum request number corresponding to each group may be determined in the total request record array corresponding to each group.
And determining the maximum value in the maximum request number corresponding to each group as the peak value QPS.
Specifically, after the total request record arrays corresponding to the groups are obtained, the total request record arrays of the preset time periods included in the query time period are determined at present, and the number of the request messages corresponding to the monitoring times in the query time period can be determined according to the total request record arrays of the preset time periods.
Therefore, when determining the peak QPS, the maximum value may be determined in each total request record array, so as to determine the maximum request number corresponding to each group, and then the maximum value may be determined in the maximum request number corresponding to each group, so as to obtain the peak QPS.
For example, as can be understood in conjunction with fig. 8, assuming that the maximum request number 79 is currently determined in the total request record array s corresponding to the group a, the maximum request number 77 is determined in the total request record array s corresponding to the group B, and the maximum request number 79 is determined in the total request record array s corresponding to the group C, this is equivalent to determining the respective maximum request numbers in the respective preset periods in the query period, and then determining the maximum value in the maximum request numbers corresponding to the respective preset periods, so that the maximum value of the request numbers at the respective monitoring times in the query period can be determined, and thus the peak QPS in the query period can be determined, for example, the peak QPS 79 shown in fig. 8.
In another possible implementation, the QPS information may also be a peak QPS curve in the query period.
The implementation manner of determining the peak QPS curve may be to divide the query time interval into at least one sub-time interval according to a preset time interval.
Say that the query period is 8.
Then, the peak value QPS corresponding to each sub-period is determined.
The implementation manner of determining the peak value QPS corresponding to each sub-period is the same as the implementation manner of determining the peak value QPS described above, and is not described herein again.
And then, determining a peak value QPS curve according to the peak values QPS corresponding to the respective time intervals.
Specifically, after determining the peak QPS corresponding to each subinterval, the peak QPS of each subinterval may be connected to obtain a peak QPS curve, for example, as can be understood in conjunction with fig. 9.
As shown in fig. 9, for example, currently according to a time interval of 10 minutes, divide query period 8 from 00 to 30 into 6 sub-periods, where, for example, the peak value QPS corresponding to sub-period 8.
The specific type of the determined QPS information is not limited in this embodiment, and may be selected according to actual requirements, and all information related to the QPS of the cluster determined according to the statistical information corresponding to each second device may be used as the QPS information in this embodiment, which is not particularly limited in this embodiment.
According to the data processing method provided by the embodiment of the disclosure, the statistical information of the cluster can be effectively determined by receiving the statistical information respectively sent by each second device, and the corresponding first target statistical information is determined in each statistical information according to the query time interval and the query identifier, so that the statistical information of the specified type in the specified time interval can be queried according to the actual requirement, and then the QPS information of the cluster is determined according to the first target statistical information, so that the determination of the QPS information of the cluster can be accurately realized, and the query time interval and the query identifier are selected according to the actual requirement, so that the determination of the required QPS information of the cluster can be effectively realized.
Based on the foregoing embodiment, what is described above is that the first device in the background processes the statistical information of each second device in the cluster to determine the implementation manner of the QPS information of the cluster, and the following describes, with reference to a specific embodiment, an implementation manner of determining the statistical information on the second device side.
It should be noted that the currently introduced implementation manner of the second device side may be applied to any one second device in a device cluster, where the second device is configured to provide a service through at least one interface, and the implementation manners of the second devices are the same, and the following description will be given, by taking any one second device as an example, of an implementation manner of determining statistical information by the second device.
Fig. 10 is a flowchart of a data processing method provided in the embodiment of the present disclosure.
As shown in fig. 10, the method includes:
s1001, determining an interface and a receiving time corresponding to each request message in at least one request message, wherein the at least one request message is received through each interface in a preset time period, the preset time period comprises n monitoring times, and n is an integer greater than or equal to 1.
In this embodiment, the second device may receive the request message, and in a possible implementation manner, in order to facilitate statistics of the request message received by the second device, the request message received by the second device may be counted in units of a preset time period, where the preset time period may include n monitoring times, and implementation manners of the monitoring times and the preset time period are similar to those described in the foregoing embodiment, and are not described again here.
And, the request message in this embodiment is received by the second device through the interface of the service provided by the second device, that is, the request message is for the interface, so the request message in this embodiment is received by the second device through each interface within a preset time period.
The second device of this embodiment may receive at least one request message within a preset time period, where each request message corresponds to an interface and a receiving time, where the interface corresponding to the request message is used to indicate which interface the request message currently requests, for example, if the interface corresponding to the request message 1 is interface a, it indicates that the request message currently requests for interface a; and the receiving time of the request message refers to the time when the second device receives the request message.
In an actual implementation process, the number of request messages received by the second device in a preset time period, and the interface and the request time corresponding to each request message may be selected according to an actual requirement, which is not particularly limited in this embodiment.
S1002, determining statistical information corresponding to at least one interface according to the interface corresponding to each request message and the receiving time, wherein the statistical information comprises the identification of the interface, at least one monitoring time corresponding to the interface and the number of the request messages received by the interface at each monitoring time.
For each request message, the statistical information corresponding to at least one interface can be updated according to the interface corresponding to the request message and the receiving time, so as to determine the statistical information corresponding to each interface.
The statistical information corresponding to the interface comprises an identifier of the interface and is used for indicating which interface the current statistical information is; and the statistical information corresponding to the interface also comprises at least one monitoring moment corresponding to the interface and the quantity of the request messages received by the interface at each monitoring moment, and is used for indicating the quantity of the request messages received by the interface at each monitoring moment.
In a possible implementation manner, for example, when a request message is received, the statistical information of the interface corresponding to the request message may be updated according to the currently received request message, for example, the current request message is a request message for interface a, and the receiving time of the request message is 8. According to each request message received in the preset time period, the operation is carried out in real time, and therefore the statistical information corresponding to at least one interface can be determined when the preset time period is finished.
In another possible implementation manner, for example, after the current preset time period ends, the statistical information of each corresponding interface may be sequentially updated according to each request message received within the preset time period and according to the interface and the receiving time corresponding to each request message, so as to obtain the statistical information corresponding to each of the at least one interface, and the implementation manner of the update is similar to that described above, and is not described here again.
In a specific implementation process, the statistical information corresponding to at least one interface is determined in a real-time updating manner, or the statistical information corresponding to at least one interface is determined in a manner updated together after a preset time period is ended, which may be selected according to actual requirements, and this embodiment is not particularly limited.
It should be noted that at least one interface for which the statistical information is currently determined is an interface for which a request message is received in the preset time period, for example, an interface a, an interface B, and an interface C currently exist, and in the current preset time period, assuming that a request message exists for the interface a and the interface B and a request message does not exist for the interface C, the finally determined statistical information includes the statistical information of the interface a and the statistical information of the interface B.
S1003, sending each piece of statistical information to the first device, wherein the statistical information is used for the first device to determine QPS information of the device cluster.
After determining the statistical information corresponding to each of the at least one interface, each piece of statistical information may be sent to the first device, so that the first device may determine QPS information of the device cluster according to the statistical information sent by each first device.
It should be noted that, what is described above is the implementation process in a preset period, the second device will continuously determine the statistical information in each preset period, for example, the duration corresponding to the preset period is 1 minute, and assuming that the current preset period is 8.
The data processing method provided by the embodiment of the disclosure comprises the following steps: determining an interface and a receiving moment corresponding to each request message in at least one request message, wherein the at least one request message is received through each interface in a preset time period, the preset time period comprises n monitoring moments, and n is an integer greater than or equal to 1. And determining statistical information corresponding to at least one interface according to the interface corresponding to each request message and the receiving time, wherein the statistical information comprises the identification of the interface, at least one monitoring time corresponding to the interface and the number of the request messages received by the interface at each monitoring time. And sending each statistical information to the first device, wherein the statistical information is used for the first device to determine QPS information of the device cluster. The method comprises the steps that statistical information corresponding to at least one interface is determined by first equipment in a preset time period according to received at least one request message, wherein the statistical information can indicate the number of the request messages received by the interface at each monitoring moment, the statistical information corresponding to the interface can be accurately and effectively determined based on the request messages, and then the statistical information is sent to the first equipment, so that the first equipment can accurately determine QPS information of a cluster according to the statistical information sent by each second equipment.
On the basis of the foregoing embodiment, a detailed description is further given below of an implementation manner of determining statistical information by the second device, fig. 11 is a fourth flowchart of the data processing method provided by the embodiment of the present disclosure, fig. 12 is an implementation schematic diagram of determining second target statistical information provided by the embodiment of the present disclosure, and fig. 13 is an implementation schematic diagram of updating a target element in a statistical array provided by the embodiment of the present disclosure.
As shown in fig. 11, the method includes:
s1101, determining an interface and a receiving time corresponding to each request message in at least one request message, wherein the at least one request message is received through each interface in a preset time period, the preset time period comprises n monitoring times, and n is an integer greater than or equal to 1.
The implementation manner of S1101 is similar to that of S1001, and is not described herein again.
And S1102, after the request message is received, determining second target statistical information according to an interface corresponding to the request message.
In this embodiment, after the second device receives the request message, the second target statistical information may be first determined according to the interface corresponding to the request message, where an identifier of the interface in the second target statistical information is the same as an identifier of the interface corresponding to the request message.
In a possible implementation manner, a first identifier of an interface corresponding to the request message may be first obtained, and then, the corresponding second target statistical information may be determined according to the first identifier.
The second target statistical information may be first searched for in a first set stored in the second device, and specifically, the first set is stored in the second device, and is used to store the statistical information corresponding to each interface.
For example, as can be understood in conjunction with fig. 12, it is assumed that a first set currently exists, and the first set may include statistical information of at least one interface, for example, currently includes statistical information 1 corresponding to interface a and statistical information 2 corresponding to interface 2.
In this embodiment, when a request message for an interface is received, statistical information corresponding to the interface may be created, and then when a request message for the interface is received again, the statistical information may be directly applied.
Second target statistical information with the same identifier as the first identifier of the interface may be first searched in a first set stored in the second device, and if it is determined that the second target statistical information exists in the first set, the second target statistical information may be obtained from the first set.
For example, it may be understood with reference to fig. 12 that, assuming that the current request message is a request message for interface a, it may be determined that the first identifier of the interface corresponding to the request message is interface a, and then the statistical information corresponding to interface a is searched in the first set, because the first set includes the statistical information 1 corresponding to interface a, the statistical information 1 corresponding to interface a may be obtained from the first set, so as to obtain the second target statistical information.
Or, if it is determined that the second target statistical information does not exist in the first set, the second target statistical information corresponding to the interface may be created according to the interface corresponding to the request message.
Specifically, if the second target statistical information does not exist in the first set, it indicates that the current second device receives the request message for the interface for the first time, and the second target statistical information corresponding to the interface may be created according to the current request message.
For example, as can be understood in conjunction with fig. 12, assuming that the current request message is a request message for interface C, it may be determined that the first identifier of the interface corresponding to the request message is interface C, and then statistical information corresponding to interface C is searched in the first set, because the statistical information corresponding to interface C is not included in the first set, the statistical information corresponding to interface C may be created, and the statistical information corresponding to the created interface C is determined as the second target statistical information, and after the second target statistical information is determined, for example, the created statistical information may be stored in the first set, so that the request message may be directly obtained from the first set next time a request for interface C is received. For example, referring to fig. 12, after the statistics 3 corresponding to the interface C are created, the statistics 3 are stored in the first set.
In a possible implementation manner, the statistical information may include, for example, an identifier of the interface, a start time of a preset time period, and a statistical array, where the statistical array includes n elements, an ith element in the statistical array represents the number of request messages received by the interface at an ith monitoring time of the preset time period, n is an integer greater than or equal to 1, and i is an integer greater than or equal to 1 and less than or equal to n, and a more detailed implementation manner of the statistical information may refer to the description of the foregoing embodiment, and is not described herein again.
Therefore, in a possible implementation manner, when creating the second target statistical information according to the interface corresponding to the request message, the method may include:
and determining the first identifier of the interface corresponding to the request message as the identifier of the interface of the second target statistical information.
Because the first identifier of the interface corresponding to the current request message indicates the interface that needs to be requested currently, and it is determined that the statistical information of the interface does not exist, the statistical information needs to be created for the interface currently, and therefore the first identifier may be determined as the identifier of the interface of the second target statistical information.
And determining the nearest target time before the current time, and determining the target time as the starting time of the preset time interval of the second target statistical information, wherein the target time is an integer time or an integer time.
In this embodiment, to facilitate statistics of correspondence between elements in the array, all the first devices in the cluster adopt a synchronous preset time period, and to facilitate management, start times of the preset time period in this embodiment are all integer times or integer times, for example, 7 o 'clock, 8 o' clock, or 3 o 'clock at 7 o' clock, 4 o 'clock at 7 o' clock, and so on.
Therefore, when initializing the second target statistic information, the nearest target time before the current time may be determined as the starting time of the preset time period of the second target statistic information.
For example, the current time at which the second target statistic needs to be created is 8. Therefore, in the embodiment, when the starting time of the preset time period is determined, the adjacent hour or the whole hour before the current time is determined as the starting time of the preset time period.
And creating a statistical array of the second target statistical information according to the number of the monitoring moments included in the preset time period, wherein the number of elements included in the statistical array and the number of the monitoring moments included in the preset time period are initialized to a second preset value.
In this embodiment, initialization of the statistical array is further required, and in this embodiment, the number n of elements in the statistical array is equal to the number n of monitoring times included in the preset time period, so that the statistical array of the second target statistical information may be created according to the number of monitoring times included in the preset time period, and each element in the statistical array is initialized to a second preset value. In one possible implementation, the second preset value may be 0, for example.
For example, if the preset time period is 1 minute, the number of monitoring times included in the preset time period is 60, and one second corresponds to one monitoring time, a statistical array including 60 elements may be created, where each element in the array is used to indicate the number of request messages received at each monitoring time.
In an actual implementation process, a specific implementation manner for obtaining the second target statistical information may be determined according to actual requirements, which depends on whether the statistical information corresponding to the request message exists in the first set at present, and if the statistical information exists, the statistical information is directly obtained, and if the statistical information does not exist, the statistical information is created.
In this embodiment, when a request message for an interface is received, the statistical information corresponding to the interface is created in real time, so that the statistical information can be created according to actual requirements, and waste of system resources caused by creating statistical information for all interfaces is avoided.
S1103, determining a difference value S between the receiving time of the request message and the starting time of the preset time period.
After the second target statistical information of the interface corresponding to the current request message is determined, a difference s between the receiving time of the request message and the starting time of the preset time period may be determined, and it may be understood that the difference s may indicate that the receiving time of the request message corresponds to the several monitoring times in the current preset time period, so that the elements of the statistical array of the corresponding monitoring positions may be updated.
And S1104, determining the S-th element in the statistical array of the second target statistical information as the target element.
And S1105, adding a first preset value to the current target element to obtain an updated target element.
S1104 and S1105 are introduced together as follows:
the difference s in this embodiment may indicate that the receiving time of the request message currently corresponds to the several monitoring times in the preset time period, and the statistical array in the second target statistical information is used to record the number of the request messages corresponding to each monitoring time, so that the s-th element in the statistical array of the second target statistical information may be determined as the target element, where the target element is the time at which the number of the request messages needs to be recorded.
In a possible implementation manner, a first preset value may be added to the current target element to obtain an updated target element, where the first preset value may be, for example, 1, that is, 1 is added to the target element, which indicates that the number of request messages received at the current monitoring time is increased by 1; or, the first preset value may also be implemented in other values, which is not limited in this embodiment, and when the first preset value is the other values, corresponding processing may be performed subsequently.
With reference to fig. 13, the above described procedure is described, as shown in fig. 13, assuming that the starting time of the current preset period is 8.
And S1106, judging whether the current time is the end time of the preset time period, if so, executing S1107, and if not, executing S1102.
It should be noted that, in this embodiment, when the starting time of the preset time period starts, the above-described operation of determining the second target statistical information according to the interface corresponding to the request message is performed, and updating the second target statistical information according to the receiving time of the request message is performed until the preset time period ends.
Therefore, after the above operations are performed, it can be determined whether the current time is the end time of the preset time period, and if not, it indicates that the current preset time period has not ended yet, and the above operations need to be performed continuously, so the operations are performed from S1102 above repeatedly.
When determining whether the current time is the end time of the preset time period, in a possible implementation manner, the current time may be compared with the end time of the preset time period, so as to determine whether the current time is the end time of the preset time period.
Or, the currently determined difference s may be compared with the number n of monitoring times included in the preset time period, and if s is greater than or equal to n, it indicates that the time at which the request message is currently received has exceeded the preset time period or reached the end time of the preset time period, so that it may be determined that the current time is the end time of the preset time period; if s is smaller than n, it indicates that the current time when the request message is received is still within the preset time period, so that it can be determined that the current time is not the end time of the preset time period.
In an actual implementation process, a specific determination manner may be selected according to an actual requirement, and this embodiment does not particularly limit this.
S1107, send each statistical information to the first device, where the statistical information is used by the first device to determine QPS information of the device cluster.
In another possible implementation manner, if it is determined that the current time is the end time of the preset time period, it may be determined that the preset time period is ended, and therefore, each piece of statistical information determined in the preset time period may be sent to the first device, so that the first device may determine the QPS information of the device cluster according to the statistical information, and a more specific implementation manner may refer to the description of S1003, which is not described herein again
The data processing method provided by the embodiment of the disclosure comprises the following steps: determining an interface and a receiving moment corresponding to each request message in at least one request message, wherein the at least one request message is received through each interface in a preset time period, the preset time period comprises n monitoring moments, and n is an integer greater than or equal to 1. And after receiving the request message, determining second target statistical information according to the interface corresponding to the request message. A difference s between the reception time of the request message and the start time of the preset period is determined. And determining the s-th element in the statistical array of the second target statistical information as the target element. And adding a first preset numerical value to the current target element to obtain an updated target element. And judging whether the current time is the ending time of the preset time period, if so, sending each statistical information to the first device, wherein the statistical information is used for the first device to determine QPS information of the device cluster. Determining second target statistical information through an interface corresponding to the request message, wherein the first set comprises the second target statistical information which can be directly obtained, and the second target statistical information is created when the first set does not comprise the second target statistical information, so that the statistical information corresponding to an interface can be created in real time when the interface is received, and the waste of system resources caused by the fact that the statistical information is created for all the interfaces is avoided; meanwhile, in this embodiment, the s-th element in the array is updated according to the difference s between the receiving time of the request message and the starting time of the preset time period, so that the recording of the number of the request messages corresponding to each interface can be simply and orderly realized.
Based on the above embodiments, the following describes, with reference to fig. 14 and fig. 15, a system for performing an operation of a first device and an operation of a second device in the present disclosure, where fig. 14 is a processing schematic diagram of a data processing method provided by an embodiment of the present disclosure, and fig. 15 is a flowchart of determining a peak QPS curve provided by an embodiment of the present disclosure.
As shown in fig. 14, the data processing method in this embodiment is divided into two phases, one is an acquisition phase executed on the second device side, and the other is an analysis phase executed on the first device side, where statistical information of each interface on each second device may be acquired in the acquisition phase and then uploaded to the first device in the background. In the analysis stage, all the transmitted statistical information can be analyzed in the background, and the QPS information of the interfaces of the clusters of the distributed service level is aggregated.
The following two phases are introduced separately:
first, an acquisition phase is introduced, and based on the above description, it may be determined that, in the acquisition phase, received requests of each interface need to be stored in the form of statistical information, where the statistical information may be described by using a vector, for example, and therefore, in a possible implementation, a vector data structure of the statistical information of the interfaces may be described by using, for example, the following pseudo code:
struct qps_vec{
string method_name;
int qps[N];
long start_timestamp;
};
the method _ name represents an interface name, which may be a character string corresponding to the identifier of the introduced interface.
qps is a statistical array, where each element represents the number of request messages of one second, where N represents the length of the qps array, and needs to be equal to the number of monitoring instants included in the preset time period. In this embodiment, assuming that a monitoring time is 1 second, qps [0] represents the number of requests for the first second in the preset time period, qps [1] represents the number of requests for the second in the preset time period, and so on.
The start _ timestamp is a starting time of a preset period, which may be accurate to a second, and one preset period may include N seconds. In this embodiment, for example, the start _ timestamp may be a time that all the second devices can start synchronously, for example, the time may be a whole minute, a whole hour, and the like, so as to perform corresponding processing on the statistical arrays in each preset time period in the following step, and the specific implementation manner may refer to the above description.
In each second device, a set of qps _ vec types, denoted vec _ set, is maintained, which may correspond to the first interface described in the above embodiments.
For each interface in the second device, a vector vec (i.e. statistical information) may exist with a qps vec structure stored in the first set vec _ set, where vec. Start _ timestamp can be initialized to the nearest whole time or minute time before the current time, to the nearest second.
This vector vec representing statistical information may be actually created after the actual request of the interface.
Specifically, when each request occurs, the request message may be intercepted in some way (common methods such as collecting a request log, java Agent bytecode enhancement technology, infrastructure layer hook, etc.). For example, each intercepted request message may have the following structure:
struct req_info{
string method_name;
long timestamp;
};
where method _ name represents the interface name where the request occurred and timestamp represents the time of receipt of the request message, accurate to seconds.
First target statistics qps vec with an interface name method _ name matching the interface name in the request message req _ info may then be looked up in the first set vec _ set, the target statistics are determined directly if present, and if not a new first target statistics qps vec is created according to the procedure described above. That is, when the first target statistical information corresponding to the requested interface exists in the first set, the first target statistical information is directly obtained; and when the first set does not have the first target statistical information corresponding to the requested interface, creating the statistical information corresponding to the currently requested interface.
Then, a difference s of the reception time req _ info of the request message and the start time start _ timestamp of the preset period of the target statistical information qps _ vec, where the difference s is accurate to an integer second, may be calculated, and then qps _ vec.
For example, when N =60, the statistical array QPS in the statistical information QPS _ vec of a certain interface within a preset period should be presented as QPS [0] = QPS0, QPS [1] = QPS 1.. QPS [ N-1] = qpsN-1 where QPS < N > is the interface QPS of the nth second.
When a preset period ends (N seconds are reached), the statistical information qps _ vec in the period may be removed from the first set vec _ set, and a new preset period starts, and at the same time, the structure of the statistical information qps _ vec may be converted into the following structure and sent to the first device:
struct instance_qps_vec{
string instance_id;
string app_name;
string method_name;
int qps[N];
long start_timestamp;
};
wherein, instance _ id is the identifier of the second device, app _ name is the identifier name of the distributed service to which the second device belongs, and other fields have the same meaning as in qps _ vec. That is to say, the statistical information of this embodiment may further include, in addition to the interface name, the statistical array, and the start time of the preset time period described above, an identifier of the second device corresponding to the interface and an identifier of the service corresponding to the second device.
It can be understood that, in the above description, which is given by taking any one of the second devices as an example, each of the second devices may perform the above operation, and therefore, as shown in fig. 14, each of the second devices may upload the corresponding statistical information to the first device in the background.
On the basis of the above described acquisition phase, the following describes the analysis phase performed by the first device in the background.
After receiving the statistical information sent by each second device, the first device in the background may select a storage medium, such as SQL, noSQL, newSQL, or the like, to store the statistical information, so as to obtain corresponding statistical information from the storage medium subsequently, thereby determining QPS information of the cluster.
In the analysis stage, QPS information of the cluster may be determined according to an actual QPS requirement, for example, the QPS requirement may include at least one of the following:
calculating a peak value QPS of a certain service population;
calculating a peak value QPS of a certain interface to be served;
calculating a peak value QPS of a certain second equipment totality;
calculating a peak value QPS of an interface on certain second equipment;
calculating a QPS curve;
based on the above description of the analysis stage, it may be determined that each second device may upload the complete statistical information instance _ qps _ vec to the first device in the background, and the item in the first device storing the statistical information instance _ qps _ vec uploaded by each second device is currently referred to as vec _ tbl.
In one possible implementation, when the QPS information is the peak QPS, the peak QPS in a period of time may be calculated according to the following procedure, for example:
1. determining a query period, wherein start _ ts is a starting time of the query period, and end _ ts is an ending time of the query period, and determining a query identifier, wherein the query identifier may include at least one of the following: the interface name to be queried, the second device identification instance _ id to be queried, and the service identification app _ name to be queried.
2. All statistical information of the start time start _ timestamp between start _ ts and end _ ts of the preset time period is screened out from the vec _ tbl. And further screening according to the query conditions described in the following scenes:
a) Calculate the peak QPS for a certain service ensemble: app _ name is equal to the service identification to be queried;
b) Calculating peak value QPS of certain interface to be served: app _ name is equal to the service identifier to be queried and method _ name is equal to the interface identifier to be queried;
c) Calculating a peak value QPS of a certain second device population: instance _ id is equal to the identity of the second device to query;
d) Calculating a peak value QPS of an interface on a second device: instance _ id equals the identity of the second device to be queried and method _ name equals the interface name to be queried.
That is, among the respective statistical information, second target statistical information satisfying the query identification and the query period is determined.
3. Grouping the determined second target statistical information instance _ qps _ vec according to the start time start _ timestamp of the preset time period, storing the second target statistical information with the same start _ timestamp into a group, so as to obtain a plurality of groups, and adding all the second target statistical information of each group item by item according to each item of the statistical array therein to obtain a total request record array, which may be represented as a group _ qps _ sum array, for example, where:
group _ qps _ sum [ N ] = sum (instance _ qps _ vec.qps [ N ]), where N =0.. N-1
4. Calculating the maximum one of the group _ qps _ sum groups of the total request record array in each group as the maximum request number group _ qps _ max, i.e. group _ qps _ max = max (group _ qps _ sum [0.. N-1 ])
5. The maximum value of the maximum request number group _ qps _ max in each group is obtained and is recorded as maximum value qps _ max, that is, qps _ max = max (group _ qps _ max).
6. The maximum value QPS _ max is the query period from start _ ts to end _ ts, and the corresponding peak value QPS in the cluster, specifically which type of peak value QPS, depends on the query identifier.
What has been described above is an implementation in which the QPS information is a peak QPS, and in another possible implementation, the QPS information may also be, for example, a peak QPS curve.
Specifically, the query time interval may be divided into at least one sub-time interval according to a preset time interval, a peak QPS corresponding to each sub-time interval is determined, and a peak QPS curve is determined according to the peak QPS corresponding to each time interval.
For example, the process of determining the QPS curve can be understood in conjunction with fig. 15, as shown in fig. 15, the start time start _ ts and the end time end _ ts of the query period can be determined, and the preset time interval can be determined for the subsequent division of the sub-period.
Then, the process may be started from the start time, the current time cur _ ts is initialized to the start time start _ ts, and then an array line [ P ] is created, where the array line [ P ] is used to record the peak value QPS of each time point, and P is the number of time points, that is, the number of sub-periods described above.
And the flag i of the loop may be initialized to 0, indicating that processing is performed from the first element line [0] in the array, and then it may be determined whether the current time point is less than the end time point, which is performed as the loop condition for end.
In a possible implementation manner, if the current time point cur _ ts is smaller than the end time end _ ts, it may be determined that the subsequent process needs to be continuously executed until the end of the query period is reached.
Specifically, a peak value QPS between sub-periods cur _ ts to cur _ ts + interval at the current time point may be calculated, that is QPS, and an implementation manner of determining the peak value QPS is similar to that described above, and is not described herein again.
Then, the currently determined peak QPS is determined as an element in the line array, specifically, line [ i ] = QPS is set, and i = i +1 is recorded, so that the next processing is performed.
Then, the time point obtained by adding the preset time interval (cur _ ts + interval) to the current time point is determined as a new current time point cur _ ts, and then whether the current time point is smaller than the end time or not is judged.
If the current time point is determined to be smaller than the end time, the operation is repeatedly executed; if the current time point is not smaller than the end time, a line array can be determined, wherein array elements in the line array represent peak values QPS corresponding to the sub-periods, and a QPS curve can be obtained according to the array elements in the line array.
It should be noted that, in the present embodiment, the number n of elements in the statistical array may be selected according to actual requirements, and it can be understood that the larger n is, the smaller the number of statistical information is, but the larger the data size of a single statistical information is; correspondingly, the smaller n is, the larger the number of the statistical information is, but the smaller the data amount of the single statistical information is, and in the actual implementation process, the setting of n may be selected according to actual requirements, for example, n may be adjusted according to the actual situation of the storage medium of the first device in the background.
To sum up, the data processing method provided by the embodiment of the present disclosure includes an acquisition phase at the second device side and an analysis phase at the first device side, and the implementation process is applicable to an online service, and can calculate a QPS of a cluster, and update a statistical array in real time according to a request message in each preset period, so that accuracy of determined QPS information can be ensured.
Fig. 16 is a first schematic structural diagram of a data processing apparatus according to an embodiment of the present disclosure. As shown in fig. 16, the data processing apparatus 1600 of the present embodiment may include: a receiving module 1601, a determining module 1602.
The data processing apparatus 1600 provided in this embodiment is applied to a first device, where the first device is configured to determine QPS information of requests per second of a device cluster, where the device cluster includes at least one second device, and the second device is configured to provide a service through at least one interface, and the data processing apparatus 1600 includes:
a receiving module 1601, configured to receive statistical information corresponding to at least one interface respectively sent by each second device in a device cluster, where the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time;
a determining module 1602, configured to determine QPS information of the device cluster according to the statistical information corresponding to each of the at least one interface.
In a possible implementation manner, the statistical information further includes a start time of a preset time period, a device identifier of a second device corresponding to an interface, and a service identifier of a service provided by the second device;
the determining module 1602 includes:
a first determining unit, configured to determine a query time period and a query identifier, where the query identifier includes at least one of: inquiring an interface identifier, an inquiring equipment identifier and an inquiring service identifier;
a second determining unit, configured to determine, according to the query time period and the query identifier, at least one first target statistical information in each piece of statistical information, where a starting time of a preset time period of the first target statistical information is within the query time period, and the first target statistical information satisfies at least one of the following conditions: the interface identifier of the first target statistical information is equal to the query interface identifier, the device identifier of the first target statistical information is equal to the query device identifier, and the service identifier of the first target statistical information is equal to the query service identifier;
a third determining unit, configured to determine the QPS information according to the at least one first target statistic.
In a possible implementation manner, the preset time period includes n monitoring times, the statistical information includes a statistical array, the statistical array includes n elements, an ith element in the statistical array represents the number of request messages received by an interface at the ith monitoring time of the preset time period, n is an integer greater than or equal to 1, and i is an integer greater than or equal to 1 and less than or equal to n;
the QPS information comprises a peak QPS;
the third determining unit is specifically configured to:
determining first target statistical information with the same starting time of a preset time interval as one group in the at least one first target statistical information to obtain a plurality of groups;
adding the statistical arrays of the first target statistical information in each group item by item to obtain a total request record array corresponding to each group;
respectively determining the maximum request number corresponding to each group in the total request record arrays corresponding to each group;
and determining the maximum value in the maximum request numbers corresponding to the groups as the peak value QPS.
In a possible implementation, the QPS information includes a peak QPS curve;
the third determining unit is specifically configured to:
dividing the query time interval into at least one sub-time interval according to a preset time interval;
determining a peak value QPS corresponding to each sub-period;
and determining the peak value QPS curve according to the peak value QPS corresponding to each self-time period.
Fig. 17 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present disclosure. As shown in fig. 17, the data processing apparatus 1700 of the present embodiment may include: a request message determining module 1701, a statistic information determining module 1702 and a sending module 1703.
The data processing apparatus 1700 provided in this embodiment is applied to any one of second devices in a device cluster, where the second device is configured to provide a service through at least one interface, and the data processing apparatus 1700 includes:
a request message determining module 1701, configured to determine an interface and a receiving time corresponding to each request message in at least one request message, where the at least one request message is received through each interface within a preset time period, the preset time period includes n monitoring times, and n is an integer greater than or equal to 1;
a statistical information determining module 1702, configured to determine, according to an interface and a receiving time corresponding to each request message, statistical information corresponding to at least one interface, where the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time;
a sending module 1703, configured to send each piece of statistical information to a first device, where the statistical information is used by the first device to determine QPS information of the device cluster.
In a possible implementation manner, the request message determining module 1701 includes:
an execution unit configured to execute a statistical operation, the statistical operation including: after receiving a request message, determining second target statistical information according to an interface corresponding to the request message, and updating the second target statistical information according to the receiving time of the request message;
and repeating the statistical operation from the starting time of the preset time interval to the ending time of the preset time interval.
In a possible implementation manner, the statistical information includes a statistical array, where the statistical array includes n elements, an ith element in the statistical array represents the number of request messages received by the interface at an ith monitoring time of the preset time period, where n is an integer greater than or equal to 1, and i is an integer greater than or equal to 1 and less than or equal to n;
the execution unit includes:
a determining subunit, configured to determine, according to the receiving time of the request message and the starting time of the preset time period, a target element in the statistical array of the second target statistical information;
and the updating subunit is used for updating the target element.
In a possible implementation manner, the determining subunit is specifically configured to:
determining a difference s between the receiving time of the request message and the starting time of the preset time interval;
and determining the s-th element in the statistical array of the second target statistical information as the target element.
In a possible implementation manner, the update subunit is specifically configured to:
and adding the current target element to a first preset numerical value to obtain an updated target element.
In one possible implementation manner, the execution unit includes:
an obtaining subunit, configured to obtain a first identifier of an interface corresponding to the request message;
a searching subunit, configured to search the second target statistical information in a stored first set, where an identifier of an interface of the second target statistical information is the same as the first identifier, and the first set is used to store statistical information corresponding to each interface;
the obtaining subunit is further configured to obtain, if the second target statistical information exists in the first set, the second target statistical information from the first set; alternatively, the first and second electrodes may be,
and a creating subunit, configured to create, if the second target statistical information does not exist in the first set, the second target statistical information according to an interface corresponding to the request message.
In a possible implementation manner, the statistical information further includes a start time of the preset time period;
the creating subunit is specifically configured to:
determining a first identifier of an interface corresponding to the request message as an identifier of an interface of the second target statistical information; and the number of the first and second groups,
determining the nearest target time before the current time, and determining the target time as the starting time of a preset time period of the second target statistical information, wherein the target time is an integer time or an integer time; and the number of the first and second groups,
and creating a statistical array of the second target statistical information according to the number of the monitoring moments included in the preset time period, wherein the number of elements included in the statistical array and the number of the monitoring moments included in the preset time period are initialized to a second preset value.
The present disclosure provides a data processing method and device, which are applied to the field of artificial intelligence in computer technology, and can be applied to a cloud computing or cloud service scenario, so as to achieve the technical effect of accurately and effectively implementing monitoring of a QPS of an online cluster.
The present disclosure also provides an electronic device and a readable storage medium according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, the present disclosure also provides a computer program product comprising: a computer program, stored in a readable storage medium, from which at least one processor of the electronic device can read the computer program, the at least one processor executing the computer program causing the electronic device to perform the solution provided by any of the embodiments described above.
Fig. 18 illustrates a schematic block diagram of an example electronic device 1800 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 18, the electronic device 1800 includes a computing unit 1801, which may perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM) 1802 or a computer program loaded from the storage unit 1808 into a Random Access Memory (RAM) 1803. In the RAM 1803, various programs and data required for operation of the device 1800 may also be stored. The computing unit 1801, ROM 1802, and RAM 1803 are connected to each other by a bus 1804. An input/output (I/O) interface 1805 is also connected to bus 1804.
Various components in device 1800 connect to I/O interface 1805, including: an input unit 1806 such as a keyboard, a mouse, and the like; an output unit 1807 such as various types of displays, speakers, and the like; a storage unit 1808 such as a magnetic disk, an optical disk, or the like; and a communication unit 1809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 1809 allows the device 1800 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks.
Computing unit 1801 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 1801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 1801 executes the respective methods and processes described above, such as the method data processing method. For example, in some embodiments, the method data processing method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 1808. In some embodiments, part or all of a computer program can be loaded and/or installed onto the device 1800 via the ROM 1802 and/or the communication unit 1809. When the computer program is loaded into RAM 1803 and executed by computing unit 1801, one or more steps of the method data processing method described above may be performed. Alternatively, in other embodiments, the computing unit 1801 may be configured to perform the method data processing method in any other suitable manner (e.g., by way of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (20)

1. A method of data processing, the method comprising:
receiving statistical information corresponding to at least one interface respectively sent by each second device in a device cluster, wherein the statistical information comprises an identifier of the interface, at least one monitoring time corresponding to the interface, and the number of request messages received by the interface at each monitoring time; the device cluster comprises at least one second device, and the second device is used for providing services through at least one interface;
determining QPS information of the request number per second of the equipment cluster according to the statistical information corresponding to at least one interface; the statistical information comprises n elements, the ith element represents the number of request messages received by an interface at the ith monitoring time of a preset time period corresponding to the statistical information, and the preset time period comprises n monitoring times; n is an integer of 1 or more, and i is an integer of 1 or more and n or less;
the statistical information comprises a statistical array, and the QPS information comprises a peak value QPS and a peak value QPS curve; the determining the QPS information according to at least one first target statistic comprises:
determining first target statistical information with the same starting time of a preset time period as a group in the at least one first target statistical information to obtain a plurality of groups;
adding the statistical arrays of the first target statistical information in each group item by item to obtain a total request record array corresponding to each group;
respectively determining the maximum request number corresponding to each group in the total request record arrays corresponding to each group;
determining the maximum value of the maximum request numbers corresponding to the groups as the peak value QPS;
dividing the query time interval into at least one sub-time interval according to a preset time interval;
determining a peak value QPS corresponding to each sub-period;
determining the peak value QPS curve according to the peak value QPS corresponding to each sub-period;
wherein the at least one first target statistical information is determined in each statistical information according to the query time interval and the query identifier; the starting time of the preset time interval of the first target statistical information is within the query time interval.
2. The method of claim 1, wherein the statistical information further includes a start time of a preset time period, a device identifier of a second device corresponding to an interface, and a service identifier of a service provided by the second device; the method further comprises the following steps:
determining a query period and a query identifier, wherein the query identifier comprises at least one of the following: the first target statistical information of the query interface identifier, the query device identifier and the query service identifier meets at least one of the following conditions: the interface identifier of the first target statistical information is equal to the query interface identifier, the device identifier of the first target statistical information is equal to the query device identifier, and the service identifier of the first target statistical information is equal to the query service identifier.
3. A method of data processing, the method comprising:
determining an interface and a receiving moment corresponding to each request message in at least one request message, wherein the at least one request message is received through each interface within a preset time period, the preset time period comprises n monitoring moments, and n is an integer greater than or equal to 1;
determining statistical information corresponding to at least one interface according to the interface corresponding to each request message and the receiving time, wherein the statistical information comprises the identification of the interface, at least one monitoring time corresponding to the interface and the quantity of the request messages received by the interface at each monitoring time;
sending each piece of statistical information to first equipment, wherein the statistical information is used for the first equipment to determine QPS information of the equipment cluster; the statistical information comprises n elements, the ith element represents the number of request messages received by an interface at the ith monitoring time of a preset time period corresponding to the statistical information, and the preset time period comprises n monitoring times; n is an integer of 1 or more, and i is an integer of 1 or more and n or less;
the QPS information comprises a peak QPS and a peak QPS curve; the statistical information comprises a statistical array; the determining, by the first device, QPS information of the device cluster specifically includes:
the first device determines first target statistical information with the same starting time of a preset time period as a group in the at least one first target statistical information to obtain a plurality of groups;
adding the statistical arrays of the first target statistical information in each group item by item to obtain a total request record array corresponding to each group;
respectively determining the maximum request number corresponding to each group in the total request record arrays corresponding to each group;
determining the maximum value of the maximum request numbers corresponding to the groups as the peak value QPS;
dividing the query time interval into at least one sub-time interval according to a preset time interval;
determining a peak value QPS corresponding to each sub-period;
determining the peak value QPS curve according to the peak value QPS corresponding to each sub-period;
wherein the at least one first target statistical information is determined in each statistical information according to the query time interval and the query identifier; the starting time of the preset time interval of the first target statistical information is within the query time interval.
4. The method according to claim 3, wherein the determining, according to the interface and the receiving time corresponding to each request message, the respective statistical information corresponding to at least one of the interfaces includes:
performing a statistical operation, the statistical operation comprising: after receiving a request message, determining second target statistical information according to an interface corresponding to the request message, and updating the second target statistical information according to the receiving time of the request message;
and repeating the statistical operation from the starting time of the preset time period to the ending time of the preset time period.
5. The method of claim 4, wherein the statistical information comprises a statistical array comprising the n elements; the updating the second target statistical information according to the receiving time of the request message includes:
determining a target element in the statistical array of the second target statistical information according to the receiving time of the request message and the starting time of the preset time period;
and updating the target element.
6. The method of claim 5, wherein the determining a target element in the statistical array of the second target statistical information according to the receiving time of the request message and the starting time of the preset time period comprises:
determining a difference s between the receiving time of the request message and the starting time of the preset time interval;
and determining the s-th element in the statistical array of the second target statistical information as the target element.
7. The method of claim 5, wherein the updating the target element comprises:
and adding the current target element to a first preset numerical value to obtain an updated target element.
8. The method according to any one of claims 4-7, wherein the determining second target statistical information according to the interface corresponding to the request message includes:
acquiring a first identifier of an interface corresponding to the request message;
searching the second target statistical information in a stored first set, wherein the identifier of the interface of the second target statistical information is the same as the first identifier, and the first set is used for storing the statistical information corresponding to each interface;
if the second target statistical information exists in the first set, acquiring the second target statistical information from the first set; alternatively, the first and second electrodes may be,
and if the second target statistical information does not exist in the first set, creating the second target statistical information according to an interface corresponding to the request message.
9. The method of claim 8, wherein the statistical information further includes a start time of the preset period;
the creating the second target statistical information according to the interface corresponding to the request message includes:
determining a first identifier of an interface corresponding to the request message as an identifier of an interface of the second target statistical information; and the number of the first and second groups,
determining the nearest target time before the current time, and determining the target time as the starting time of a preset time period of the second target statistical information, wherein the target time is an integer time or an integer time; and (c) a second step of,
and creating a statistical array of the second target statistical information according to the number of the monitoring moments included in the preset time period, wherein the number of elements included in the statistical array and the number of the monitoring moments included in the preset time period are initialized to a second preset value.
10. A data processing apparatus, the apparatus comprising:
a receiving module, configured to receive statistical information that corresponds to at least one interface and is sent by each second device in a device cluster, where the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time; the device cluster comprises at least one second device, and the second device is used for providing services through at least one interface;
a determining module, configured to determine QPS information of the device cluster according to respective corresponding statistical information of at least one interface; the statistical information comprises n elements, the ith element represents the number of request messages received by an interface at the ith monitoring time of a preset time period corresponding to the statistical information, and the preset time period comprises n monitoring times; n is an integer of 1 or more, i is an integer of 1 or more and n or less;
the statistical information comprises a statistical array, and the statistical array comprises the n elements;
the QPS information comprises a peak value QPS and a peak value QPS curve;
the third determining unit is specifically configured to:
determining first target statistical information with the same starting time of a preset time period as a group in the at least one first target statistical information to obtain a plurality of groups;
adding the statistical arrays of the first target statistical information in each group item by item to obtain a total request record array corresponding to each group;
respectively determining the maximum request number corresponding to each group in the total request record arrays corresponding to each group;
determining the maximum value of the maximum request numbers corresponding to the groups as the peak value QPS;
dividing the query time interval into at least one sub-time interval according to a preset time interval;
determining a peak value QPS corresponding to each sub-period;
determining the peak value QPS curve according to the peak value QPS corresponding to each sub-period;
wherein the at least one first target statistical information is determined in each statistical information according to the query time interval and the query identifier; the starting time of the preset time interval of the first target statistical information is within the query time interval.
11. The apparatus of claim 10, wherein the statistical information further includes a start time of a preset time period, a device identifier of a second device corresponding to an interface, and a service identifier of a service provided by the second device;
the determining module comprises:
a first determining unit, configured to determine a query period and a query identifier, where the query identifier includes at least one of: inquiring an interface identifier, an inquiring equipment identifier and an inquiring service identifier;
the first target statistical information satisfies at least one of the following conditions: the interface identifier of the first target statistical information is equal to the query interface identifier, the device identifier of the first target statistical information is equal to the query device identifier, and the service identifier of the first target statistical information is equal to the query service identifier.
12. A data processing apparatus, the apparatus comprising:
a request message determining module, configured to determine an interface and a receiving time corresponding to each request message in at least one request message, where the at least one request message is received through each interface within a preset time period, the preset time period includes n monitoring times, and n is an integer greater than or equal to 1;
a statistical information determining module, configured to determine, according to an interface and a receiving time corresponding to each request message, statistical information corresponding to at least one interface, where the statistical information includes an identifier of the interface, at least one monitoring time corresponding to the interface, and a number of request messages received by the interface at each monitoring time;
a sending module, configured to send each piece of statistical information to a first device, where the statistical information is used by the first device to determine QPS information of a device cluster; the statistical information comprises n elements, the ith element represents the number of request messages received by an interface at the ith monitoring time of a preset time period corresponding to the statistical information, and the preset time period comprises n monitoring times; n is an integer of 1 or more, and i is an integer of 1 or more and n or less;
the QPS information comprises a peak QPS and a peak QPS curve; the statistical information comprises a statistical array; the determining, by the first device, QPS information of the device cluster specifically includes:
the first device determines first target statistical information with the same starting time of a preset time period as one group in the at least one first target statistical information to obtain a plurality of groups;
adding the statistical arrays of the first target statistical information in each group item by item to obtain a total request record array corresponding to each group;
respectively determining the maximum request number corresponding to each group in the total request record arrays corresponding to each group;
determining the maximum value of the maximum request numbers corresponding to the groups as the peak value QPS;
dividing the query time interval into at least one sub-time interval according to a preset time interval;
determining a peak value QPS corresponding to each sub-period;
determining the peak value QPS curve according to the peak value QPS corresponding to each sub-period;
wherein the at least one first target statistic is determined in each statistic according to the query time period and a query identifier; the starting time of the preset time interval of the first target statistical information is within the query time interval.
13. The apparatus of claim 12, wherein the request message determination module comprises:
an execution unit configured to execute a statistical operation, the statistical operation including: after receiving a request message, determining second target statistical information according to an interface corresponding to the request message, and updating the second target statistical information according to the receiving time of the request message;
and repeating the statistical operation from the starting time of the preset time period to the ending time of the preset time period.
14. The apparatus of claim 13, wherein the statistical information comprises a statistical array comprising the n elements;
the execution unit includes:
a determining subunit, configured to determine, according to the receiving time of the request message and the starting time of the preset time period, a target element in the statistical array of the second target statistical information;
and the updating subunit is used for updating the target element.
15. The apparatus according to claim 14, wherein the determining subunit is specifically configured to:
determining a difference value s between the receiving time of the request message and the starting time of the preset time interval;
and determining the s-th element in the statistical array of the second target statistical information as the target element.
16. The apparatus according to claim 14, wherein the update subunit is specifically configured to:
and adding a first preset numerical value to the current target element to obtain an updated target element.
17. The apparatus according to any one of claims 13-16, wherein the execution unit comprises:
an obtaining subunit, configured to obtain a first identifier of an interface corresponding to the request message;
a searching subunit, configured to search the second target statistical information in a stored first set, where an identifier of an interface of the second target statistical information is the same as the first identifier, and the first set is used to store statistical information corresponding to each interface;
the obtaining subunit is further configured to obtain, if the second target statistical information exists in the first set, the second target statistical information from the first set; alternatively, the first and second electrodes may be,
and a creating subunit, configured to create, if the second target statistical information does not exist in the first set, the second target statistical information according to an interface corresponding to the request message.
18. The apparatus of claim 17, wherein the statistical information further comprises a start time of the preset time period;
the creating subunit is specifically configured to:
determining a first identifier of an interface corresponding to the request message as an identifier of an interface of the second target statistical information; and the number of the first and second groups,
determining the nearest target time before the current time, and determining the target time as the starting time of a preset time period of the second target statistical information, wherein the target time is an integer time or an integer time; and (c) a second step of,
and creating a statistical array of the second target statistical information according to the number of the monitoring moments included in the preset time period, wherein the number of the elements included in the statistical array and the number of the monitoring moments included in the preset time period initialize the elements of the statistical array to a second preset value.
19. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-2 or claims 3-9.
20. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any of claims 1-2 or claims 3-9.
CN202110480414.9A 2021-04-30 2021-04-30 Data processing method and device Active CN113225228B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110480414.9A CN113225228B (en) 2021-04-30 2021-04-30 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110480414.9A CN113225228B (en) 2021-04-30 2021-04-30 Data processing method and device

Publications (2)

Publication Number Publication Date
CN113225228A CN113225228A (en) 2021-08-06
CN113225228B true CN113225228B (en) 2022-10-21

Family

ID=77090371

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110480414.9A Active CN113225228B (en) 2021-04-30 2021-04-30 Data processing method and device

Country Status (1)

Country Link
CN (1) CN113225228B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106470163A (en) * 2015-08-17 2017-03-01 腾讯科技(北京)有限公司 A kind of information processing method, device and system
CN109241096A (en) * 2018-08-01 2019-01-18 北京京东金融科技控股有限公司 Data processing method, device and system
CN110266555A (en) * 2019-05-09 2019-09-20 重庆八戒电子商务有限公司 Method for analyzing web site service request
CN111339466A (en) * 2020-02-25 2020-06-26 天津满运软件科技有限公司 Interface management method and device, electronic equipment and readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108366082B (en) * 2017-01-26 2020-03-10 华为技术有限公司 Capacity expansion method and capacity expansion device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106470163A (en) * 2015-08-17 2017-03-01 腾讯科技(北京)有限公司 A kind of information processing method, device and system
CN109241096A (en) * 2018-08-01 2019-01-18 北京京东金融科技控股有限公司 Data processing method, device and system
CN110266555A (en) * 2019-05-09 2019-09-20 重庆八戒电子商务有限公司 Method for analyzing web site service request
CN111339466A (en) * 2020-02-25 2020-06-26 天津满运软件科技有限公司 Interface management method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN113225228A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN107704387B (en) Method, device, electronic equipment and computer readable medium for system early warning
CN114500339B (en) Node bandwidth monitoring method and device, electronic equipment and storage medium
CN110620699B (en) Message arrival rate determination method, device, equipment and computer readable storage medium
CN110647447B (en) Abnormal instance detection method, device, equipment and medium for distributed system
CN114416685B (en) Log processing method, system and storage medium
CN114223189A (en) Duration statistical method and device, electronic equipment and computer readable medium
CN112506619A (en) Job processing method, apparatus, electronic device, storage medium, and program product
CN110727563A (en) Cloud service alarm method and device for preset customer
CN113760982A (en) Data processing method and device
CN113225228B (en) Data processing method and device
CN117009283A (en) Multi-core multi-chip data processing method, device, chip and storage medium
CN115509931A (en) System-based performance test method and device, electronic equipment and storage medium
CN115687406A (en) Sampling method, device and equipment of call chain data and storage medium
CN114612212A (en) Business processing method, device and system based on risk control
CN114861039A (en) Parameter configuration method, device, equipment and storage medium of search engine
CN114428711A (en) Data detection method, device, equipment and storage medium
CN114338472A (en) Capacity test method, device, equipment, medium and product of map server
CN114049065A (en) Data processing method, device and system
CN110908886A (en) Data sending method and device, electronic equipment and storage medium
CN111694717A (en) Method and device for determining pressure bearing capacity value of system
CN113422734B (en) Resource distribution method, device, electronic equipment and storage medium
CN112633683B (en) Resource usage statistics method, device, system, electronic equipment and storage medium
CN114428712A (en) Time consumption statistical method and device
CN116088769A (en) Asynchronous chip, data carrying method, device, equipment and medium
CN117539719A (en) Application operation monitoring method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant