CN114218123A - Method and device for automatically adjusting and optimizing parameters of service flow - Google Patents

Method and device for automatically adjusting and optimizing parameters of service flow Download PDF

Info

Publication number
CN114218123A
CN114218123A CN202210074332.9A CN202210074332A CN114218123A CN 114218123 A CN114218123 A CN 114218123A CN 202210074332 A CN202210074332 A CN 202210074332A CN 114218123 A CN114218123 A CN 114218123A
Authority
CN
China
Prior art keywords
service
tested
index
value
concurrency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210074332.9A
Other languages
Chinese (zh)
Inventor
陈睿丰
李铖
柯鸿威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Publication of CN114218123A publication Critical patent/CN114218123A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The method comprises the steps of determining the concurrency number and concurrency interval time of historical service flow according to the recorded historical service flow; determining a service parameter value of a service to be tested and a target value of a service index; performing a pressure test on the service to be tested according to the service parameter value of the service to be tested and the concurrency number and the concurrency interval time of the historical service flow related to the service to be tested to obtain a service index test value of the service to be tested; if the service index test value of the service to be tested does not reach the service index target value of the service to be tested, adjusting the service parameter value of the service to be tested; and repeatedly executing the pressure test process according to the service parameter value after the service to be tested is adjusted. The method simulates the real traffic flow trend through the traffic recording and playback, adjusts the traffic parameters, and can improve the software test execution efficiency.

Description

Method and device for automatically adjusting and optimizing parameters of service flow
Technical Field
The present disclosure relates to the field of information technology, and more particularly, to a method and an apparatus for automatically tuning parameters of traffic flow.
Background
With the development of internet technology, the micro service framework has become a mainstream technology in the field of software development, wherein Apache Dubbo is one of the micro service frameworks of the main applications. The frame has more service parameters and complex configuration, and the main service parameters include: thread pool size, I/O thread pool size, queue size, number of links, etc. After the micro service application is completed in service logic and before formal online use, the performance parameters of the Dubbo frame are adjusted through a software performance test and a pressure test, so that the online performance of the micro service application is optimal.
In the software performance test in the prior art, generally, experienced engineers estimate the online service types and product conditions, then estimate the service concurrency number and concurrency interval time according to manual experience, determine the difference between an index and a target index according to a pressure test result, and then perform parameter configuration according to experience. The manual parameter configuration has the problems of complex operation, high possibility of error occurrence due to large configuration quantity and high maintenance cost, so that high requirements on manual software performance test are required.
Aiming at the problem that errors are easy to occur in manual software performance test, a method for automatically adjusting and optimizing performance parameters based on flow recording and playback is urgently needed to be researched.
Disclosure of Invention
In order to solve the above problems in the prior art, embodiments herein provide a method and an apparatus for tuning parameters based on traffic recording and playback, a computer device, and a storage medium, which solve the problems in the prior art. The flow recording and playback technology, the automatic pressure testing technology and the parameter automatic adjustment technology of the production environment are combined for use, the real business flow trend is simulated through flow recording and playback, the Dubbo frame parameters are further automatically adjusted, the micro-service is rapidly assisted to be put on line, the performance parameter debugging threshold of the micro-service is reduced, and the software testing execution efficiency and the working efficiency of testing personnel are improved.
Embodiments herein provide a method comprising: determining the concurrency number and concurrency interval time of the historical service flow according to the recorded historical service flow; determining a service parameter value of a service to be tested and a target value of a service index; performing a pressure test on the service to be tested according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service flow related to the service to be tested, and obtaining a service index test value of the service to be tested;
comparing the service index test value of the service to be tested with the target value of the service index of the service to be tested, and if the service index test value of the service to be tested does not reach the target value of the service index of the service to be tested, adjusting the service parameter value of the service to be tested; and according to the service parameter value adjusted by the service to be tested, repeatedly executing the pressure test process until the service index test value of the service to be tested reaches the target value of the service index of the service to be tested.
According to an aspect of embodiments herein, the determining the concurrency number and the concurrency interval time of the historical service traffic according to the recorded historical service traffic comprises: calculating the throughput of the historical service flow according to the recorded historical service flow; according to the product of time and the throughput, calculating the concurrency number of the historical service flow; and determining the concurrency interval time according to the change condition of the historical service flow at different moments.
According to an aspect of embodiments herein, the performing a stress test on the service to be tested according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service traffic related to the service to be tested comprises: sending the concurrency number and the concurrency interval time of the historical service flow to a pressure test program of the service to be tested; executing the stress test with the concurrency number, the concurrency interval time and at least one service parameter in the stress test program, wherein the service parameter at least comprises: number of concurrent threads, number of I/O threads, number of thread queues, maximum number of links, timeout time.
According to an aspect of the embodiments herein, an index model is arranged in the pressure test program of the service to be tested, and the index model is established according to a service parameter value of the service to be tested, and is used for obtaining a service index test value in the pressure test.
According to an aspect of embodiments herein, when the service to be tested is an interface service, the service indicator is a ratio of a concurrency number of a historical service traffic to an average response time; and when the service to be tested is a page service, the service index is the ratio of the number of transactions to the response time.
According to an aspect of embodiments herein, when the service to be tested is an interface service, the service index is calculated by the following formula:
QPS=P/T;
Figure BDA0003483290460000021
Figure BDA0003483290460000031
wherein, P is the concurrency number, T is the average response time, n is the sampling frequency, alpha is the overtime probability of program processing, T is the program execution time, threads is the size of the service processing thread pool, queue is the size of the thread pool queue, Min represents the minifunction, SUM is the summation of integers 1 to n, and timeouts is the overtime time of program processing.
According to an aspect of embodiments herein, the adjusting the service parameter value of the service to be tested comprises: and only adjusting the service parameter value of one service to be tested at each time according to the service parameter adjustment step length and the service parameter adjustment sequence of the service to be tested.
An embodiment of the present invention further provides a device for tuning parameters of service traffic, including: the first determining unit is used for determining the concurrency number and the concurrency interval time of the historical service flow according to the recorded historical service flow; the second determining unit is used for determining the service parameter value of the service to be tested and the target value of the service index; a service index test value obtaining unit, configured to perform a pressure test on a service to be tested according to a service parameter value of the service to be tested, a concurrency number and a concurrency interval time of historical service traffic related to the service to be tested, so as to obtain a service index test value of the service to be tested; a service parameter value adjusting unit, configured to compare the service index test value of the service to be tested with the target value of the service index of the service to be tested, and adjust the service parameter value of the service to be tested if the service index test value of the service to be tested does not reach the target value of the service index of the service to be tested; and the repeated execution unit is used for repeatedly executing the pressure test process according to the adjusted service parameter value of the service to be tested until the service index test value of the service to be tested reaches the target value of the service index of the service to be tested.
Embodiments herein also provide a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above-mentioned method when executing the computer program.
Embodiments herein also provide a computer-readable storage medium having stored thereon computer instructions, which when executed by a processor, implement the above-described method.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic network structure diagram of an automatic parameter tuning system for traffic flow according to an embodiment of the present disclosure;
fig. 2 is a flow chart illustrating a method of automatically tuning a system for traffic flow parameters according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating a method for determining concurrency number and concurrency interval time of historical traffic according to an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating a method for adjusting a service parameter value according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram illustrating an apparatus for automatically tuning parameters of service traffic according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram illustrating an apparatus for automatically tuning parameters of service traffic according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure.
Description of the symbols of the drawings:
101. a service flow parameter automatic tuning system;
102. a pressure test server;
103. a storage device;
501. a first determination unit;
502. a second determination unit;
503. a service index test value obtaining unit;
504. a service parameter value adjusting unit;
505. a repeat execution unit;
5011. a recording module;
5012. a calculation module;
5021. a service parameter value adjusting module;
5031. a pressure test execution module;
5041. a comparison module;
702. a computer device;
704. a processor;
706. a memory;
708. a drive mechanism;
710. an input/output module;
712. an input device;
714. an output device;
716. a presentation device;
718. a graphical user interface;
720. a network interface;
722. a communication link;
724. a communication bus.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments, but not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments herein without making any creative effort, shall fall within the scope of protection.
It should be noted that the terms "first," "second," and the like in the description and claims herein and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments herein described are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
The present specification provides method steps as described in the examples or flowcharts, but may include more or fewer steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual system or apparatus product executes, it can execute sequentially or in parallel according to the method shown in the embodiment or the figures.
It should be noted that the method and apparatus for automatically tuning parameters of business traffic herein can be used in the financial field, and can also be used in any field other than the financial field.
Fig. 1 is a schematic structural diagram of an automatic tuning system for traffic recording and playback performance parameters according to an embodiment of the present disclosure, and this diagram describes an automatic tuning method for traffic recording and playback performance parameters by combining a service traffic parameter automatic tuning system 101, a stress test server 102, and a storage device 103. The service flow parameter automatic tuning system 101, the stress test server 102, and the storage device 103 may perform data interaction therebetween.
In some embodiments of the present specification, the system 101 for automatically tuning service traffic parameters may be an electronic device with a network interaction function, or may be software running in the electronic device and providing service logic for data processing and network interaction. The automatic service flow parameter tuning system 101 may record and store historical service flows. The automatic service flow parameter tuning system 101 may determine the concurrency number and the transmission interval time of the historical service flow, and send the values to the pressure test server 102.
In some embodiments of the present description, the stress test server 102 may be an electronic device with a network interaction function, or may be software that runs in the electronic device and provides service logic for data processing and network interaction. The pressure test server 102 may perform a pressure test on the service to be tested according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service traffic related to the service to be tested. The pressure test server 102 may further compare the service index test value of the service to be tested with the target value of the service index, and adjust the service parameter value of the service to be tested according to the comparison result.
In some embodiments of the present description, the storage device 103 may include mass storage, removable storage, volatile read-write memory, read-only memory (ROM), and the like, or any combination thereof. Exemplary mass storage devices may include magnetic disks, optical disks, solid state disks, and the like. An exemplary read-only memory may include Random Access Memory (RAM). The storage device 103 may store the historical traffic of the playback recorded production environment; the storage device 103 may store service parameter values of services to be tested; the storage device 103 may store a comparison result of the service index test value and the target value of the service index; the storage device 103 may store a target value of the service indicator after each stress test is performed. The storage device 103 is not limited to the electronic device with a certain entity, and may also be software running in the electronic device.
Fig. 2 is a flowchart of a method for automatically tuning service traffic parameters according to an embodiment of the present disclosure, which specifically includes the following steps:
step 201, determining the concurrency number and concurrency interval time of historical service flow according to the recorded historical service flow;
step 202, determining a service parameter value of a service to be tested and a target value of a service index;
step 203, according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service flow related to the service to be tested, executing a pressure test on the service to be tested to obtain a service index test value of the service to be tested;
step 204, comparing the service index test value of the service to be tested with the target value of the service index of the service to be tested, and if the service index test value of the service to be tested does not reach the target value of the service index of the service to be tested, adjusting the service parameter value of the service to be tested;
step 205, according to the adjusted service parameter value of the service to be tested, the process of the pressure test is repeatedly executed until the service index test value of the service to be tested reaches the target value of the service index of the service to be tested.
In an internet service scene, a service can go through three stages of development, testing and online and respectively corresponds to a development environment, a testing environment and a production environment. Wherein the production environment and the test environment are different functions or different versions of a service. The production environment is used for formally providing external services, and is a truly occurring business environment. The test environment is used to test whether there is a problem with the application or program, and the test environment generally replicates a configuration of the production environment, which is similar to the production environment. For example, a production environment is a traffic recorded for function a of a service, and what needs to be actually stress tested is function a1 of the service. It is generally desirable to test function a1 to simulate as much as possible the flow variations of function a in a production environment. And sending a user request by the stress test program within the same time or a certain time, and recording the stress condition which can be borne by the tested service under different stress conditions.
In some embodiments of the present description, the historical traffic is actual real production environment traffic occurring in the past time, and the parameter automatic tuning system may record or copy the historical traffic data and store the recorded historical traffic data in the memory. When the pressure test is needed, the stored historical service flow is obtained from the memory, the concurrency number and the concurrency interval time of the historical service flow are sent to the pressure test program, the pressure test program executes the pressure test by using the concurrency number and the concurrency interval time of the historical service flow, the real production environment is simulated as far as possible, and the pressure test program is close to the actual situation as far as possible. Wherein, the historical service flow can be a user request, a user flow and the like; the concurrency number is the number of user requests or transactions processed by the system at the same time.
Further, the concurrency number of the historical service traffic is the number of user requests for accessing the service server site simultaneously. For example, the number of people who access the reserved page of the commemorative coin in the same second is 1000, that is, 1000 user access requests in one second, and under the ideal condition that the user side environment difference and the network system difference are not considered, the concurrency number of the historical service flow is 1000.
Further, the concurrency interval time is a time interval in which the concurrency number changes with time. For example, the number of concurrent traffic flows in the first second is 10, the number of concurrent traffic flows in five seconds or later is 15, and the number of concurrent traffic flows in ten seconds or later is 20. The condition that the concurrency number of different service flows changes along with different time is the concurrency interval time.
In some embodiments of the present specification, the production flow recorded by function a is played first, and meanwhile, the flow concurrency number of function a is calculated, and the flow concurrency number is sent to the pressure test program of function a1, so that the program performs pressure test on function a1 with the same concurrency number, and a real pressure change situation can be simulated.
In some embodiments of the present specification, the service to be tested is a service to be subjected to a pressure test, and the parameter of the service to be tested is a parameter that can indicate the working state or working performance of the micro-service in the micro-service framework. The parameters of the service to be tested at least comprise various parameters such as service processing thread pool size (threads), I/O thread pool Size (IOTs), thread pool queue size (queues), maximum number of links (connections), maximum number of concurrent calls (actives), maximum number of receivable connections (addresses), timeout time of program processing (time), and the like. The threads are used for adjusting the number of concurrent threads of the program, and the queues are used for the number of subsequent links capable of being queued when the number of concurrent threads is full; connections are approximately equal to the sum of reads and queues.
In some embodiments of the present description, the target value of the service indicator is a value expected by the service flow parameter automatic tuning system 101 for the service indicator set for different services. The service index includes, but is not limited to, one of or any combination of a number of Transactions Per Second (TPS), a query rate Per Second (QPS), a number of Calls Per Second (CPS), and the like. In addition, the automatic service flow parameter tuning system 101 may determine different service indexes according to different types of services to be tested. For example, for a pressure test of an interface service, the service index is QPS; aiming at the pressure test of the page service, the service index is TPS. The service index in this specification may be various other indexes, and the application does not limit the type of the service index.
Fig. 3 is a flowchart illustrating a method for determining concurrency number and concurrency interval time of historical traffic according to an embodiment of the present disclosure.
Step 301, calculating the throughput of the historical service traffic according to the recorded historical service traffic.
In some embodiments of the present description, the recorded historical traffic may be played back using a traffic playback tool, thereby calculating the throughput of the historical traffic. Traffic replay tools may be in the form of applets, software scripts, etc., including Tcpcopy, sharongan, etc. The flow playback tool records real flow actually occurring on the line and plays back the flow in the development environment, namely, intercepts requests received by the online service and responses of the online service to the requests, sequentially inputs the requests according to the interception sequence of the requests in the test environment, simulates user requests, and compares the responses of the service in the test environment to the requests with the responses of the online service, so as to adjust the performance of the test service.
Further, the traffic replay tool may calculate a throughput of the historical traffic, wherein the throughput represents the amount of work done per unit time. The throughput of the system is closely related to the consumption of requests to the CPU, external interfaces, I/O, etc. The higher the consumption of a single request on the CPU, the slower the influence speed of an interface and I/O of an external system is, and the lower the throughput capacity of the system is; the lower the consumption of a single request to the CPU, the faster the interface, I/O, of the external system, and the higher the system throughput.
Step 302, calculating the concurrency number of the historical service flow according to the product of time and the throughput. In some embodiments of the present description, the concurrent number is calculated by the following formula: concurrency is throughput x time, where the symbol "x" is the product symbol. According to the concurrency number calculation formula, the pressure test server can calculate the concurrency number of the historical service flow.
Step 303, determining a concurrency interval time according to the change condition of the historical service flow at different times.
In some embodiments of the present specification, the concurrency numbers of the historical service traffic at different times may be different or vary, and in order to simulate a real service situation in a test environment as much as possible, the pressure test server 102 records the concurrency variation of the historical service traffic at different times, and sends the concurrency variation at different times to the pressure test program, so as to perform a pressure test on the service to be tested. For example, the historical traffic flow has a concurrency number of 10 at 1 st second, a concurrency number of 2 nd to 4 th seconds, a concurrency number of 20 at 5 th second and 3 seconds, a concurrency number of 80 at 9 th second and a concurrency number of 100 at 10 th second. And sending a pressure test program in the same concurrency number change condition in the pressure test according to the change condition of the concurrency number of the historical service flow within 10 seconds.
As an embodiment herein, the performing a stress test on the service to be tested according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service traffic related to the service to be tested includes: sending the concurrency number and the concurrency interval time of the historical service flow to a pressure test program of the service to be tested; executing the stress test with the concurrency number, the concurrency interval time and at least one service parameter in the stress test program, wherein the service parameter at least comprises: number of concurrent threads, number of I/O threads, number of thread queues, maximum number of links, timeout time.
In some embodiments of the present description, the service parameter is a plurality of service parameters that the Dubbo framework defaults to. The number of concurrent threads represents the size of the number of concurrent threads in the service processing thread pool, the number of I/O threads represents the size of the number of concurrent threads in the I/O thread pool, the number of thread queues represents the size of a thread pool queue, the maximum number of links is the maximum number of links provided for each provider, and the timeout time represents the timeout time of service execution.
In some embodiments of the present description, performing stress testing on a service under test typically requires performing multiple stress tests. In particular, the initial pressure test (i.e., the first pressure test) is performed on the service to be tested, and the initial pressure test uses default values of a plurality of service parameters to perform the pressure test. For example, the initial stress test uses the traffic parameters: the default value of the number of the concurrent threads is 200, which represents that the size of the service processing thread pool is 200; the default value of the I/O thread number used in the initial pressure test is CPU +1, and the default value representing the size of the I/O thread pool is the CPU value plus 1; the initial stress test uses a business parameter thread queue book with a default value of 0, representing a thread pool queue size of 0, where the queue size queued for execution when the thread pool is full. After the initial pressure test is performed on the service to be tested, the 2 nd and 3 rd pressure tests may need to be performed continuously, and the values of a plurality of service parameters in the initial pressure test are adjusted according to a certain rule, so that the adjusted pressure test result can be obtained.
As an embodiment herein, an index model is arranged in a pressure test program of the service to be tested, and the index model is established according to service parameters of the service to be tested and is used for obtaining a service index test value in the pressure test.
In some embodiments of the present specification, the pressure test server 102 establishes at least one index model according to the service parameters of the service to be tested, and obtains a service index test value of the service to be tested by using the index model in the pressure test program. For example, an index model is established according to the service parameters of the service to be tested, such as threads, queue and timeouts, and the test value of the service index is obtained by calculating the value of the index model in the pressure test program.
As an embodiment herein, the service index includes at least: interface service index and page service index; when the service to be tested is an interface service, the service index is the ratio of the concurrency number of the historical service flow to the average response time; and when the service to be tested is a page service, the service index is the ratio of the number of transactions to the response time.
In some embodiments of the present description, different service types correspond to different service indicators. The service type comprises interface service and page service. When the service is an interface service, the service index is QPS (queries Per second), where QPS represents a query rate Per second and represents the number of queries that a query server can respond Per second. The query rate per second is used as a service index, which is a measure for measuring the processing flow of a specific query server within a specified time, and reflects the service pressure processing capacity of the server within the specified time. The service index query rate per second is the ratio of the concurrency number of the historical service flow to the average response time. The average response time is the response time of the historical service traffic concurrency number of the service server to be tested in the pressure test program. For example, if the 20 th concurrency number in the historical traffic is 10000, and the response time of the stress test server for processing the concurrency number at this time is 4 seconds, the query rate per second of the stress test server 102 in the stress test program of the page is 1000/4-2500.
When the service is a page service, the service index is TPS (transactions Per second), and TPS represents the number of transactions processed Per second. Wherein, a transaction refers to a process that a user sends a request to a server and the server reacts. The value of the transaction number per second (TPS) of the service index is the ratio of the transaction number per second of the historical service flow to the average response time. The TPS transaction number per second comprises the steps of requesting a server by a user, processing by the server and returning to a client by the server. And starting timing from the user sending request, and finishing timing after the server responds, thereby determining the response time of the TPS. For example, a user makes a request for a page service once to form a TPS, where a page request may include multiple requests to a server, that is: one TPS may comprise QPS. For example, when there are multiple static resources (e.g., pictures, videos, etc.) on a page, the server may log the user's request for these resources into the QPS.
As an embodiment herein, when the service to be tested is an interface service, the service index is calculated by the following formula:
QPS=P/T;
Figure BDA0003483290460000111
wherein P is the number of concurrencies, T is the average response time,
Figure BDA0003483290460000112
wherein n is the sampling frequency, alpha is the overtime probability of program processing, t is the program execution time, threads is the size of the service processing thread pool, queue is the size of the thread pool queue, Min represents the taking of a small function, SUM is the summation of integers 1 to n, and timeouts is the overtime of program processing. Wherein, P is the concurrency number of the historical service flow, T is the average response time of the service to be tested, and the average response time of a single machine is generally within the range of 200-. The overtime probability of the program processing is represented by the ratio of the probability of the program error and the probability of the program error, and can be acquired from the pressure test report in real time; t is program execution time, and when the number of threads is larger, the more time spent in thread scheduling is, the program execution time t is gradually increased; and n is the sampling times.
The average response time T comprises the sum of normal thread processing time, queuing time and overtime processing time. The pressure test server collects the concurrency number of n time points in a certain time, sums the response time of all the n time points and calculates an average value to obtain the average response time. For example, the stress test server tests the stress test of the commemorative coin reservation service within one hour, samples once a minute within 1 hour, samples 60 times in total, that is, n is 60, and calculates the average value after summing the response time of 60 sampling points, so as to obtain the average response time of the commemorative coin reservation service.
When the difference value between the concurrent number P and the concurrent thread number threads is greater than the thread queue number queue, a small function is taken through Min, and the queue time is determined by the thread queue number queue; and when the difference between the concurrent number P and the concurrent thread number threads is smaller than the thread queue number queue, acquiring a small function through Min, wherein the queue time is determined by the difference between the concurrent number P and the concurrent thread number threads.
In some embodiments of the present description, the calculation formula of the average response function may be modified by other variables, such as:
the average response formula is expressed, and the average response formula can also be determined by other services besides the parameters of the threads, queue and time accounts.
As an embodiment herein, the adjusting the service parameter value of the service to be tested includes: and adjusting at least one service parameter value of the service to be tested according to the service parameter adjustment step length and the service parameter adjustment sequence of the service to be tested.
In some embodiments of the present description, each time a parameter value of a business parameter is adjusted, a stress test is re-performed, in which the business index test value is re-calculated using the index model. Specifically, the parameter value of one or more service parameters may be adjusted according to the service parameter adjustment step length and the service parameter adjustment sequence of the service to be tested. In some embodiments of the present description, the parameter value of one or more service parameters is adjusted according to the service parameter adjustment step size of the service to be tested. The service parameter adjustment step length of the service to be tested can be understood as the minimum adjustment value of the service parameter adjusted at a single time. The adjustment step lengths of different service parameters may be different or the same, for example, the adjustment step length of the service parameter threads of the service to be tested is 10, the adjustment step length of the service parameter queues is 10, the adjustment step length of the connections is 1, and the like. In some embodiments of the present specification, the service parameter adjustment step size of the service to be tested may be preset and may be adjusted according to the actual pressure test condition.
In some other embodiments of the present specification, a service parameter value of at least one service to be tested is adjusted according to the service parameter adjustment sequence of the service to be tested. The business parameter adjusting sequence can be understood as the correlation between the business parameters and the pressure test result, and the business parameters with high correlation with the pressure test result can be adjusted preferentially when the adjusting sequence of the business parameters is earlier than the adjusting sequence of the business parameters; the business parameters with low correlation with the pressure test result can be adjusted in a common order after the adjustment order of the business parameters is later. For example, in the scenario of the electronic coupon claim pressure test, when the threads business parameter is adjusted first, the adjustment is started from the default value 200 of the threads, and the value of the business parameter threads is adjusted once by taking 10 as a step length, for example, the value of the threads business parameter may be adjusted to 210 to execute a second pressure test; adjust the values of the threads service parameters to 230 to perform a third stress test, etc. And after the business parameter value is adjusted each time, calculating the test value of the business index QPS in each pressure test by using a QPS model in the pressure test program. For example, after the initial pressure test is executed, the test value of the service index QPS calculated by using the QPS model is 800; after the second pressure test is executed, the test value of the service index QPS calculated by using the QPS model is 1000; and after the third pressure test is executed, the test value of the service index QPS calculated by using the QPS model is 1200.
In other embodiments of the present description, multiple values of the service parameter may be adjusted simultaneously. For example, in a commemorative coin reservation service scenario, two service parameter values of threads and queues are adjusted simultaneously. And after the business parameter value is adjusted each time, calculating the test value of the business index by using the index model, and calculating the test value of the business index QPS in each pressure test by using the QPS model.
Fig. 4 is a flowchart illustrating a method for adjusting a service parameter value according to an embodiment of the present disclosure.
Step 401, establishing an index model according to at least one service parameter to execute a pressure test, and using the index model to obtain a service index test value in the pressure test.
In some embodiments of the present specification, the service index test value of the service to be tested is a result obtained by obtaining the index model in the stress test. For example, as described above, if the service index of the pressure test of the interface service is the QPS query rate per second, the index model may be a QPS calculation model, and the service index test value of the pressure test is the calculation result of the QPS calculation model in the pressure test; and if the business index of the pressure test of the page business is TPS transaction number per second, the corresponding business index model is a TPS calculation model, and the business index test value of the pressure test is the calculation result of the TPS calculation model in the pressure test. In some embodiments, if one interface is stress tested and no other interfaces are requested inside the interface, the TPS is consistent with the QPS calculation model. In some embodiments of the present disclosure, the form of the index model may have other variations, which are not described herein.
In other embodiments of the present description, there may be some correlation between TPS and QPS in adjusting parameters. For example, a commercial product emergency purchase service scene generally includes page and interface services, a QPS index is generally used for performing a pressure test on the interface services, and a TPS index is generally used for performing a pressure test on the page services. The changes of the TPS and QPS indexes are generally in a direct proportion relationship, that is, the operation of adjusting the parameters to make the TPS index value larger may also make the QPS index value larger.
Step 402, determining whether the service index test value reaches the target value of the service index.
After each pressure test is executed, the service index test value of each time is compared with the target value of the service index, when the service index test value is equal to the target value of the service index, the service index test value can be determined to reach the target value of the service index, the current service parameter value is recorded and stored, and automatic parameter tuning is completed.
Step 403, when the service index test value does not reach the target value of the service index, adjusting the service parameter value of the service to be tested according to the service parameter adjustment step length and the service parameter adjustment sequence of the service to be tested.
After each pressure test, if the service index test value does not reach the target value of the service index, adjusting at least one service parameter value according to the service parameter adjustment step length and the service parameter adjustment sequence, using the adjusted service parameter value in the next pressure test program, using the index model to obtain a pressure test result, and continuously comparing the pressure test result with the target value of the service index. The business parameter adjustment sequence can be understood as the correlation between the business parameters and the pressure test result, and the correlation between at least one business parameter and the index model can be determined by an index model calculation formula; further, the correlation between the service parameter and the index model is determined by a calculation formula of average response time. As can be seen from the average response time formula, the business parameters threads, queue, and time are larger than the index model, wherein the correlation between threads and the index model is the largest, which means that the business parameters threads have the largest influence on the test result in the computing environment. Taking the wechat ETC application pressure test as an example, the automatic service flow parameter tuning system 101 first sets the target value of the service index of the pressure test program to be 500 TPS. Firstly, the parameter value of the service parameter threads is adjusted, and at the moment, the value of the TPS rises rapidly. When the values of the threads parameter reach 120, the TPS reaches 400, the change of the values of the threads is not greatly influenced by the value of the TPS by increasing the threads, and the value of the TPS does not rise any more. Meanwhile, the probability of overtime of the program rapidly rises and far exceeds 1%, and the value of the service parameter timeouts is adjusted at the moment, so that the value of the TPS reaches 500, and parameter tuning is realized.
Taking the e-coupon application pressure test as an example, the automatic service flow parameter tuning system 101 first sets the target value of the service index of the pressure test program to 2000 TPS. The threads parameter value is first adjusted, at which point the TPS rises rapidly. When the values of the threads parameter reach 1100, the TPS reaches about 1700, the change of the TPS is not greatly influenced by increasing the threads value, the CPU values of all machines reach 100 percent, and the TPS value does not rise any more. The analysis is due to the large number of thread schedules and switches that affect the time of program execution. And at the moment, the parameter value of the queues is adjusted, so that subsequent concurrency preferentially enters the queue to wait, the time overhead of the machine in thread scheduling is reduced, the TPS reaches an expected value, and parameter tuning is realized.
In some embodiments of the present description, the rule for adjusting the service parameter may be preset in the pressure test program by the automatic service flow parameter tuning system 101, or may be manually adjusted according to the actual condition of the pressure test.
In some further embodiments of the present description, a linear compression pressure test is included. In the pressure test program, the pressure test server gradually releases pressure to the service to be tested from zero, the test pressure is linearly increased along with the increase of time, meanwhile, whether the service response time of the pressure test server is close to linear change or not is observed, the maximum pressure value which can be accepted by the pressure test server is found, and protection is carried out in a production environment through current limiting and other modes. The pressure testing method of the present application is not limited to the content described herein, and other methods or variations are possible, and are not described herein.
Fig. 5 is a schematic structural diagram of an apparatus for automatically tuning parameters of service traffic in an embodiment of the present disclosure, and a basic structure of the apparatus for automatically tuning parameters of service traffic is described in this diagram, where functional units and modules may be implemented in a software manner, or may also be implemented in a general chip or a specific chip, and a part or all of the functional units and modules may be on a pressure test server, or a part of the functional units and modules may also be on an automatic tuning system of parameters of service traffic, and the parameters are automatically tuned through cooperation with the pressure test server, where the apparatus specifically includes:
a first determining unit 501, configured to determine, according to the recorded historical service traffic, a concurrency number and a concurrency interval time of the historical service traffic;
a second determining unit 502, configured to determine a service parameter value of a service to be tested and a target value of a service index;
a service index test value obtaining unit 503, configured to perform a pressure test on a service to be tested according to a service parameter value of the service to be tested, a concurrency number and a concurrency interval time of historical service traffic related to the service to be tested, so as to obtain a service index test value of the service to be tested;
a service parameter value adjusting unit 504, configured to compare the service index test value of the service to be tested with the target value of the service index of the service to be tested, and adjust the service parameter value of the service to be tested if the service index test value of the service to be tested does not reach the target value of the service index of the service to be tested;
a repeated execution unit 505, configured to repeatedly execute the pressure test process according to the adjusted service parameter value of the service to be tested until the service index test value of the service to be tested reaches the target value of the service index of the service to be tested.
As an embodiment herein, refer to a specific structural schematic diagram of an automatic parameter tuning device for service traffic in this embodiment as shown in fig. 6.
The first determining unit 501 is further configured to record historical service traffic and calculate throughput of the historical service traffic before determining the concurrency number and the concurrency interval time of the historical service traffic. As an embodiment herein, the first determining unit 501 further includes:
the recording module 5011 is used for recording historical service flow;
the calculating module 5012 is configured to calculate the throughput of the historical traffic.
As an embodiment herein, the second determining unit 502 further includes:
a service parameter value adjusting module 5021, configured to determine a rule for adjusting a service parameter value each time.
As an embodiment herein, the service index test value obtaining unit 503 further includes a stress test executing module 5031, configured to execute a stress test on the service to be tested according to the service parameter value.
As an embodiment herein, the service parameter value adjusting unit 504 further includes a comparing module 5041, configured to compare the service index test value of the service to be tested with the target value of the service index of the service to be tested.
The automatic parameter tuning device for the service flow combines the flow recording and playback technology, the automatic pressure testing technology and the automatic parameter adjusting technology of a production environment for use, simulates the real service flow trend through flow recording and playback, further automatically adjusts the Dubbo frame parameters, quickly assists the micro-service on-line production, reduces the performance parameter tuning threshold of the micro-service, and improves the software testing execution efficiency and the working efficiency of testing personnel.
As shown in fig. 7, for a computer device provided for embodiments herein, the computer device 702 may include one or more processors 704, such as one or more Central Processing Units (CPUs), each of which may implement one or more hardware threads. The computer device 702 may also include any memory 706 for storing any kind of information, such as code, settings, data, etc. For example, and without limitation, the memory 706 can include any one or more of the following in combination: any type of RAM, any type of ROM, flash memory devices, hard disks, optical disks, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent fixed or removable components of computer device 702. In one case, when the processor 704 executes associated instructions that are stored in any memory or combination of memories, the computer device 702 can perform any of the operations of the associated instructions. The computer device 702 also includes one or more drive mechanisms 708, such as a hard disk drive mechanism, an optical disk drive mechanism, or the like, for interacting with any memory.
Computer device 702 can also include an input/output module 710(I/O) for receiving various inputs (via input device 712) and for providing various outputs (via output device 714)). One particular output mechanism may include a presentation device 716 and an associated Graphical User Interface (GUI) 718. In other embodiments, input/output module 710(I/O), input device 712, and output device 714 may also not be included, as only one computer device in a network. Computer device 702 can also include one or more network interfaces 720 for exchanging data with other devices via one or more communication links 722. One or more communication buses 724 couple the above-described components together.
Communication link 722 may be implemented in any manner, such as over a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. Communication link 722 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
Corresponding to the methods in fig. 2-4, the embodiments herein also provide a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, performs the steps of the above-described method.
Embodiments herein also provide computer readable instructions, wherein when executed by a processor, a program thereof causes the processor to perform the method as shown in fig. 2-4.
It should be understood that, in various embodiments herein, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments herein.
It should also be understood that, in the embodiments herein, the term "and/or" is only one kind of association relation describing an associated object, meaning that three kinds of relations may exist. For example, a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided herein, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments herein.
In addition, functional units in the embodiments herein may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present invention may be implemented in a form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The principles and embodiments of this document are explained herein using specific examples, which are presented only to aid in understanding the methods and their core concepts; meanwhile, for the general technical personnel in the field, according to the idea of this document, there may be changes in the concrete implementation and the application scope, in summary, this description should not be understood as the limitation of this document.

Claims (10)

1. A method for automatically tuning parameters of service traffic is characterized in that the method comprises the following steps:
determining the concurrency number and concurrency interval time of the historical service flow according to the recorded historical service flow;
determining a service parameter value of a service to be tested and a target value of a service index;
performing a pressure test on the service to be tested according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service flow related to the service to be tested, and obtaining a service index test value of the service to be tested;
comparing the service index test value of the service to be tested with the target value of the service index of the service to be tested, and if the service index test value of the service to be tested does not reach the target value of the service index of the service to be tested, adjusting the service parameter value of the service to be tested;
and according to the service parameter value adjusted by the service to be tested, repeatedly executing the pressure test process until the service index test value of the service to be tested reaches the target value of the service index of the service to be tested.
2. The method for automatically tuning parameters of service traffic according to claim 1, wherein the determining the concurrency number and the concurrency interval time of the historical service traffic according to the recorded historical service traffic comprises:
calculating the throughput of the historical service flow according to the recorded historical service flow;
according to the product of time and the throughput, calculating the concurrency number of the historical service flow;
and determining the concurrency interval time according to the change condition of the historical service flow at different moments.
3. The method for automatically tuning parameters of service traffic according to claim 1, wherein the performing a stress test on the service to be tested according to the service parameter value of the service to be tested, the concurrency number and the concurrency interval time of the historical service traffic related to the service to be tested comprises:
sending the concurrency number and the concurrency interval time of the historical service flow to a pressure test program of the service to be tested;
executing the stress test in the stress test program according to the concurrency number, the concurrency interval time and at least one service parameter of the historical service flow, wherein the service parameter at least comprises: number of concurrent threads, number of I/O threads, number of thread queues, maximum number of links, timeout time.
4. The method for automatically tuning parameters of service traffic according to claim 3, wherein an index model is arranged in the pressure test program of the service to be tested, and the index model is established according to the service parameter value of the service to be tested, and is used for obtaining the service index test value in the pressure test.
5. The method for automatically tuning parameters of service traffic according to claim 1, wherein when the service to be tested is an interface service, the service indicator is a ratio of a concurrency number of a historical service traffic to an average response time; and when the service to be tested is a page service, the service index is the ratio of the number of transactions to the response time.
6. The method for automatically tuning parameters of service traffic according to claim 5, wherein when the service to be tested is an interface service, the service indicator is calculated according to the following formula:
QPS=P/T;
Figure FDA0003483290450000021
wherein P is the number of concurrencies, T is the average response time,
Figure FDA0003483290450000022
wherein n is the sampling frequency, alpha is the overtime probability of program processing, t is the program execution time, threads is the size of the service processing thread pool, queue is the size of the thread pool queue, Min represents the taking of a small function, SUM is the summation of integers 1 to n, and timeouts is the overtime of program processing.
7. The method for automatically tuning parameters of traffic flow according to claim 1, wherein said adjusting the values of the traffic parameters of the traffic to be tested comprises:
and adjusting at least one service parameter value of the service to be tested according to the service parameter adjustment step length and the service parameter adjustment sequence of the service to be tested.
8. An apparatus for automatically tuning parameters of service traffic, the apparatus comprising:
the first determining unit is used for determining the concurrency number and the concurrency interval time of the historical service flow according to the recorded historical service flow;
the second determining unit is used for determining the service parameter value of the service to be tested and the target value of the service index;
a service index test value obtaining unit, configured to perform a pressure test on a service to be tested according to a service parameter value of the service to be tested, a concurrency number and a concurrency interval time of historical service traffic related to the service to be tested, so as to obtain a service index test value of the service to be tested;
a service parameter value adjusting unit, configured to compare the service index test value of the service to be tested with the target value of the service index of the service to be tested, and adjust the service parameter value of the service to be tested if the service index test value of the service to be tested does not reach the target value of the service index of the service to be tested;
and the repeated execution unit is used for repeatedly executing the pressure test process according to the adjusted service parameter value of the service to be tested until the service index test value of the service to be tested reaches the target value of the service index of the service to be tested.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for automatically tuning parameters of a traffic flow according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which when executed by a processor implements the method for automatically tuning parameters of traffic flow according to any one of claims 1 to 7.
CN202210074332.9A 2021-09-28 2022-01-21 Method and device for automatically adjusting and optimizing parameters of service flow Pending CN114218123A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111142637 2021-09-28
CN2021111426370 2021-09-28

Publications (1)

Publication Number Publication Date
CN114218123A true CN114218123A (en) 2022-03-22

Family

ID=80708624

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210074332.9A Pending CN114218123A (en) 2021-09-28 2022-01-21 Method and device for automatically adjusting and optimizing parameters of service flow

Country Status (1)

Country Link
CN (1) CN114218123A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033495A (en) * 2022-08-02 2022-09-09 荣耀终端有限公司 Pressure measurement model creating method and electronic equipment
CN117033153A (en) * 2023-08-14 2023-11-10 北京达美盛软件股份有限公司 Python-based automatic test method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033495A (en) * 2022-08-02 2022-09-09 荣耀终端有限公司 Pressure measurement model creating method and electronic equipment
CN115033495B (en) * 2022-08-02 2022-12-20 荣耀终端有限公司 Pressure measurement model creating method and electronic equipment
CN117033153A (en) * 2023-08-14 2023-11-10 北京达美盛软件股份有限公司 Python-based automatic test method and system
CN117033153B (en) * 2023-08-14 2024-05-07 北京达美盛软件股份有限公司 Python-based automatic test method and system

Similar Documents

Publication Publication Date Title
CN114218123A (en) Method and device for automatically adjusting and optimizing parameters of service flow
US7058843B2 (en) Method and apparatus for computer network analysis
US9223622B2 (en) Capacity planning of multi-tiered applications from application logs
CN101576844A (en) Method and system for testing software system performances
US8224624B2 (en) Using application performance signatures for characterizing application updates
US6086618A (en) Method and computer program product for estimating total resource usage requirements of a server application in a hypothetical user configuration
CN109165153B (en) Performance test method of high-simulation securities trade system
CN110532168B (en) Full-link interface pressure measurement method and device, computer equipment and storage medium
US8606905B1 (en) Automated determination of system scalability and scalability constraint factors
US10411969B2 (en) Backend resource costs for online service offerings
WO2020000726A1 (en) Performance test report generating method, electronic device, and readable storage medium
US20050107997A1 (en) System and method for resource usage estimation
Mi et al. Analysis of application performance and its change via representative application signatures
CN114706827A (en) Automatic generation method and device for transaction link topology
US20080244583A1 (en) Conflicting sub-process identification method, apparatus and computer program
CN116594887A (en) CFD software-based automatic test method and system
US8881156B2 (en) Apportioning summarized metrics based on unsummarized metrics in a computing system
WO2021223214A1 (en) Interface performance test method and apparatus, and server and computer-readable storage medium
CN113298622A (en) Method and system for processing e-commerce business orders based on machine learning
CN113051135A (en) Application thread pool monitoring method and thread pool monitoring device
US9633061B2 (en) Methods for determining event counts based on time-sampled data
WO2015161616A1 (en) Method and device for collecting data, and method and device for testing capacity of system
CN114201398A (en) Interface performance analysis method, device, equipment and storage medium
WO2024066770A1 (en) Information acquisition method and apparatus, and storage medium
JP2005085086A (en) Server performance measurement system

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