Application performance obtaining method and device for power grid service
Technical Field
The invention relates to the technical field of electric power, in particular to an application performance acquisition method and device for automatically checking and positioning problems caused by system operation abnormity and system blockage in a power grid business system production environment.
Background
The power grid service system has obvious periodic characteristics, the use peak periods of users in the morning and afternoon respectively occur, the conditions of slow webpage response, system blockage, abnormity and the like often occur in the two periods, and the users obviously feel that the system experience is poor and the performance of the service system is not satisfactory.
With the continuous expansion of the scale of the service system, the increase of the service modules of the system and the continuous emergence of the mutual calling condition among the service systems, great challenges are provided for the performance of the current service system.
At present, several application performance analysis tools are available in the market, or a probe is embedded in a business system to analyze problems at a code level; or by analyzing traffic system traffic to determine and analyze system problems. However, none of them can directly give the service module location causing the system abnormal problem, but needs the assistance of the service system developer.
Disclosure of Invention
The invention aims to provide a method and a device for acquiring application performance facing to power grid services, which are used for automatically positioning and checking system abnormal reasons, providing service modules causing the reasons, enhancing user experience and improving operation and maintenance efficiency of a service system.
In order to achieve the purpose, the invention adopts the following technical scheme:
the first invention provides a power grid service-oriented application performance acquisition method, which comprises the following steps:
summarizing the mirror image data, acquiring a URL corresponding to the abnormal data, and constructing a corresponding relation between the web transaction and the URL;
crawling a URL corresponding to a business module of a business system webpage of the test environment, and constructing a corresponding relation between the business module and a web transaction;
and acquiring URLs and service modules corresponding to the web transactions respectively, and summarizing the corresponding relation between the URLs and the service modules.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the summarizing the mirror image data, obtaining a URL corresponding to the abnormal data, and constructing a corresponding relationship between the web transaction and the URL includes,
checking abnormal data with larger deviation between the core parameter value and the baseline data, and acquiring a URL (uniform resource locator) corresponding to the abnormal data;
and extracting the web transaction corresponding to the abnormal data URL by using the regular expression, and constructing a hash table of the web transaction corresponding to the abnormal data and the URL.
Further, before the step of checking abnormal data with a large deviation between the core parameter value and the baseline data and acquiring a URL corresponding to the abnormal data, the method further includes: and setting mirror image ports at the switches and/or routers of the service system, and intercepting data of the switches and/or routers, wherein the data are sent to the mirror image ports.
With reference to the first aspect, in a second possible implementation manner of the first aspect, the crawling a URL corresponding to a service module of a service system web page of the testing environment, and constructing a corresponding relationship between the service module and a web transaction include,
crawling URLs corresponding to all service modules in a current webpage from the start of logging in a webpage URL by a service system of a test environment until the crawling of URLs of all webpages is completed;
and extracting the web transaction corresponding to the acquired URL by using a regular expression, and inserting the corresponding relation between the web transaction and the name of the service module into the inverted index table.
Further, the crawling of URLs corresponding to all service modules in the current webpage from the URL of the service system login webpage of the test environment until the URL crawling of all webpages is completed includes:
using a web crawler technology, starting from a login page URL of a business system, putting the URL into a URL queue to be captured;
taking out a URL from the queue to be captured, downloading a webpage corresponding to the URL, and storing the webpage into a webpage library;
and putting the processed URL into a processed URL queue, analyzing other URLs in the webpage corresponding to the captured URL, putting the URLs into a to-be-captured URL queue, and entering the next cycle until all the URLs in all the webpages are processed.
The second aspect of the present invention provides a device for acquiring application performance of a power grid service, where the device includes:
the abnormal data summarization module is used for acquiring the URL corresponding to the abnormal data and constructing the corresponding relation between the web transaction and the URL;
the service system data crawling module crawls a URL corresponding to a service module of a service system webpage of the test environment and constructs a corresponding relation between the service module and the web transaction;
and the performance problem positioning module is used for acquiring the URL and the service module which respectively correspond to the web transaction and summarizing the corresponding relation between the URL and the service module.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the abnormal data summarization module includes,
the mirror image data acquisition unit intercepts data of the port of the switch and/or the router, sends the data to the mirror image port, and summarizes the mirror image data;
the abnormal data URL acquisition unit is used for checking abnormal data with larger deviation between the core parameter value and the baseline data and acquiring a URL corresponding to the abnormal data;
and the abnormal data hash table construction unit extracts the web transaction corresponding to the abnormal data URL by using the regular expression and constructs the hash table of the web transaction and the URL corresponding to the abnormal data.
With reference to the second aspect, in a second possible implementation manner of the second aspect, the business system data crawling module includes,
the webpage URL acquiring unit is used for taking a service system login page URL as a seed URL, downloading and storing a webpage corresponding to the URL into a webpage library, and capturing other URLs in the webpage until all URL capturing work of all the webpages is completed;
and the business system hash table construction unit extracts the web transaction corresponding to the acquired URL by using the regular expression and inserts the corresponding relation between the web transaction and the business module name into the inverted index table.
The device for acquiring application performance oriented to power grid services in the second aspect of the present invention can implement the methods in the first aspect and the implementation manners of the first aspect, and achieve the same effects.
The beneficial effect of the invention is that,
1. enhancing user experience
The method for acquiring the application performance can directly give the reason of the problem without depending on developers, greatly improves the efficiency, ensures the problem reflected by the system user, can position and solve the problem in time, and further enhances the satisfaction degree of the service system user.
2. Improve the operation and maintenance efficiency
The current power grid service system has huge service scale and increasingly complex service logic, which puts great demands on the operation and maintenance level and service capability of service personnel. Under the condition that the number of the operation and maintenance personnel is limited and the capacity is limited, the scheme can further improve the working efficiency of the operation and maintenance personnel, help the operation and maintenance personnel to find problems as early as possible, solve the problems and improve the performance assessment level of the operation and maintenance personnel.
3. Ensuring normal access of service
By automatically positioning the problems of the power grid service system, operation and maintenance personnel are assisted to quickly solve the problems, a user can be ensured to normally access the service system, the intersection of service system abnormity and other service problems is relieved, and contribution is made to improvement of the power grid informatization level on the aspect of service guarantee.
Drawings
FIG. 1 is a flow chart of a method for obtaining application performance of a power grid service;
FIG. 2 is a schematic diagram illustrating a URL principle corresponding to a web service module for crawling a test environment;
FIG. 3 is a diagram illustrating the correspondence between build business modules and web transactions;
fig. 4 is a schematic structural diagram of the device for acquiring application performance oriented to power grid services according to the present invention.
Detailed Description
As shown in fig. 1, a method for acquiring application performance of a power grid service includes the following steps:
s1, summarizing the mirror image data, acquiring a URL corresponding to the abnormal data, and constructing a corresponding relation between the web transaction and the URL;
s2, crawling URLs corresponding to business modules of business system web pages of the test environment, and constructing a corresponding relation between the business modules and web transactions;
s3, obtaining the URL and the service module corresponding to the web affair, and summarizing the corresponding relation between the URL and the service module.
In step S1, the mirror image data is summarized to obtain the URL corresponding to the abnormal data, and a corresponding relationship between the web transaction and the URL is constructed, including,
s11, setting mirror image port at service system exchanger and/or router, intercepting exchanger and/or router port data to send to mirror image port.
S12, checking abnormal data with large deviation between the core parameter value and the baseline data, and acquiring a URL (uniform resource locator) corresponding to the abnormal data;
s13, extracting web transactions corresponding to the abnormal data URLs by using the regular expressions, and constructing a hash table of the web transactions corresponding to the abnormal data and the URLs, wherein the hash table is shown in Table 1.
Web transactions
| URL
|
Affair |
1
|
U1
|
Affair |
2
|
U2
|
……
|
……
|
Transaction n
|
Un |
TABLE 1
In step S12, if the deviation between the values of the core parameters and the baseline data (data during normal operation of the system) is large, it indicates that there may be abnormal data in the current network. The core parameters include: total traffic, average traffic per second, average utilization, number of packets, average number of packets per second, packet size distribution, average packet length, number of TCP sessions, number of UDP sessions, number of MAC addresses, etc. Clicking a button in the local monitoring interface to prompt the developed browser plug-in to run, wherein the plug-in captures the URL operated by the user on the service system interface (such as PMS2.0) and sends the URL to the monitoring end. Comparing the captured URL with the abnormal contrast generated by the mirror flow to determine the URL with long response time in a window time (such as [ -10s, +10s ]).
In step S13, the web transaction corresponding to the URL is extracted through the regular expression, and in this way, a hash table (with the web transaction as key and the corresponding URL as value) is constructed from the URL of the abnormal traffic and the corresponding web transaction within a period of time (which may be set to 1 day).
In step S2, when the URL corresponding to the service module of the service system web page in the crawling test environment and the specific implementation of the correspondence between the service module and the web transaction are constructed, as shown in fig. 2, the service system login page in the test environment is selected as a seed URL; putting the URL into a URL queue to be captured; taking out a URL to be captured from the URL queue to be captured, downloading a webpage corresponding to the URL, storing the webpage into a webpage library, and putting the processed URL to be captured into the captured URL queue; analyzing other URLs existing in the web pages of the URLs in the captured URL queue, and putting the URLs into the URL queue to be captured, so as to enter the next capturing cycle until no new URL is found; taking out a webpage from a webpage library, intercepting a web transaction of a service module URL in the webpage by using a regular expression, inserting the corresponding relation between the web transaction and the name of the service module into an inverted index table, and continuously processing the next webpage in the webpage library; until the web pages in the web page library are processed, the construction of the inverted index table is completed, as shown in fig. 3.
In step S3, a key is taken out from the abnormal traffic hash table, and the name of the service module corresponding to the key is found out from the inverted index table constructed in step 1; storing the obtained business module name and the web affair in a database; continuously taking out the keys from the hash table, and repeating the steps (1) and (2) until all the keys in the current hash table are traversed; and taking out the business module name corresponding to the abnormal flow from the database, and displaying the business module name to related personnel of system management in a graphical mode.
As shown in fig. 4, an apparatus for acquiring application performance of a grid service includes:
the abnormal data summarizing module 11 is used for acquiring the URL corresponding to the abnormal data and constructing the corresponding relation between the web transaction and the URL;
the service system data crawling module 12 crawls a URL corresponding to a service module of a service system webpage of the test environment, and constructs a corresponding relation between the service module and a web transaction;
and the performance problem positioning module 13 is used for acquiring the URL and the service module respectively corresponding to the web transaction, and summarizing the corresponding relation between the URL and the service module.
The abnormal data summarization module 11 comprises a mirror image data acquisition unit 111, which intercepts data of the switch and/or router port and sends the data to a mirror image port to summarize the mirror image data;
an abnormal data URL obtaining unit 112, which examines abnormal data with a large deviation between the core parameter value and the baseline data, and obtains a URL corresponding to the abnormal data;
the abnormal data hash table construction unit 113 extracts the web transaction corresponding to the abnormal data URL using the regular expression, and constructs a hash table of the web transaction and the URL corresponding to the abnormal data.
The service system data crawling module 12 includes a web page URL obtaining unit 121, which uses a service system login page URL as a seed URL, downloads and stores a web page corresponding to the URL into a web page library, and crawls other URLs in the web page until all URL crawling operations of all web pages are completed;
the service system hash table constructing unit 122 extracts the web transaction corresponding to the acquired URL using the regular expression, and inserts the correspondence between the web transaction and the service module name into the inverted index table.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.