Traffic prediction method and device, storage medium and electronic equipment

By constructing a multiple linear regression model and a distributed link tracing system, service call relationships are obtained, and the influence of non-direct upstream services is eliminated, thus solving the problem of inaccurate service traffic prediction in ring topology structures and achieving high-accuracy traffic prediction and service optimization.

CN116506306BActive Publication Date: 2026-06-19BEIJING DINGSHIXINGJIAOYU CONSULTATION CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DINGSHIXINGJIAOYU CONSULTATION CO LTD
Filing Date
2023-04-28
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing technologies cannot accurately predict service traffic in a ring topology, and the error gradually amplifies with each level of prediction, making it impossible to predict service traffic.

Method used

By constructing a multiple linear regression traffic prediction model, using a distributed link tracing system to obtain service call relationships, calculating the correlation coefficients between services, and treating all services in the service call topology as a whole for traffic prediction, the influence of non-direct upstream services is eliminated.

🎯Benefits of technology

It improves the accuracy of traffic prediction, avoids the gradual increase of errors and prediction dead loops, and ensures that the service can respond normally when there is a sudden surge in traffic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116506306B_ABST
    Figure CN116506306B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a traffic prediction method, device, storage medium and electronic equipment, wherein the traffic prediction method comprises: determining first traffic generated by an entry service in a plurality of services included in a microservice; and determining predicted traffic generated by each service other than the entry service according to the first traffic and a pre-constructed multivariate linear regression traffic prediction model. The purpose of the present disclosure is to provide a traffic prediction method, device, storage medium and electronic equipment, which takes all services in a service call topology structure as a whole to perform traffic prediction, so as to solve the technical problems of inaccurate traffic prediction result and inability to perform traffic prediction on services in a ring topology structure in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of Internet technology, and more specifically, to a traffic prediction method, apparatus, storage medium, and electronic device. Background Technology

[0002] When predicting service traffic, related technologies rely on machine learning algorithms to predict the traffic of services directly downstream of the entry service. Then, based on the prediction results of these downstream services, the traffic of the services directly downstream of those downstream services is predicted. This process is repeated, progressively predicting the traffic of all services within the entire service topology.

[0003] As the number of services increases and the service topology changes, the calling relationships between services gradually form a ring structure. That is, a service that is directly downstream of a certain service may become a service that is directly upstream of that service. Therefore, if we continue to use the above method to deduce step by step, it will cause the traffic prediction to fall into an infinite loop and make it impossible to predict the traffic of the service. Summary of the Invention

[0004] The purpose of this disclosure is to provide a traffic prediction method, apparatus, storage medium, and electronic device to solve the technical problem in the related art that traffic prediction for services in a ring topology is impossible.

[0005] The first aspect of this disclosure provides a traffic prediction method, including:

[0006] Under the same historical business, determine the first historical traffic generated by the entry service among the multiple services included in the microservice, and the second historical traffic generated by each of the other services besides the entry service.

[0007] Taking each of the other services as a target service, perform the following operations: According to a preset calculation formula, using the second historical traffic corresponding to each of the other services and the first historical traffic as known quantities, calculate the calculation formula coefficients related to the target service. The calculation formula coefficients include constants and correlation coefficients between the direct upstream service of the target service and the target service; wherein, the correlation coefficients between the non-direct upstream service of the target service and the target service are defaulted to zero.

[0008] After obtaining the calculation coefficients corresponding to each of the other services, a multiple linear regression traffic prediction model is constructed. The multiple linear regression traffic prediction model is used to calculate the predicted traffic of the other services among the multiple services given the traffic of the entry service.

[0009] Optionally, the expression of the multiple linear regression traffic prediction model is to multiply the first matrix by the matrix composed of the predicted traffic of the multiple services to obtain the second matrix. The first matrix consists of the correlation coefficient between each of the other services and the target service for each target server. One element in the second matrix corresponds to a target service, and the element is the constant between the traffic of the entry service and the target service, as well as the formula for calculating the correlation coefficient between the entry service and the target service.

[0010] Optionally, the preset calculation formula is:

[0011]

[0012] x k For the second historical traffic of the k-th service serving the target service, where i is not equal to 0, x i For the second historical traffic of services other than the target service and the ingress service, when i equals 0, x0 represents the first traffic of the ingress service, n is the number of other services besides the ingress service, and b k Let a be the constant. k,i This represents the correlation coefficient between the i-th service and the target service.

[0013] Optionally, the expression for the multiple linear regression flow prediction model is:

[0014] AX = B

[0015] A is the first matrix, B is the second matrix, and X is a matrix composed of the predicted traffic of the multiple services. The formula for calculating the i-th element in the second matrix is: a i,0 *x0+b i .

[0016] Optionally, each of the services is embedded with a distributed tracing system, which is used to obtain the call logs of the corresponding service. The method further includes:

[0017] Based on the call logs, obtain the call relationships between the multiple services, and determine the service call topology diagram based on the call relationships;

[0018] For each target service, the direct upstream service of the target service is determined according to the service call topology diagram.

[0019] A second aspect of this disclosure provides a traffic prediction method, comprising:

[0020] Identify the first traffic generated by the entry service among the multiple services included in the microservice;

[0021] Based on the first traffic and a pre-built multiple linear regression traffic prediction model, the predicted traffic to be generated by each service other than the ingress service is determined, wherein the multiple linear regression traffic prediction model is constructed according to the method described in any one of the first aspects.

[0022] Optionally, for each service, performance tests are conducted on the service using a stress testing tool based on the corresponding predicted traffic to obtain performance test metrics.

[0023] If the performance test indicators do not meet the preset requirements, the service will be optimized.

[0024] Optionally, optimizing the service includes at least one of the following:

[0025] Define query replacement rules, which are used to replace the input coherent subqueries with incoherent subqueries;

[0026] Add a query index to the data;

[0027] Use local memory caching or distributed caching;

[0028] Use multithreading or thread pools to call APIs that do not block program flow.

[0029] A third aspect of this disclosure provides a flow prediction apparatus, the apparatus comprising:

[0030] The first acquisition module is used to determine the first historical traffic generated by the entry service among the multiple services included in the microservice under the same historical business, and the second historical traffic generated by each of the other services besides the entry service.

[0031] The calculation module is used to treat each of the other services as a target service and perform the following operations: according to a preset calculation formula, using the second historical traffic corresponding to each of the other services and the first historical traffic as known quantities, calculate the calculation formula coefficients related to the target service. The calculation formula coefficients include constants and correlation coefficients between the direct upstream service of the target service and the target service; wherein, the correlation coefficient between the non-direct upstream service of the target service and the target service is zero by default.

[0032] The construction module is used to construct a multiple linear regression traffic prediction model after obtaining the calculation coefficients corresponding to each of the other services. The multiple linear regression traffic prediction model is used to calculate the predicted traffic of the other services among the multiple services given the traffic of the entry service.

[0033] A fourth aspect of this disclosure provides a flow prediction apparatus, the apparatus comprising:

[0034] The second acquisition module is used to determine the first traffic that will be generated by the entry service among the multiple services included in the microservice;

[0035] The prediction module is configured to determine the predicted traffic to be generated by each service other than the ingress service based on the first traffic and a pre-built multiple linear regression traffic prediction model, wherein the multiple linear regression traffic prediction model is constructed according to the apparatus described in the third aspect.

[0036] The fifth aspect of this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in either the first or second aspect.

[0037] A sixth aspect of this disclosure provides an electronic device, comprising:

[0038] A memory on which computer programs are stored;

[0039] A processor for executing the computer program in the memory to implement the steps of the method of either the first aspect or the second aspect.

[0040] Through the above technical solution, this disclosure eliminates services that do not directly affect the target service, thus making the traffic prediction of the target service more accurate. Furthermore, since this disclosure treats all services in the service call topology as a whole when predicting traffic for any service in the service call topology diagram, it avoids the progressive increase of errors, further improving the accuracy of traffic prediction. It also avoids the technical problem of the prediction method getting stuck in an infinite loop and failing to predict service traffic.

[0041] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0042] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:

[0043] Figure 1 This is a flowchart illustrating a traffic prediction method according to an exemplary embodiment of the present disclosure;

[0044] Figure 2 This is a service call topology diagram illustrated according to an exemplary embodiment of the present disclosure;

[0045] Figure 3 This is a flowchart illustrating another traffic prediction method according to an exemplary embodiment of the present disclosure;

[0046] Figure 4 This is a structural block diagram of a flow prediction device according to an exemplary embodiment of the present disclosure;

[0047] Figure 5 This is a structural block diagram of another flow prediction device according to an exemplary embodiment of the present disclosure;

[0048] Figure 6 This is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0049] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0050] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0051] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0052] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0053] First, let's explain the application scenarios of this disclosure. Sudden surges in traffic, such as during large-scale promotions or flash sales, can easily slow down service response times or even cause system crashes. To overcome these shortcomings, service traffic can be predicted before a sudden surge, and then the service can be appropriately optimized and scaled up based on the prediction results. This ensures that the service can respond normally even during sudden surges in traffic, without affecting user experience.

[0054] However, related technologies predict service traffic by using machine learning algorithms to predict the traffic of the entry service's direct downstream services. Then, based on the prediction results of the entry service's direct downstream services, the traffic of the direct downstream services of those direct downstream services is predicted, and so on, progressively predicting the traffic of all services within the entire service topology. In other words: first, the traffic of the entry service is estimated; then, based on the estimated traffic and historical traffic data of the entry service's direct downstream services, machine learning algorithms (such as simple linear regression or multiple linear regression) are used to predict the traffic of those direct downstream services, obtaining the predicted traffic; then, based on the predicted traffic and historical traffic data of those direct downstream services, machine learning algorithms are used to predict the traffic of those direct downstream services' direct downstream services, obtaining the predicted traffic of those direct downstream services' direct downstream services' direct downstream services, and so on, until the traffic of all services in the entire service topology is predicted. In this prediction method, because the traffic prediction of downstream services depends on the prediction results of upstream services, the prediction error gradually amplifies. That is, the deeper the hierarchy of the topology, the larger the error, resulting in a significant discrepancy between the predicted traffic and the actual required traffic.

[0055] Furthermore, with the emergence of the "micro" service concept, the number of services within the same business scenario has multiplied, and the topology of service calls has become more complex. This topology is not limited to directed acyclic graphs (DAGs) but can also be directed graphs with cycles. However, for cyclic topologies, the call relationships between services form a circular structure—meaning a direct downstream service of one service may become its direct upstream service. Therefore, using the aforementioned calculation method for step-by-step derivation can lead to a dead loop in the prediction process, making it impossible to predict service traffic.

[0056] In view of this, embodiments of the present disclosure provide a traffic prediction method, apparatus, storage medium, and electronic device, which perform traffic prediction by treating all services in the service call topology diagram as a whole, thereby solving the technical problems of inaccurate traffic prediction results and the inability to predict traffic for services in a ring topology in related technologies.

[0057] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings.

[0058] A traffic prediction method, such as Figure 1 As shown, the following steps may be included:

[0059] S101: Determine the first historical traffic generated by the entry service among the multiple services included in the microservice under the same historical business, and the second historical traffic generated by each of the other services besides the entry service.

[0060] The first and second historical traffic can be obtained from the traffic logs of the corresponding services. For example, a distributed tracing system can be embedded in each service to obtain the traffic logs of the corresponding service, and then the corresponding historical traffic can be read from the traffic logs.

[0061] Furthermore, it should be understood that the selection of the first and second historical traffic can be arbitrary, as long as the time period for the first historical traffic corresponds to the time period for the second historical traffic. For example, if the traffic of the entry service in the past hour is selected as the first historical traffic, then the second historical traffic should be the traffic of each of the other services in the past hour.

[0062] S102: Treat each of the other services as the target service and perform the following operations: According to the preset calculation formula, using the second historical traffic corresponding to each of the other services and the first historical traffic as known quantities, calculate the calculation formula coefficients related to the target service. The calculation formula coefficients include constants and the correlation coefficients between the target service's direct upstream services and the target service; wherein, the correlation coefficients between the target service's indirect upstream services and the target service are zero by default.

[0063] It should be understood that a direct upstream service refers to a service that directly affects the current service, or a service with a direct calling relationship. For example, [example of an upstream service]. Figure 2 As shown, if the target service is service 9, its corresponding direct upstream services are services 8 and 11; if the target service is service 10, its corresponding direct upstream services are services 3 and 11. In a possible implementation, the direct upstream services can be determined through a service call topology diagram. Illustratively, a distributed tracing system can be embedded in each service to obtain the call logs of the corresponding service. Based on the service call relationships in each call log, a service call topology diagram can be determined, and then the direct upstream services of the target service can be determined based on the service call topology diagram.

[0064] That is, according to one embodiment of this disclosure, each service is embedded with a distributed tracing system, which is used to obtain the call logs of the corresponding service. The method provided in this embodiment of the disclosure may further include:

[0065] Based on the call logs, obtain the call relationships between multiple services and determine the service call topology diagram based on the call relationships; for each target service, determine the direct upstream service of the target service based on the service call topology diagram.

[0066] After obtaining the service call topology diagram, the direct and indirect upstream services corresponding to the target service can be determined based on the service call topology diagram, and then the calculation coefficients related to the target service can be determined based on the direct and indirect upstream services.

[0067] Since indirect upstream services have no direct impact on the target service, their correlation coefficient with the target service can be set to zero. Direct upstream services have a direct impact on the target service; therefore, the correlation coefficient between the direct upstream service and the target service can be obtained by analyzing their historical traffic. For example, the correlation coefficient can be obtained by fitting a function based on the historical traffic of the direct upstream service and the target service, combined with a multiple linear regression equation. That is, according to an embodiment of this disclosure, the preset calculation formula can be set as follows:

[0068]

[0069] Where, x k For the second historical traffic of the k-th service as the target service, where i is not equal to 0, x i For the second historical traffic of services other than the target service and the ingress service, when i equals 0, x0 represents the first traffic of the ingress service, n is the number of other services besides the ingress service, and b k a is a constant. k,i Let represent the correlation coefficient between the i-th service and the target service.

[0070] For illustration, if there are 5 services in the service call topology diagram, and the first historical traffic of the entry service is x0, and the second historical traffic of the other services are x1, x2, x3, and x4 respectively, then when the target service is x3, the preset calculation formula corresponding to the target service can be expressed as:

[0071] x3=a 3,0 x0+a 3,1 x1+a 3,2 x2+a 3,4 x4

[0072] After obtaining the preset calculation formula corresponding to the target service, all direct and indirect upstream services of the target service can be identified based on the service call topology diagram. For all indirect upstream services, their corresponding coefficients 'a' are calculated. k,i Set x to 0; for all direct upstream services, set x to 0. i Replace each service's traffic data with its past traffic data over a period of time, and use ordinary least squares to fit the data, thereby obtaining the coefficient 'a' for each direct upstream service. k,i and constant bk The optimal solution.

[0073] Schematic representation: If the preset calculation formula corresponding to the target service is:

[0074] x3=a 3,0 x0+a 3,1 x1+a 3,2 x2+a 3,4 x4

[0075] Furthermore, the direct upstream services corresponding to the target service are x1 and x4, and the indirect upstream services are x0 and x2. Therefore, the correlation coefficient a can be... 3,0 and correlation coefficient a 3,2 Setting it to 0 changes the default calculation formula for the target service to:

[0076] x3=a 3,1 x1+a 3,4 x4

[0077] Then, x1, x4, and x3 are replaced with traffic data from a past period, and ordinary least squares is used for fitting to obtain the correlation coefficient a. 3,1 Correlation coefficient a 3,4 And the optimal solution for the constant b3.

[0078] S103: After obtaining the calculation coefficients for each of the other services, construct a multiple linear regression traffic prediction model. The multiple linear regression traffic prediction model is used to calculate the predicted traffic of other services among multiple services given the traffic of the entry service.

[0079] It should be understood that since the calculation coefficients of each target service are known, the traffic of each target service can be predicted based on the current or predicted traffic of its corresponding direct upstream service, thereby obtaining the predicted traffic of all services except the entry service in the service call topology diagram.

[0080] Furthermore, it should be understood that in some cases, the current or predicted traffic of the direct upstream service is unknown. Therefore, in a possible implementation, after obtaining the coefficients of each objective function, the preset calculation formulas corresponding to all target services can be converted into a matrix multiplication form as a whole to obtain the final multiple linear regression traffic prediction model. That is, according to an embodiment of this disclosure, the expression of the multiple linear regression traffic prediction model can be obtained by multiplying a first matrix with a matrix composed of the predicted traffic of multiple services to obtain a second matrix. The first matrix consists of the correlation coefficients between each other service and the target service for each target server. One element in the second matrix corresponds to a target service, and this element is the constant between the traffic of the ingress service and the target service, as well as the calculation formula of the correlation coefficient between the ingress service and the target service. That is, the expression of the multiple linear regression traffic prediction model can be set as follows:

[0081] AX = B

[0082]

[0083]

[0084]

[0085] Where A is the first matrix, B is the second matrix, and X is a matrix composed of predicted traffic from multiple services. The formula for calculating the i-th element in the second matrix is: a i,0 *x0+b i .

[0086] Based on the expressions of matrices A and B, we know that the values ​​of the elements in matrices A and B are known. Therefore, we can use the LU decomposition method to calculate the value of each element in matrix X based on the values ​​of the elements in matrices A and B, thereby obtaining the traffic prediction value for each service.

[0087] Through the above technical solution, this disclosure eliminates services that do not directly affect the target service, thus making the traffic prediction of the target service more accurate. Furthermore, since this disclosure treats all services in the service call topology as a whole when predicting traffic for any service in the service call topology diagram, it avoids the progressive increase of errors, further improving the accuracy of traffic prediction. It also avoids the technical problem of the prediction method getting stuck in an infinite loop and failing to predict service traffic.

[0088] Based on the above methods, this disclosure also provides a traffic prediction method, such as... Figure 3 As shown, the method may include:

[0089] S301: Determine the first traffic generated by the entry service among the multiple services included in the microservice;

[0090] The initial traffic generated by the entry service can be predicted based on historical traffic data from the relevant business scenario. It should be understood that this is merely illustrative and does not constitute a limitation of this disclosure. In practical implementation, the initial traffic can also be predicted based on the current activity level, promotional effectiveness, and past experience within the business scenario.

[0091] S302: Based on the first traffic and a pre-built multiple linear regression traffic prediction model, determine the predicted traffic to be generated by each service other than the ingress service, wherein the multiple linear regression traffic prediction model is constructed according to any of the above methods.

[0092] In summary, by predicting the traffic of the entry service and substituting the predicted entry service traffic (i.e., the first traffic) into a multiple linear regression traffic prediction model, the predicted traffic generated by each service other than the entry service can be obtained. Compared to the step-by-step derivation method used in related technologies to predict service traffic, this disclosure treats all services in the service call topology diagram as a whole for prediction when predicting traffic. Therefore, it avoids the increase in error during step-by-step prediction, effectively improves the accuracy of prediction, and also avoids the technical problem of being unable to predict service traffic due to the prediction process getting stuck in an infinite loop during step-by-step prediction.

[0093] After obtaining the predicted traffic for each service, in order to determine the performance (response time, response speed, system stability, and / or hardware metrics) of each service under the corresponding predicted traffic, stress testing tools can be used to test each service separately. If the service performance is unsatisfactory, or even fails to reach the predicted traffic, the service system can be analyzed and optimized. That is, according to one embodiment of this disclosure, for each service, performance testing can be performed using stress testing tools based on the corresponding predicted traffic to obtain performance test metrics; if the performance test metrics do not meet preset metric requirements, the service can be optimized. In possible implementations, service optimization includes at least one of the following:

[0094] Define query replacement rules, which are used to replace coherent subqueries with incoherent subqueries; add query indexes to the data; use local memory caching or distributed caching; use multithreading or thread pool calls to obtain API results that do not block program flow.

[0095] After the above optimizations, stress testing tools can be used to test each service separately. If the service performance is still not ideal, the service can be optimized again using one or more of the above optimization methods until each service can withstand the impact of the corresponding predicted traffic.

[0096] Based on the same concept, this disclosure also provides a flow prediction device, such as Figure 4 As shown, as a response to the above Figure 1 The implementation of the method shown, the flow prediction device 400 may include:

[0097] The first acquisition module 410 is used to determine the first historical traffic generated by the entry service among the multiple services included in the microservice under the same historical business, and the second historical traffic generated by each of the other services besides the entry service.

[0098] The calculation module 420 is used to treat each of the other services as the target service and perform the following operations: according to a preset calculation formula, using the second historical traffic corresponding to each of the other services and the first historical traffic as known quantities, calculate the calculation formula coefficients related to the target service. The calculation formula coefficients include constants and the correlation coefficients between the target service's direct upstream services and the target service; wherein, the correlation coefficients between the target service's indirect upstream services and the target service are zero by default.

[0099] Module 430 is used to construct a multiple linear regression traffic prediction model after obtaining the calculated coefficients for each of the other services. The multiple linear regression traffic prediction model is used to calculate the predicted traffic of other services among multiple services given the traffic of the entry service.

[0100] Optionally, the expression of the multiple linear regression traffic prediction model is to multiply the first matrix by the matrix composed of the predicted traffic of multiple services to obtain the second matrix. The first matrix consists of the correlation coefficient between each other service and the target service for each target server. One element in the second matrix corresponds to a target service, and the element is the constant between the traffic of the ingress service and the target service, as well as the formula for calculating the correlation coefficient between the ingress service and the target service.

[0101] Optionally, the default calculation formula is:

[0102]

[0103] x k For the second historical traffic of the k-th service as the target service, where i is not equal to 0, x iFor the second historical traffic of services other than the target service and the ingress service, when i equals 0, x0 represents the first traffic of the ingress service, n is the number of other services besides the ingress service, and b k a is a constant. k,i Let represent the correlation coefficient between the i-th service and the target service.

[0104] Optionally, the expression for the multiple linear regression flow prediction model is:

[0105] AX = B

[0106] A is the first matrix, B is the second matrix, and X is a matrix composed of predicted traffic from multiple services. The formula for calculating the i-th element in the second matrix is: a i,0 *x0+b i .

[0107] Optionally, each service embeds a distributed tracing system, which is used to obtain the call logs of the corresponding service. The traffic prediction device also includes a processing module, which is used to:

[0108] Based on the call logs, obtain the call relationships between multiple services and determine the service call topology diagram based on the call relationships; for each target service, determine the direct upstream service of the target service based on the service call topology diagram.

[0109] Through the above technical solution, this disclosure eliminates services that do not directly affect the target service, thus making the traffic prediction of the target service more accurate. Furthermore, since this disclosure treats all services in the service call topology as a whole when predicting traffic for any service in the service call topology diagram, it avoids the progressive increase of errors, further improving the accuracy of traffic prediction. It also avoids the technical problem of the prediction method getting stuck in an infinite loop and failing to predict service traffic.

[0110] Based on the same concept, this disclosure also provides a flow prediction device, such as Figure 5 As shown, as a response to the above Figure 3 The implementation of the method shown, the flow prediction device 500 may include:

[0111] The second acquisition module 510 is used to determine the first traffic that will be generated by the entry service among the multiple services included in the microservice;

[0112] Prediction module 520 is used to determine the predicted traffic generated by each service other than the ingress service based on the first traffic and a pre-built multiple linear regression traffic prediction model. Optionally, the multiple linear regression traffic prediction model is constructed based on the traffic prediction device. The traffic prediction device also includes an optimization module, which is used to:

[0113] For each service, performance tests are conducted using stress testing tools based on the corresponding predicted traffic to obtain performance test metrics. If the performance test metrics do not meet the preset requirements, the service is optimized.

[0114] Optionally, the optimization module is used for:

[0115] Define query replacement rules, which are used to replace coherent subqueries with incoherent subqueries; add query indexes to the data; use local memory caching or distributed caching; and / or use multithreading or thread pool calls to obtain API results that do not block program flow.

[0116] In summary, by predicting the traffic of the entry service and substituting the predicted entry service traffic (i.e., the first traffic) into a multiple linear regression traffic prediction model, the predicted traffic generated by each service other than the entry service can be obtained. Compared to the step-by-step derivation method used in related technologies to predict service traffic, this disclosure treats all services in the service call topology as a whole for prediction. Therefore, even with a large service call topology, the error will not increase, effectively improving the accuracy of the prediction. It also avoids the technical problem of being unable to predict service traffic due to the prediction process getting stuck in an infinite loop during step-by-step prediction.

[0117] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0118] Figure 6 This is a block diagram illustrating an electronic device 600 according to an exemplary embodiment. For example... Figure 6 As shown, the electronic device 600 may include a processor 601 and a memory 602. The electronic device 600 may also include one or more of a multimedia component 603, an input / output (I / O) interface 604, and a communication component 605.

[0119] The processor 601 controls the overall operation of the electronic device 600 to complete all or part of the steps in the above method. The memory 602 stores various types of data to support the operation of the electronic device 600. This data may include, for example, instructions for any application or method operating on the electronic device 600, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 602 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The multimedia component 603 may include a screen and audio components. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 602 or transmitted via communication component 605. The audio component also includes at least one speaker for outputting audio signals. I / O interface 604 provides an interface between processor 601 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 605 is used for wired or wireless communication between the electronic device 600 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 605 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.

[0120] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0121] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the method described above. For example, the computer-readable storage medium may be the memory 602 including the program instructions described above, which may be executed by the processor 601 of the electronic device 600 to perform the method described above.

[0122] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the methods described above when executed by the programmable device.

[0123] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0124] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0125] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A flow prediction method, characterized in that, include: Under the same historical business, determine the first historical traffic generated by the entry service among the multiple services included in the microservice, and the second historical traffic generated by each of the other services besides the entry service. Based on the call logs corresponding to the services, the call relationships between the multiple services are obtained, and the service call topology diagram is determined based on the call relationships. The call logs corresponding to the services are obtained by the distributed tracing system embedded in the services. Taking each of the other services as a target service, perform the following operations: For each target service, determine the direct upstream service of the target service based on the service call topology diagram; according to a preset calculation formula, using the second historical traffic corresponding to each of the other services and the first historical traffic as known quantities, calculate the calculation formula coefficients related to the target service, the calculation formula coefficients including constants and the correlation coefficients between the direct upstream service of the target service and the target service; wherein, the correlation coefficients between the non-direct upstream service of the target service and the target service are defaulted to zero; After obtaining the calculation coefficients corresponding to each of the other services, a multiple linear regression traffic prediction model is constructed. The multiple linear regression traffic prediction model is used to calculate the predicted traffic of the other services among the multiple services given the traffic of the entry service.

2. The method of claim 1, wherein, The expression of the multiple linear regression traffic prediction model is to multiply the first matrix by the matrix composed of the predicted traffic of the multiple services to obtain the second matrix. The first matrix consists of the correlation coefficient between each of the other services and the target service for each target server. One element in the second matrix corresponds to a target service, and the element is the constant between the traffic of the entry service and the target service, as well as the formula for calculating the correlation coefficient between the entry service and the target service.

3. The method of claim 2, wherein, The preset calculation formula is: For the second historical traffic of the k-th service serving the target service, where i is not equal to 0, For the second historical traffic of services other than the target service and the entry service, when i equals 0, The first traffic represents the ingress service, and n is the number of other services besides the ingress service. Let be the constant, This represents the correlation coefficient between the i-th service and the target service.

4. The method of claim 3, wherein, The expression for the multiple linear regression flow prediction model is as follows: For the first matrix, This is the second matrix. The matrix consists of predicted traffic for the multiple services, and the formula for calculating the i-th element in the second matrix is: .

5. A traffic prediction method characterized by, include: Identify the first traffic generated by the entry service among the multiple services included in the microservice; Based on the first traffic and a pre-built multiple linear regression traffic prediction model, the predicted traffic to be generated by each service other than the ingress service is determined, wherein the multiple linear regression traffic prediction model is constructed by the method according to any one of claims 1-4.

6. The method according to claim 5, characterized in that, For each service, based on the corresponding predicted traffic, a stress testing tool is used to perform performance testing on the service to obtain performance test metrics. If the performance test indicators do not meet the preset requirements, the service will be optimized.

7. The method of claim 6, wherein, Optimizing the service includes at least one of the following: Define query replacement rules, which are used to replace the input coherent subqueries with incoherent subqueries; Add a query index to the data; Use local memory caching or distributed caching; Use multithreading or thread pools to call APIs that do not block program flow.

8. A flow prediction device, characterized in that, The device includes: The first acquisition module is used to determine the first historical traffic generated by the entry service among the multiple services included in the microservice under the same historical business, and the second historical traffic generated by each of the other services besides the entry service. The processing module is used to obtain the call relationship between the multiple services based on the call logs corresponding to the services, and determine the service call topology diagram based on the call relationship. The call logs corresponding to the services are obtained by the distributed tracing system embedded in the services. The calculation module is configured to treat each of the other services as a target service and perform the following operations: for each target service, determine the direct upstream service of the target service based on the service call topology diagram; calculate the calculation formula coefficients related to the target service according to a preset calculation formula, using the second historical traffic corresponding to each of the other services and the first historical traffic as known quantities, wherein the calculation formula coefficients include constants and correlation coefficients between the direct upstream service of the target service and the target service; wherein the correlation coefficient between the non-direct upstream service of the target service and the target service is zero by default; The construction module is used to construct a multiple linear regression traffic prediction model after obtaining the calculation coefficients corresponding to each of the other services. The multiple linear regression traffic prediction model is used to calculate the predicted traffic of the other services among the multiple services given the traffic of the entry service.

9. A flow prediction device, characterized by, The device includes: The second acquisition module is used to determine the first traffic that will be generated by the entry service among the multiple services included in the microservice; The prediction module is configured to determine the predicted traffic to be generated by each service other than the ingress service based on the first traffic and a pre-built multiple linear regression traffic prediction model, wherein the multiple linear regression traffic prediction model is constructed by the apparatus according to claim 8.

10. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-7.

11. An electronic device, comprising: include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Service interface pressure prediction and model training method and device

    CN115221055A