CN113434402A - Performance analysis method, device and equipment for micro-service application - Google Patents

Performance analysis method, device and equipment for micro-service application Download PDF

Info

Publication number
CN113434402A
CN113434402A CN202110704862.2A CN202110704862A CN113434402A CN 113434402 A CN113434402 A CN 113434402A CN 202110704862 A CN202110704862 A CN 202110704862A CN 113434402 A CN113434402 A CN 113434402A
Authority
CN
China
Prior art keywords
performance
stack information
performance analysis
target
command
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
CN202110704862.2A
Other languages
Chinese (zh)
Inventor
张学舟
黄玺磊
夏雯君
谷俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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
Priority to CN202110704862.2A priority Critical patent/CN113434402A/en
Publication of CN113434402A publication Critical patent/CN113434402A/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/3604Software analysis for verifying properties of programs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the specification provides a method, a device and equipment for analyzing the performance of micro-service application, and can be used in the technical field of cloud computing. The method comprises the steps that method stack information of each target component needing performance analysis in the micro-service application is obtained according to a performance analysis command; the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process; aggregating the method stack information of all target assemblies in operation to obtain performance analysis results of all target assemblies; generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generation logic when each target component runs; and obtaining a performance analysis result of the micro-service application according to the performance analysis results of all the target components and the flame diagram corresponding to each target component. By utilizing the embodiment of the specification, the efficiency of checking the performance problem can be improved, and a direction is provided for performance optimization.

Description

Performance analysis method, device and equipment for micro-service application
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a method, an apparatus, and a device for analyzing performance of a micro-service application.
Background
With the continuous evolution of micro-service architecture, the number of applications and servers based on micro-service architecture is increasing and the calling relationship is more complicated in enterprises. Efficient performance profiling of core micro-service architecture applications becomes important.
In the prior art, the performance of micro-service architecture application is mainly analyzed in two ways. The first is to record whether the key service operation is executed or not and the time consumed for execution by embedding the log in the service code in advance, and this way has a great uncertainty in the occurrence point of the performance fault, and the position of the embedded log is likely not matched with the root of the performance fault, so that the log needs to be embedded again and the system needs to be brought online again, thereby reducing the efficiency of troubleshooting the performance fault. The second method is to modify the service code by bytecode enhancement technology to reflect the time-consuming execution of the operation, which usually needs to inject code into all methods in a package, which not only causes performance loss to the application, but also may cause system crash due to too many injection points, thereby reducing the efficiency of troubleshooting the performance problem.
Therefore, there is a need for a solution to the above technical problems.
Disclosure of Invention
The embodiment of the specification provides a method, a device and equipment for analyzing the performance of micro-service application, which can improve the efficiency of troubleshooting of performance problems and provide a direction for performance optimization.
The method, the device and the equipment for analyzing the performance of the micro-service application are realized in the following modes.
A performance profiling method of a micro-service application comprises the following steps: acquiring method stack information of each target component needing performance analysis in the micro-service application during operation according to a performance analysis command; each process of each component is provided with a performance analysis plug-in, and the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process; aggregating the method stack information of all target assemblies in operation to obtain performance analysis results of all target assemblies; the performance analysis result comprises a statistical result of execution methods meeting preset conditions in all target assemblies; generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generation logic when each target component runs; wherein the flame map includes information of a method performed during operation of the target component; and obtaining a performance analysis result of the micro-service application according to the performance analysis results of all target components and the flame diagram corresponding to each target component.
A performance profiling apparatus of a microservice application, comprising: the acquisition module is used for acquiring method stack information of each target component which needs performance analysis in the micro-service application when the target component runs according to a performance analysis command; each process of each component is provided with a performance analysis plug-in, and the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process; the aggregation module is used for aggregating the method stack information of all the target assemblies during operation to obtain the performance analysis results of all the target assemblies; the performance analysis result comprises a statistical result of execution methods meeting preset conditions in all target assemblies; the generating module is used for generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generating logic when each target component runs; wherein the flame map includes information of a method performed during operation of the target component; and the obtaining module is used for obtaining the performance analysis result of the micro-service application according to the performance analysis results of all the target components and the flame diagram corresponding to each target component.
A performance profiling apparatus for micro-service applications, comprising at least one processor and a memory storing computer executable instructions, which when executed by the processor, implement the steps of any one of the method embodiments of the present specification.
A computer readable storage medium having stored thereon computer instructions which, when executed, implement the steps of any one of the method embodiments in the present specification.
The specification provides a method, a device and equipment for analyzing the performance of a micro-service application. In some embodiments, the Java Agent technology is adopted, so that method stack information of application operation can be collected in real time under the condition of not invading application codes, aggregation operation is continuously performed, a performance analysis report accurate to a code line level is obtained, and performance hotspots of the application are vividly displayed in a visual mode based on the flame diagram technology, so that the efficiency of troubleshooting of performance problems can be remarkably improved, and an effective direction is provided for performance optimization of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, are incorporated in and constitute a part of this specification, and are not intended to limit the specification. In the drawings:
FIG. 1 is a schematic flow chart diagram illustrating one embodiment of a method for profiling performance of a microservice application provided herein;
FIG. 2 is a schematic diagram of a performance profiling command distributor provided in the present specification;
FIG. 3 is a simplified schematic diagram of a flame diagram provided herein;
FIG. 4 is a block diagram of an embodiment of a performance analysis apparatus for a microservice application provided in the present specification;
FIG. 5 is a block diagram of an embodiment of a performance profiling system for a microservice application provided by the present specification;
FIG. 6 is a block diagram of the hardware architecture of one embodiment of a performance profiling server for a microservice application provided by the present specification.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments in the present specification, and not all of the embodiments. All other embodiments that can be obtained by a person skilled in the art based on one or more embodiments of the present disclosure without making any creative effort shall fall within the protection scope of the embodiments of the present disclosure.
The following describes an embodiment of the present disclosure with a specific application scenario as an example. Specifically, fig. 1 is a flowchart illustrating an embodiment of a performance profiling method for a micro service application provided in this specification. Although the present specification provides the method steps or apparatus structures as shown in the following examples or figures, more or less steps or modules may be included in the method or apparatus structures based on conventional or non-inventive efforts.
One embodiment provided by the present specification can be applied to a client, a server, and the like. The client may include a terminal device, such as a smart phone, a tablet computer, and the like. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed system, and the like.
It should be noted that the following description of the embodiments does not limit the technical solutions in other extensible application scenarios based on the present specification. In an embodiment of a method for profiling performance of a microservice application, as shown in fig. 1, the method may include the following steps.
S0: acquiring method stack information of each target component needing performance analysis in the micro-service application during operation according to a performance analysis command; and each process of each component is provided with a performance profiling plug-in, and the performance profiling command is used for indicating the performance profiling plug-in to collect and upload method stack information of a corresponding process.
The micro-service application adopts a micro-service architecture to build a core service system. The micro-service architecture is to disassemble a traditional single application into a plurality of small service processes which can be independently deployed by taking a business class as a boundary, and the processes are interacted through a lightweight communication protocol. The performance profiling command may be issued by a user logging in to the user console, or may be issued in other ways. For example, a user may log into a user console to issue performance profiling commands, thereby specifying performance profiling to be performed on several components of a microservice application. The performance profiling command may include an identification of the components of the microservice application that need to be performance profiled. In this way, it may be determined from the component identifications which components to develop the performance profiling for the microservice application. The user console is a main interface for analyzing the performance of the micro-service application by a user, can issue a performance analyzing command, and observes the statistical result of the most frequently executed method and the flame diagram of the executing process of the corresponding component to locate the root cause of the performance problem and find the performance point which can be optimized.
The performance profiling plug-in exists in the application process in the form of a Java Agent, and provides performance profiling logic which can run simultaneously with the business logic of the application. In each process of all components of the micro service application, a performance profiling plug-in is installed for collecting method stack information of the process. The performance profiling plug-in adopts Java Agent technology, and allows a plurality of threads for performance profiling service to be loaded in a background before the business logic of the application is started, wherein the threads can exist continuously when the business logic is operated. In some implementations, the performance profiling plug-in is deployed in the form of a separate jar package, which may be separate from the jar package of the application. The execution of the performance profiling logic can be triggered by adding a Java agent: xxx. jar option to the application's Java start command, where xxx. jar represents the path of the performance profiling plug-in.
In some implementation scenarios, before obtaining, according to the performance profiling command, method stack information of each target component runtime that needs to be subjected to performance profiling in the micro-service application, the method stack information may include: receiving a performance profiling command; storing the performance profiling command to a performance profiling command distributor; the performance profiling command distributor at least comprises a load balancing unit, a command reading and writing unit and a command storage database; the load balancing unit is used for sending an access request sent by the performance analysis plug-in to the command reading and writing unit; the command reading and writing unit is used for storing the performance analysis command into the command database and reading the performance analysis command and returning the performance analysis command to the performance analysis plug-in; the command storage database is used for storing performance profiling commands. The performance profiling command distributor can be used for storing and distributing performance profiling commands which are newly issued by users, and is a key linking device between a user console and a performance profiling plug-in.
In some implementations, the performance profile command issued by the user may be stored internally by the performance profile command distributor.
In order to better understand the working process of the performance profile command distributor, the following describes a schematic structural diagram of the performance profile command distributor with reference to fig. 2. As shown in fig. 2, the performance profiling command distributor may include a load balancing unit 201, a command read-write unit 202, and a command storage database 203. The command storage database 203 may be configured to store a performance analysis command that is newly issued by a user, and may implement performance analysis on application processes in different ranges of granularity by presetting configuration rules, so as to adapt to various scene requirements in a performance inspection process.
Specifically, a performance profiling command table may be maintained in the command storage database 203, where the performance profiling command table may include four fields, namely, an application name, a component name, an instance number, a class, and a method blacklist, where the first three fields are used to indicate a hierarchical relationship from high to low, and the range of action of the performance profiling command may be adjusted by setting field values of these fields.
For example, in practical applications, the corresponding scope may be adjusted by setting field values to "-" and not. Accordingly, there may be four different configurations:
(1) if the application name, the component name and the instance number are all not: indicating that the performance of a particular process under a component in a microservice application is profiled with a minimum granularity of command action. Such as: "application A, component C, 12" means that only the process with instance number 12 under component C in application A is performance profiled.
(2) If the application name and the component name are not, the example number is: indicating that a performance profile is performed for all processes under a certain component in a certain microservice application. Such as: "application a, component C" means that the performance profiling is performed on all processes under component C in application a.
(3) If the application name is not, the component name and the instance number are all: indicating that performance profiling is performed on all processes in a certain microservice application. Such as: "application a,", indicates that performance profiling is performed on all processes in application a.
(4) If the application name, the component name and the instance number are all: the performance analysis is performed on all application processes accessing to the platform, and the action granularity of the command is the largest. Such as: "*,*,*".
Each process in the actual application can have a corresponding application name, component name and instance number sequence for distinguishing from each other, and each performance profiling plug-in can obtain all performance profiling commands matched with the process to which the plug-in belongs. Such as: for the process identified by "application a, component C, 12", the 4 performance profiling commands in examples (1) - (4) above all match it.
The command read/write unit 202 may be configured to store the performance profiling command issued by the user in a command database, and read the performance profiling command and return the performance profiling command to each performance profiling plug-in. In some implementation scenarios, in order to deal with frequent access requests of a large number of performance profiling plug-ins, a horizontal extension mode may be adopted to mount the multiple command read-write units 202 under the load balancing unit 201, so as to implement corresponding external services.
The load balancing unit 201 may be configured to uniformly distribute, based on the load of each command read/write unit 202, the access request issued by the performance profiling plug-in to each command read/write unit 202 for processing, so as to avoid a large load of a single command read/write unit 202.
In some implementation scenarios, the performance profiling commands issued by the user may be passed to each performance profiling plug-in the target component in the microservice application after being internally stored via the performance profiling command distributor. Wherein, the target component may refer to a component in the micro service application that needs to be subjected to performance profiling.
In some implementation scenarios, the performance profiling plug-in may periodically obtain, from the performance profiling command distributor, a set of components that need to be profiled currently, and if the component in which the component belongs to the set, it indicates that performance profiling needs to be performed on the process, and then the performance profiling plug-in may collect method stack information when the process is running.
In some implementation scenarios, the collecting, by the performance profiling plug-in, method stack information of the corresponding process may include: acquiring and analyzing a performance analysis command corresponding to a target process, and determining a blacklist of classes and methods needing to be filtered; based on the determined class and method blacklist, acquiring method stack snapshot information of all current threads of the target process; and processing the snapshot information of each method stack as row information to obtain the stack information of each method. The method stack information may be used to indicate the running condition of the corresponding process. In some implementation scenarios, the method stack information may include at least a thread name, thread state information, and a method list. In particular, the method stack for each thread may consist of a thread name, several states of the thread, and a series of stacked method lists. The method list can show the detailed track of the method running of the thread, can be accurate to specific class names, method names and code line numbers, and comprises information of application service method calling, bottom layer JDK (Java Development kit) method calling and third-party framework calling. The method list can also represent the calling relationship among the methods, the bottommost method is the source of the calling link, and the topmost method is the tail end of the calling link. By analyzing the method stack snapshots of all threads currently executed by a process, useful information reflecting the running condition of the process can be obtained.
For example, in some implementation scenarios, the performance profiling plug-in may periodically access the performance profiling command distributor, obtain all performance profiling commands matching the process to which it belongs, then determine whether performance profiling is needed, and if the process belongs to the set of components that need performance profiling, start running the performance profiling logic. Further, the obtained multiple performance profiling commands can be analyzed, all classes in the commands and the blacklist of methods are combined into a list, and then the method stack snapshot information of all current threads of the process can be obtained through the management interface ThreadMXBean of the JDK. Further, in order to facilitate analysis processing by the streaming computing engine and search, intercept and store based on rows, the stack snapshot information of each method may be folded into a row to obtain the stack information of each method. The streaming computation engine may continuously obtain data from the distributed message queue (i.e., "streaming read"), run a batch (e.g., minute-level batch, second-level batch, etc.) to compute statistics of the most frequently executed methods of all target components in a microservice application within a preset time (e.g., within the last minute, the first three minutes, etc.), and store the statistics in the performance analysis result database. The performance analysis result database may be used to store an index (e.g., a minute-level index) of the operation performance of all target components in a microservice application, i.e., a statistical result of the methods (e.g., Top20 execution method, Top5 execution method, etc.) executed most frequently within a preset time (e.g., within one minute, within three minutes), which may be implemented using a distributed database.
In some implementation scenarios, after the performance profiling plug-in collects method stack information of the corresponding process, the method stack information may further include: assembling the state information of the target process and the stack information of each method to obtain the method stack information in the json form; and storing the json-form method stack information into a memory queue.
For example, in some implementation scenarios, after all operations of the performance profiling logic are completed, all state information of the process and each method stack information may be combined into a json-type variable, and then stored in a queue in the memory, so as to implement decoupling of the two processes of collecting and uploading method stack information. The state information of the target process may include an application name, a component name, an instance number, a timestamp, a machine name, and the like. json (JavaScript Object Notation) is a lightweight data exchange format.
In some implementation scenarios, after each collection of the method stack information, a preset time, such as 0.1 second, may be waited, so that it may be ensured that the influence of collecting the method stack information at the frequency on the performance of the application process is within an acceptable range, and at the same time, the trajectory of the process execution is obtained as completely as possible.
In some implementations, the performance profiling plug-in may also asynchronously upload to the distributed message queue after collecting method stack information at process runtime. The distributed message queue has the characteristics of distributed deployment, multiple partitions, multiple copies, sequential reading and writing and the like, can realize high-speed reliable storage of massive method stack information uploaded by each performance analysis plug-in, and can supply data to a downstream streaming computing engine for processing.
In some implementation scenarios, after storing the json-form method stack information in the memory queue, the method may further include: extracting a preset number of json-form method stack information from the memory queue; carrying out serialization conversion on method stack information in json forms with preset quantity to obtain serialized json data; and uploading the serialized json data to a distributed message queue in batch.
In some implementation scenarios, in order to implement efficient method stack information uploading, N json-form method stack information may be taken out of a memory queue at one time, then the N json-form method stack information is subjected to serialization conversion, and finally the serialized N json-form method stack information is uploaded to a distributed message queue in a batch manner at one time, so that the efficiency of data uploading is improved.
In some implementation scenarios, after the batch uploading of the serialized json data to the distributed message queue, the method may further include: under the condition that the memory queue does not include json-form method stack information, after waiting for preset time, taking out a preset number of json-form method stack information from the memory queue; correspondingly, performing serialization conversion on the preset number of json-form method stack information to obtain serialized json data; and uploading the serialized json data to a distributed message queue in batch.
In some implementation scenarios, after serialized json data is uploaded to a distributed message queue in batch, it may be determined whether json-form method stack information still exists in a memory queue, if yes, N json-form method stack information may be continuously fetched from the memory queue at one time, then the N json-form method stack information is serialized, and finally the serialized N json-form method stack information is uploaded to the distributed message queue at one time in batch. In some implementation scenarios, after serialized json data is uploaded to a distributed message queue in batch, it is determined that there is no json-form method stack information in a memory queue, and then N json-form method stack information may be taken out of the memory queue at one time after a preset time is waited, for example, 1 second, then serialization conversion is performed on the N json-form method stack information, and finally the serialized N json-form method stack information is uploaded to the distributed message queue at one time in batch.
In the embodiment of the present specification, by obtaining method stack information of each target component runtime that needs to be subjected to performance profiling in the micro service application according to the performance profiling command, a basis can be provided for subsequently obtaining a performance profiling result of the micro service application.
According to the embodiment of the specification, the reason of the problem can be quickly positioned when the performance fault occurs in the application system through performance analysis, and the stable operation of the service is guaranteed. Meanwhile, performance hotspots of the application system can be found, a direction is provided for performance optimization, system operation efficiency is improved, and enterprise operation cost is reduced. In addition, after the version is updated seriously, the performance conditions before and after updating can be compared, and the additional potential performance hazard caused by version updating is prevented.
S2: aggregating the method stack information of all target assemblies in operation to obtain performance analysis results of all target assemblies; and the performance analysis result comprises the statistical result of the execution methods meeting the preset conditions in all the target assemblies.
In this embodiment of the present description, after obtaining the method stack information of each target component during running, aggregation processing may be performed on the method stack information of all target components during running, so as to obtain performance analysis results of all target components. The performance analysis result may include a statistical result of the execution methods satisfying the preset condition in all the target components. The preset condition may include a statistical result of the most frequently executed method among all target components within a preset time. The preset time can be set according to an actual scene, and the specification does not limit the preset time. For example, the preset condition may be a statistical result of the most frequently executed method among all target components in the last minute. An execution method may also be referred to as a method.
In some implementation scenarios, the aggregating the method stack information of all target components during runtime to obtain the performance analysis results of all target components may include: acquiring method stack information of all target components in operation within preset time from a distributed message queue; and running a timing batch operation logic based on the method stack information of all target assemblies in running within the preset time to obtain the performance analysis results of all the target assemblies. The preset time may be set according to an actual scene, and may be, for example, one minute, two minutes, and the like, which is not limited in this specification.
In some implementations, the timing batch of operational logic may be customized in the streaming compute engine after a user issues a performance profiling command. Wherein the timed batch of arithmetic logic may be executed once per fixed time (e.g., every minute). Specifically, the timed batch arithmetic logic may continuously obtain data within a fixed time (e.g., the last minute) from the distributed message queue, perform aggregation calculation, obtain a statistical result of the most frequently executed method in all target components within the fixed time (e.g., the last minute), and finally store the statistical result in the performance analysis result database.
S4: generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generation logic when each target component runs; wherein the flame map includes information of a method performed during operation of the target component.
In this embodiment, after obtaining the performance analysis results of all target components, a flame map corresponding to each target component may be generated based on the method stack information and the flame map generation logic when each target component runs. Wherein the flame map may include information of a method performed during operation of the target component. The flame diagram is a tool for visualizing the method stack invented by Bredan Greg. In the flame diagram, each square can represent a method, and the length of the square can represent the execution time of the method, i.e. the longer the square indicates the longer the execution time of the method. Corresponding to the method stack information, the method corresponding to the lower layer square grid and the upper layer square grid in the flame diagram is called by the method corresponding to the lower layer square grid, the method corresponding to the lowest layer square grid is the source of a thread execution track, and the method corresponding to the top layer square grid is the tail end of the thread execution track. Therefore, the flame diagram can represent a specific calling relationship and existing hot spots in the component execution process, namely, the method corresponding to the square with the longest top layer is the method occupying the longest CPU time, and represents the root of a certain performance problem and the position needing to be preferentially adjusted. As shown in fig. 3, fig. 3 is a simplified schematic diagram of a flame diagram provided in this specification, where methods a (), b (), c (), d (), e (), f (), g (), and h (), and method f () occupies the longest CPU time and requires the user to pay attention.
In some implementations, the generation batch logic of the flame map may be customized in the visualization generation engine after the user issues the performance profiling command. And the generation batch logic of the flame diagrams can pull all method stack information meeting the conditions, and inputs the method stack information into a visual generation engine to generate the flame diagrams after content filtering. The visualization generation engine can be used for aggregating target component method stack information in a specified time range to generate a flame diagram, and further displaying all hot spot methods in the operation process of the target component.
In some implementation scenarios, the generating a flame map corresponding to each target component based on the method stack information and the flame map generation logic of each target component during runtime may include: receiving and analyzing a flame diagram generation command to obtain flame diagram information; the flame map information includes a corresponding application name, component name, and time range; screening out method stack information of the target component in the time range according to the flame diagram information; analyzing each method stack information, deleting the frame calling information in each method stack information, and obtaining a temporary file corresponding to each method stack information; calling a flame diagram generation script tool based on temporary files corresponding to all the method stack information to generate a flame diagram corresponding to each target assembly; wherein the flame diagram generation scripting tool includes flame diagram generation logic.
In some implementations, upon receiving the flame map generation command, the flame map generation command may be forwarded to a visualization generation engine for processing. In some implementations, the visualization generation engine may parse the flame map generation command after receiving the flame map generation command to obtain the flame map information. The flame map information may include, among other things, a corresponding target application name, a component name, and a time range.
In some implementation scenarios, after obtaining the flame diagram information, all raw data files of the method stack in a specific time period may be obtained from the target application name, the component name, and the time range parsed from the command to the component method stack repository, and pulled to the local for subsequent processing. The component method stack repository may be configured to store raw data (i.e., method stack information) of a method stack when all target components in a microservice application run, and store the raw data in different directories and files according to an application name, a component name, and a time range (e.g., minutes), and may be implemented using a distributed file system.
Because each row of data is a folded complete method stack, according to the characteristics of application, a large amount of repeated information called by a third-party framework may exist in the method stack, so in some implementation scenarios, the content of each data file can be read according to rows, and then a specific framework calling part related to each row of method stack is filtered out according to requirements, so as to obtain a corresponding temporary file. Therefore, by removing repeated information called by a third-party framework in the method stack, the method stacks in the flame diagram can be more concentrated, and the performance problem and the point to be optimized can be more clearly seen.
In some implementation scenarios, after the temporary file corresponding to each method stack information is obtained, all the temporary files can be used as data parameters of the flame diagram generation script, and a flame diagram generation script tool is called to obtain a picture file in an SVG format. Wherein, the picture file in the SVG format can represent the flame diagram corresponding to the target component. The picture file in the SVG format is an interactive file, a packet name and a method name can be input into a search box at the upper right of the file for retrieval, and a corresponding complete class name and a corresponding method name can be displayed when a mouse is slid to a specified square.
S6: and obtaining a performance analysis result of the micro-service application according to the performance analysis results of all target components and the flame diagram corresponding to each target component.
In this embodiment, after the flame map corresponding to each target component is generated, a performance analysis result of the microservice application may be obtained according to the performance analysis results of all the target components and the flame map corresponding to each target component.
In some implementation scenarios, after the flame map corresponding to each target component is generated, the performance analysis results of all target components and the flame map corresponding to each target component may be returned to the user console for the user to perform the hot spot analysis.
In some implementation scenarios, after the performance analysis result and the flame map are returned to the user console, the statistical result and the flame map reflecting the most frequently executed method in all target components can be displayed on the user console, and then useful information (i.e., a performance analysis result of the micro-service application) on which methods the CPU time is spent by the corresponding component can be obtained according to the display result, thereby helping to locate the root cause of the performance problem and providing a valuable performance optimization point.
In the embodiment of the specification, after the flame diagram of the corresponding component is displayed on the user console, whether a method for obviously occupying the CPU for a long time exists can be intuitively and quickly determined by comparing the lengths of all the blocks in the diagram, so that potential performance hotspots can be conveniently found, and a basis and a direction are provided for performance troubleshooting and performance tuning.
In the embodiment of the specification, after a performance analysis command is sent, through a series of processes such as method stack information collection, data uploading, aggregation calculation and the like, a statistical analysis report and a flame diagram reflecting the most frequently executed method in all target assemblies can be displayed on a user console after a preset time, so that useful information of methods for which corresponding assemblies spend CPU time is intuitively and quickly determined, the root cause of a performance problem is positioned, and a valuable performance optimization point is provided.
In the embodiment of the description, the root cause and the hot spot of the performance fault can be determined by regularly observing the details of the stack of the application method under the condition that the application is not shut down, so that the efficiency of troubleshooting the performance problem can be improved, and a direction is provided for performance optimization. In addition, the method has the advantages that the performance loss caused by the application is extremely low, the performance loss can be completely eliminated after the analysis is finished, and the negative influence on the application is avoided.
It is to be understood that the foregoing is only exemplary, and the embodiments of the present disclosure are not limited to the above examples, and other modifications may be made by those skilled in the art within the spirit of the present disclosure, and the scope of the present disclosure is intended to be covered by the claims as long as the functions and effects achieved by the embodiments are the same as or similar to the present disclosure.
From the above description, it can be seen that, by using the Java Agent technology in the embodiment of the present application, method stack information of application operation can be collected in real time without intruding an application code, aggregation operation is continuously performed, a performance analysis report accurate to a code line level is obtained, and a performance hotspot of the application is vividly presented in a visual manner based on a flame diagram technology, so that the troubleshooting efficiency of a performance problem can be significantly improved, and an effective direction is provided for performance optimization of the application.
In the present specification, each embodiment of the method is described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from other embodiments. Reference is made to the description of the method embodiments.
Based on the performance profiling method for the micro-service application, one or more embodiments of the present specification further provide a performance profiling apparatus for the micro-service application. The apparatus may include systems (including distributed systems), software (applications), modules, components, servers, clients, etc. that use the methods described in the embodiments of the present specification in conjunction with any necessary apparatus to implement the hardware. Based on the same innovative conception, embodiments of the present specification provide an apparatus as described in the following embodiments. Since the implementation scheme of the apparatus for solving the problem is similar to that of the method, the specific implementation of the apparatus in the embodiment of the present specification may refer to the implementation of the foregoing method, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Specifically, fig. 4 is a schematic block diagram of an embodiment of a performance profiling apparatus for a micro-service application provided in this specification, and as shown in fig. 4, the performance profiling apparatus for a micro-service application provided in this specification may include: an obtaining module 120, an aggregating module 122, a generating module 124, and an obtaining module 126.
An obtaining module 120, configured to obtain, according to a performance profiling command, method stack information of each target component in the micro-service application, where performance profiling is required to be performed; each process of each component is provided with a performance analysis plug-in, and the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process;
the aggregation module 122 may be configured to aggregate the method stack information of all target components during running, and obtain performance analysis results of all target components; the performance analysis result comprises a statistical result of execution methods meeting preset conditions in all target assemblies;
a generating module 124, which may be configured to generate a flame map corresponding to each target component based on the method stack information and the flame map generating logic of each target component during runtime; wherein the flame map includes information of a method performed during operation of the target component;
the obtaining module 126 may be configured to obtain a performance profiling result of the microservice application according to the performance analysis result of all target components and the flame map corresponding to each target component.
It should be noted that the above-mentioned description of the apparatus according to the method embodiment may also include other embodiments, and specific implementation manners may refer to the description of the related method embodiment, which is not described herein again.
Based on the performance profiling method for the micro-service application, one or more embodiments of the present specification further provide a performance profiling system for the micro-service application. As shown in fig. 5, the performance profiling system of the microservice application may include a performance profiling plug-in 501, a distributed message queue 502, a streaming computation engine 503, a performance analysis results database 504, a component methods stack storage library 505, a visualization generation engine 506, a user console 507, and a performance profiling command distributor 508.
The performance profiling plug-in 501 exists in an application process (such as application a process instance 1, application a process instance 2, … …, and application a process instance N) in the form of a Java Agent, and provides performance profiling logic that can run simultaneously with business logic of an application. The performance profiling plug-in 501 may periodically obtain a set of components currently required to be profiled from the performance profiling command distributor 508, and if the component where the component is located belongs to the set, it indicates that performance profiling needs to be performed on the process, and then, the performance profiling plug-in 501 collects method stack information of the process during running and asynchronously uploads the method stack information to the distributed message queue 502.
The distributed message queue 502 has the characteristics of distributed deployment, multi-partition, multi-copy, sequential reading and writing and the like, and can realize high-speed reliable storage of the massive method stack information uploaded by each performance analysis plug-in 501 and provide the massive method stack information to the downstream streaming computation engine 503 for processing.
The streaming computation engine 503 may continuously retrieve data from the distributed message queue 502 (i.e., "stream read"), run the batch to compute statistics for the most frequently executed methods for a preset time by all target components in a microservice application, and store the statistics in the performance analysis results database 504.
The performance analysis result database 504 may be used to store an index of the operation performance of all target components in a microservice application, i.e. the statistical result of the method executed most frequently within a preset time, which may be implemented using a distributed database.
The component method stack storage 505 may be configured to store raw data (i.e., method stack information) of runtime method stacks of all target components in a microservice application, and store the raw data in different directories and files according to application names, component names, and time ranges (e.g., minutes), and may be implemented by using a distributed file system.
The visualization generation engine 506 may be used to aggregate the target component method stack information over a specified time range to generate a flame map, thereby revealing all hot spot methods during the operation of the target component.
The user console 507 is a main interface for a user to perform performance profiling on the microservice application, and may issue a performance profiling command, and observe the statistical results of the most frequently executed methods and the flame diagram of the execution process of the corresponding components to locate the root cause of the performance problem and find a performance point that may be optimized.
The performance profiling command distributor 508, which may be used to store and distribute user's most recently issued performance profiling commands, is a key means of engagement between the user console 507 and the performance profiling plug-in 501.
It should be noted that the description of the system according to the method embodiment may also include other embodiments, and specific implementation manners may refer to the description of the related method embodiment, which is not described herein in detail.
The present specification also provides an embodiment of a performance profiling apparatus for a microservice application, comprising a processor and a memory for storing processor-executable instructions, which when executed by the processor, implement steps comprising: acquiring method stack information of each target component needing performance analysis in the micro-service application during operation according to a performance analysis command; each process of each component is provided with a performance analysis plug-in, and the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process; aggregating the method stack information of all target assemblies in operation to obtain performance analysis results of all target assemblies; the performance analysis result comprises a statistical result of execution methods meeting preset conditions in all target assemblies; generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generation logic when each target component runs; wherein the flame map includes information of a method performed during operation of the target component; and obtaining a performance analysis result of the micro-service application according to the performance analysis results of all target components and the flame diagram corresponding to each target component.
It should be noted that the above-mentioned apparatuses may also include other embodiments according to the description of the method or apparatus embodiments. The specific implementation manner may refer to the description of the related method embodiment, and is not described in detail herein.
The method embodiments provided in the present specification may be executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking an example of the performance profiling server running on a server, fig. 6 is a block diagram of a hardware structure of an embodiment of the performance profiling server for a micro-service application provided in this specification, where the server may be a performance profiling apparatus for a micro-service application or a performance profiling device for a micro-service application in the above embodiments. As shown in fig. 6, the server 10 may include one or more (only one shown) processors 100 (the processors 100 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 200 for storing data, and a transmission module 300 for communication functions. It will be understood by those skilled in the art that the structure shown in fig. 6 is only an illustration and is not intended to limit the structure of the electronic device. For example, the server 10 may also include more or fewer components than shown in FIG. 6, and may also include other processing hardware, such as a database or multi-level cache, a GPU, or have a different configuration than shown in FIG. 6, for example.
The memory 200 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the performance profiling method of the micro service application in the embodiment of the present specification, and the processor 100 executes various functional applications and data processing by executing the software programs and modules stored in the memory 200. Memory 200 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 200 may further include memory located remotely from processor 100, which may be connected to a computer terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission module 300 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission module 300 includes a Network adapter (NIC) that can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission module 300 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The method or apparatus provided by the present specification and described in the foregoing embodiments may implement service logic through a computer program and record the service logic on a storage medium, where the storage medium may be read and executed by a computer, so as to implement the effect of the solution described in the embodiments of the present specification. The storage medium may include a physical device for storing information, and typically, the information is digitized and then stored using an electrical, magnetic, or optical media. The storage medium may include: devices that store information using electrical energy, such as various types of memory, e.g., RAM, ROM, etc.; devices that store information using magnetic energy, such as hard disks, floppy disks, tapes, core memories, bubble memories, and usb disks; devices that store information optically, such as CDs or DVDs. Of course, there are other ways of storing media that can be read, such as quantum memory, graphene memory, and so forth.
The embodiment of the method or the apparatus for analyzing the performance of the microservice application provided in this specification may be implemented by a processor executing corresponding program instructions in a computer, for example, implemented in a PC end using a c + + language of a windows operating system, implemented in a linux system, or implemented in an intelligent terminal using android and iOS system programming languages, implemented in processing logic based on a quantum computer, or the like.
It should be noted that descriptions of the apparatus, the device, and the system described above according to the related method embodiments may also include other embodiments, and specific implementations may refer to descriptions of corresponding method embodiments, which are not described in detail herein.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the hardware + program class embodiment, since it is substantially similar to the method embodiment, the description is simple, and the relevant points can be referred to the partial description of the method embodiment.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, when implementing one or more of the present description, the functions of some modules may be implemented in one or more software and/or hardware, or the modules implementing the same functions may be implemented by a plurality of sub-modules or sub-units, etc.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus, devices, systems according to embodiments of the invention. It will be understood that the implementation can be by computer program instructions which can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
As will be appreciated by one skilled in the art, one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects.
The above description is merely exemplary of one or more embodiments of the present disclosure and is not intended to limit the scope of one or more embodiments of the present disclosure. Various modifications and alterations to one or more embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims.

Claims (12)

1. A method for profiling performance of a microservice application, comprising:
acquiring method stack information of each target component needing performance analysis in the micro-service application during operation according to a performance analysis command; each process of each component is provided with a performance analysis plug-in, and the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process;
aggregating the method stack information of all target assemblies in operation to obtain performance analysis results of all target assemblies; the performance analysis result comprises a statistical result of execution methods meeting preset conditions in all target assemblies;
generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generation logic when each target component runs; wherein the flame map includes information of a method performed during operation of the target component;
and obtaining a performance analysis result of the micro-service application according to the performance analysis results of all target components and the flame diagram corresponding to each target component.
2. The method of claim 1, wherein the method stack information includes at least a thread name, thread state information, and a method list.
3. The method of claim 1, wherein before obtaining method stack information of each target component runtime of the micro-service application that needs performance profiling according to the performance profiling command, the method comprises:
receiving a performance profiling command;
storing the performance profiling command to a performance profiling command distributor; the performance profiling command distributor at least comprises a load balancing unit, a command reading and writing unit and a command storage database; the load balancing unit is used for sending an access request sent by the performance analysis plug-in to the command reading and writing unit; the command reading and writing unit is used for storing the performance analysis command into the command database and reading the performance analysis command and returning the performance analysis command to the performance analysis plug-in; the command storage database is used for storing performance profiling commands.
4. The method of claim 3, wherein the performance profiling plug-in collects method stack information for the corresponding process, comprising:
acquiring and analyzing a performance analysis command corresponding to a target process, and determining a blacklist of classes and methods needing to be filtered;
based on the determined class and method blacklist, acquiring method stack snapshot information of all current threads of the target process;
and processing the snapshot information of each method stack as row information to obtain the stack information of each method.
5. The method of claim 4, wherein after the performance profiling plug-in collects method stack information of the corresponding process, further comprising:
assembling the state information of the target process and the stack information of each method to obtain the method stack information in the json form;
and storing the json-form method stack information into a memory queue.
6. The method of claim 5, wherein after storing the json-style method stack information in a memory queue, further comprising:
extracting a preset number of json-form method stack information from the memory queue;
carrying out serialization conversion on method stack information in json forms with preset quantity to obtain serialized json data;
and uploading the serialized json data to a distributed message queue in batch.
7. The method of claim 6, wherein after uploading the serialized json data in bulk to a distributed message queue, further comprising:
under the condition that the memory queue does not include json-form method stack information, after waiting for preset time, taking out a preset number of json-form method stack information from the memory queue;
correspondingly, performing serialization conversion on the preset number of json-form method stack information to obtain serialized json data; and uploading the serialized json data to a distributed message queue in batch.
8. The method according to claim 6, wherein the aggregating the method stack information of all target components during runtime to obtain the performance analysis results of all target components comprises:
acquiring method stack information of all target components in operation within preset time from a distributed message queue;
and running a timing batch operation logic based on the method stack information of all target assemblies in running within the preset time to obtain the performance analysis results of all the target assemblies.
9. The method of claim 1, wherein generating a flame map corresponding to each target component based on the method stack information and the flame map generation logic at runtime of each target component comprises:
receiving and analyzing a flame diagram generation command to obtain flame diagram information; the flame map information includes a corresponding application name, component name, and time range;
screening out method stack information of the target component in the time range according to the flame diagram information;
analyzing each method stack information, deleting the frame calling information in each method stack information, and obtaining a temporary file corresponding to each method stack information;
calling a flame diagram generation script tool based on temporary files corresponding to all the method stack information to generate a flame diagram corresponding to each target assembly; wherein the flame diagram generation scripting tool includes flame diagram generation logic.
10. An apparatus for profiling performance of a microservice application, comprising:
the acquisition module is used for acquiring method stack information of each target component which needs performance analysis in the micro-service application when the target component runs according to a performance analysis command; each process of each component is provided with a performance analysis plug-in, and the performance analysis command is used for indicating the performance analysis plug-in to collect and upload method stack information of a corresponding process;
the aggregation module is used for aggregating the method stack information of all the target assemblies during operation to obtain the performance analysis results of all the target assemblies; the performance analysis result comprises a statistical result of execution methods meeting preset conditions in all target assemblies;
the generating module is used for generating a flame diagram corresponding to each target component based on the method stack information and the flame diagram generating logic when each target component runs; wherein the flame map includes information of a method performed during operation of the target component;
and the obtaining module is used for obtaining the performance analysis result of the micro-service application according to the performance analysis results of all the target components and the flame diagram corresponding to each target component.
11. A performance profiling apparatus for micro-service applications, comprising at least one processor and a memory storing computer executable instructions, the processor implementing the steps of the method of any one of claims 1 to 9 when executing said instructions.
12. A computer-readable storage medium having stored thereon computer instructions which, when executed, implement the steps of the method of any one of claims 1-9.
CN202110704862.2A 2021-06-24 2021-06-24 Performance analysis method, device and equipment for micro-service application Pending CN113434402A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110704862.2A CN113434402A (en) 2021-06-24 2021-06-24 Performance analysis method, device and equipment for micro-service application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110704862.2A CN113434402A (en) 2021-06-24 2021-06-24 Performance analysis method, device and equipment for micro-service application

Publications (1)

Publication Number Publication Date
CN113434402A true CN113434402A (en) 2021-09-24

Family

ID=77754032

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110704862.2A Pending CN113434402A (en) 2021-06-24 2021-06-24 Performance analysis method, device and equipment for micro-service application

Country Status (1)

Country Link
CN (1) CN113434402A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060130001A1 (en) * 2004-11-30 2006-06-15 International Business Machines Corporation Apparatus and method for call stack profiling for a software application
US20170322859A1 (en) * 2016-05-05 2017-11-09 Ebay Inc. Cpu performance profiling
CN109886327A (en) * 2019-02-12 2019-06-14 北京奇艺世纪科技有限公司 The processing system and method for Java data in a kind of distributed system
CN111124791A (en) * 2019-12-06 2020-05-08 深圳前海微众银行股份有限公司 System testing method and device
CN112631891A (en) * 2021-01-05 2021-04-09 网易(杭州)网络有限公司 Performance analysis method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060130001A1 (en) * 2004-11-30 2006-06-15 International Business Machines Corporation Apparatus and method for call stack profiling for a software application
US20170322859A1 (en) * 2016-05-05 2017-11-09 Ebay Inc. Cpu performance profiling
CN109886327A (en) * 2019-02-12 2019-06-14 北京奇艺世纪科技有限公司 The processing system and method for Java data in a kind of distributed system
CN111124791A (en) * 2019-12-06 2020-05-08 深圳前海微众银行股份有限公司 System testing method and device
CN112631891A (en) * 2021-01-05 2021-04-09 网易(杭州)网络有限公司 Performance analysis method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US20210119892A1 (en) Online computer system with methodologies for distributed trace aggregation and for targeted distributed tracing
US9367601B2 (en) Cost-based optimization of configuration parameters and cluster sizing for hadoop
CN107506451B (en) Abnormal information monitoring method and device for data interaction
US20190230000A1 (en) Intelligent analytic cloud provisioning
CN110147411A (en) Method of data synchronization, device, computer equipment and storage medium
CN111459698A (en) Database cluster fault self-healing method and device
US9043327B1 (en) Performing flexible pivot querying of monitoring data using a multi-tenant monitoring system
CN102999314A (en) Immediate delay tracker tool
CN110147470B (en) Cross-machine-room data comparison system and method
CN112395333B (en) Method, device, electronic equipment and storage medium for checking data abnormality
CN108268468B (en) Big data analysis method and system
WO2023093607A1 (en) Offline data fuzzy search method and apparatus, device and medium
Wang et al. A model-based framework for cloud API testing
CN117349323B (en) Database data processing method and device, storage medium and electronic equipment
CN114756629A (en) Multi-source heterogeneous data interaction analysis engine and method based on SQL
CN112559525B (en) Data checking system, method, device and server
Zhou et al. MTracer: A trace-oriented monitoring framework for medium-scale distributed systems
US9218205B2 (en) Resource management in ephemeral environments
Martinez-Mosquera et al. Development and evaluation of a big data framework for performance management in mobile networks
CN110309206B (en) Order information acquisition method and system
CN113434402A (en) Performance analysis method, device and equipment for micro-service application
Feng et al. A memory capacity model for high performing data-filtering applications in samza framework
CN110716938A (en) Data aggregation method and device, storage medium and electronic device
Dai et al. GraphTrek: asynchronous graph traversal for property graph-based metadata management
CN111159004A (en) Hadoop cluster simulation test method and device and storage medium

Legal Events

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