Specific embodiment
In order to better understand the above technical scheme, below by attached drawing and specific embodiment to this specification embodiment
Technical solution be described in detail, it should be understood that the specific features in this specification embodiment and embodiment are to this explanation
The detailed description of book embodiment technical solution, rather than the restriction to this specification technical solution, in the absence of conflict,
Technical characteristic in this specification embodiment and embodiment can be combined with each other.
In a first aspect, as shown in Figure 1, this specification embodiment provides a kind of compression method of link structure log, including
Following steps:
S102, the primary original link structure log called and generated is obtained, includes more in the original link structure log
The nodal information of a node;
Specifically, system can automatically generate original link structure log in each call, in this way, can pass through reading
Or the modes such as receive and obtain the original link structure log that system once calls generation, wherein the original link knot
It include the nodal information of multiple nodes in structure log, wherein the nodal information of other each nodes includes the number of the node
With called interface message, wherein the number of node is for identifying its position in link structure log, the interface letter
Breath may include one or more information in the information such as packet name, class name and the method parameter number called.Preferably, described to connect
Message breath includes packet name, class name and the method parameter number called.
Specifically, since the original link structure log is that primary call generates, so that the original link structure
Any one node and other nodes in log all have common prefix.
For example, the original link structure log obtained is specific as follows:
0,com.alipay.pcardcore.common.util.cache.Cachemanger.getKeyStrategy
(1)
0.1,com.alipay.pcardcore.common.util.drm.manager.DrmResourceManager.
findResourceByName(2)
0.1.1,com.alipay.imock.core.pool.contorller.EnvContorller.isProd()
0.2,com.alipay.pcardcore.common.util.cache.Cachemanger.getobject(3)
It can be seen from the above, the original link structure log includes node 0,0.1, the sections of 0.1.1 and 0.2 this 4 nodes
Point information, and any one node and other nodes all have common prefix in this 4 nodes.
S104, the node pair with maximum common prefix is extracted from the original link structure log, and from having
The node centering of maximum common prefix chooses a node as host node;
It, can be by the node of the every two node in the original link structure log in a kind of optional embodiment
Content is compared, and obtains comparison result;The node pair with maximum common prefix is extracted according to the comparison result, then
From wherein select a node as the host node.Wherein it is possible at random from the node centering choosing with maximum common prefix
Take a node as the host node, it can also be according to pre-set condition from the node centering with maximum common prefix
The node for meeting the condition is chosen as the host node, the application is not specifically limited.Wherein, the pre-set item
Part can be length is big or length is a small node as the host node, be also possible to a forward node conduct of node
The host node, the application is with no restriction.
For example, for this 4 nodes of 0,0.1,0.1.1 and 0.2, can by 0 this node respectively with 0.1,0.1.1 and
0.2 this 3 nodes are compared, and the length for obtaining the common prefix that comparing result shows that (0,0.1) has is 33, (0,
0.1.1 the length for the common prefix) having is 11, and the length of the common prefix that (0,0.2) has is 55, due to 55 > 33 > 11,
To which the node with maximum common prefix can be extracted to for (0,0.2), then from (0,0.2) according to the comparing result
In randomly select 0.2 as host node.
In the embodiment of the present application, each node is to including two nodes.
In another optional embodiment, the original link structure log can be arranged according to method signature
Sequence;Extract the node pair with maximum common prefix from the original link structure log after the sequence, and from tool
There is the node centering of maximum common prefix to choose a node as host node.
Specifically, it after being ranked up to the original link structure log according to method signature, sorts up front
Two nodes have maximum common prefix, and two nodes so as to sort up front are the section with maximum common prefix
Then point pair chooses a node as host node, usually in the node pair with maximum common prefix from the node centering
The preceding node that sorts is chosen as the host node;It is of course also possible to be chosen in the node pair with maximum common prefix
Posterior node sort as the host node, the application is not specifically limited.Lower mask body is to have maximum common prefix
Node centering choose the preceding node of sorting as the host node for.
For example, the arrangement after the node in the original link structure log is ranked up is as follows:
0,com.alipay.pcardcore.common.util.cache.Cachemanger.getKeyStrategy
(1)
0.2,com.alipay.pcardcore.common.util.cache.Cachemanger.getobject(3)
0.1,com.alipay.pcardcore.common.util.drm.manager.DrmResourceManager.
findResourceByName(2)
0.1.1,com.alipay.imock.core.pool.contorller.EnvContorller.isProd()
It can be seen from the above, sequence two nodes (0,0.2) in front this be to the common prefix that node includes
" com.alipay.pcardcore.common.util.cache.Cachemanger.get " totally 55 characters, and (0,0.1)
This is " com.alipay.pcardcore.common.util. " totally 33 characters to the common prefix that node includes;And (0,
0.1.1) this is " com.alipay. " totally 11 characters to the common prefix that node includes, due to 55 > 33 > 11, so as to mention
Taking out has the node of maximum common prefix to being (0,0.2), since (0,0.2) interior joint 0 sorts preceding, then chooses 0 conduct
Host node.
S106, other nodes and the master each of in addition to the host node are obtained in the original link structure log
The common prefix of node;
Specifically, after getting the host node by step S104, then by the original link structure day
Other nodes each of in addition to the host node and the host node in will carry out prefix matching, get other each sections
The common prefix of point and the host node.
For example, from randomly selecting 0.2 in (0,0.2) as after host node, by 0,0.1, this 3 nodes of 0.1.1 with
0.2 carries out prefix matching, and obtaining (0.2,0), this is " com.alipay.pcardcore.com to the common prefix that node includes
Mon.util.cache.Cachemanger.get " totally 55 characters, and (0.2,0.1) this be to the common prefix that node includes
" com.alipay.pcardcore.common.util. " totally 33 characters;And (0.2,0.1.1) this be total to what node included
It is " com.alipay. " totally 11 characters with prefix.
In a kind of optional embodiment of the application, due to the original link structure log according to method signature
After being ranked up, in the original link structure log after sequence therefore the common prefix of each adjacent two node may be used also
Sort posterior node and the master in using the common prefix by obtaining each adjacent two node as the two neighboring node
The common prefix of node.
For example, the arrangement after being ranked up according to the node in the original link structure log, obtain adjacent node (0,
0.2) common prefix for including is " com.alipay.pcardcore.common.util.cache.Cachemanger.get " totally 55
A character, due to 0.2 sequence it is rear and 0 be host node, then can determine (0,0.2) common prefix be above-mentioned 55 characters;Phase
Ying Di, the common prefix that adjacent node (0.2,0.1) includes are " com.alipay.pcardcore.common.util. " totally 33
A character, due to 0.1 sequence it is rear and 0 be host node, then can determine (0,0.1) common prefix be above-mentioned 33 characters;
And the common prefix that adjacent node (0.1,0.1.1) includes is " com.alipay. " totally 11 characters, is based on identical reason
By can then determine that the common prefix of (0,0.1.1) is above-mentioned 11 characters.
S108, the common prefix in other described each nodes of the acquisition with the host node is compressed, is obtained
To compressed link structure log.
It specifically, can be by compress modes such as gzip to the common of other nodes of each of acquisition and the host node
Prefix is compressed, and compressed link structure log is obtained;Due to only to the common of other each nodes and the host node
Prefix is compressed, and to the host node and the content in other each nodes in addition to the corresponding common prefix of the node
It is not compressed, in this way, from that can be obtained in compressed link structure log in the host node and other each nodes
Content in addition to the corresponding common prefix of the node;That is, the host node described in the compressed link structure log
Content other than full content and the corresponding common prefix of other described each nodes is in uncompressed state.
In a kind of optional embodiment, will each of in addition to the host node other nodes and the host node
When the common prefix that the common prefix having is compressed with is compressed, other each nodes can be had with the host node
The content compression of some common prefix is the length value of the corresponding common prefix of the node.
For example, the common prefix having in 3 pairs of nodes is respectively 55 > 33 > 11, in this way, pick out have it is maximum it is common before
The node sewed is to being 55 corresponding nodes to (0,0.2), using 0 or 0.2 as host node;If using 0 as host node, to 0.1,
0.1.1 corresponding common prefix is compressed with 0.2, so that the content compression of 0.1 corresponding common prefix is being total to for (0,0.1)
Length with prefix is 33;0.1.1 the content compression of corresponding common prefix is that the length of the common prefix of (0,0.1.1) is
11;The content compression of 0.1 corresponding common prefix is that the length of the common prefix of (0,0.2) is 55;Compressed link structure
Shown in log is specific as follows:
0,com.alipay.pcardcore.common.util.cache.Cachemanger.getKeyStrategy
(1)
0.2,{55}Cachemanger.getobject(3)
0.1,{33}drm.manager.DrmResourceManager.findResourceByName(2)
0.1.1,{11}imock.core.pool.contorller.EnvContorller.isProd()
It can be seen from the above, the content compression for the common prefix having due to other each nodes and the host node is the section
The length value of the corresponding common prefix of point, in this way, by compressed length value and the host node, that is, restore it is each other
All the elements of node.
For example, by taking 0.2 in compressed link structure log as an example, after the compression of 0.2 corresponding common prefix
Content be 55, then from the content of host node 0 choose 55 characters in front fills into 0.2 content, thus will
0.2, { 55 } Cachemanger.getobject (3) is reduced to 0.2, com.alipay.pcardcore.common.util.ca
Che.Cachemanger.getobject (3), in compressed link structure log each of in addition to the host node its
He executes aforesaid operations by node, can restore all the elements of other each nodes;It follows that compressed link structure
Day aims at that readability can be provided simultaneously in the case where ensuring certain compression ratio.
Second aspect, based on the same inventive concept, this specification embodiment provide a kind of compression dress of link structure log
It sets, referring to FIG. 2, including:
Original log acquiring unit 201, for obtaining the primary original link structure log for calling generation, the raw chains
It include the nodal information of multiple nodes in line structure log;
Host node selection unit 202 has maximum common prefix for extracting from the original link structure log
Node pair, and choose a node as host node from the node centering with maximum common prefix;
Common prefix acquiring unit 203, for obtaining in the original link structure log in addition to the host node
The common prefix of each other nodes and the host node;
Compression unit 204, for the common prefix in other described each nodes to the acquisition with the host node
It is compressed, obtains compressed link structure log.
In a kind of optional way, host node selection unit 202 is also used to the original link structure log according to side
Method signature is ranked up, and is provided described in two nodes conduct of foremost in the original link structure log after obtaining sequence
There is the node pair of maximum common prefix.
In a kind of optional way, host node selection unit 202 was also used to from the original link structure day after sequence
It is the host node that the preceding node that sorts is chosen in will.
In a kind of optional way, host node selection unit 202, be also used to handled by executing all threads it is described
During each task of current batch processing, the node content of the every two node in the original link structure log is carried out
It compares, obtains comparison result;The node pair with maximum common prefix is extracted according to the comparison result.
In a kind of optional way, compression unit 204 is also used to for other each nodes being total to what the host node had
Content compression with prefix is the length value of the corresponding common prefix of the node.
The third aspect, based on inventive concept same as the compression method of previous embodiment link structure log, this hair
It is bright that a kind of server is also provided, as shown in figure 3, including memory 304, processor 302 and being stored on memory 304 and can be
The computer program run on processor 302, the processor 302 realize batch processing task described previously when executing described program
Either processing method method the step of.
Wherein, in Fig. 3, bus architecture (is represented) with bus 300, and bus 300 may include any number of interconnection
Bus and bridge, bus 300 will include the one or more processors represented by processor 302 and what memory 304 represented deposits
The various circuits of reservoir link together.Bus 300 can also will peripheral equipment, voltage-stablizer and management circuit etc. it
Various other circuits of class link together, and these are all it is known in the art, therefore, no longer carry out further to it herein
Description.Bus interface 305305 provides interface between bus 300 and receiver 301 and transmitter 303.Receiver 301 and hair
It send device 303 to can be the same element, i.e. transceiver, the list for communicating over a transmission medium with various other devices is provided
Member.Processor 302 is responsible for management bus 300 and common processing, and memory 304 can be used for storage processor 302 and exist
Execute used data when operation.
Fourth aspect, based on the inventive concept of the compression method with previous embodiment link structure log, the present invention is also
A kind of computer readable storage medium is provided, computer program is stored thereon with, is realized above when which is executed by processor
The step of either the compression method of link structure log method.
This specification is referring to the method, equipment (system) and computer program product according to this specification embodiment
Flowchart and/or the block diagram describes.It should be understood that can be realized by computer program instructions every in flowchart and/or the block diagram
The combination of process and/or box in one process and/or box and flowchart and/or the block diagram.It can provide these computers
Processor of the program instruction to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices
To generate a machine, so that generating use by the instruction that computer or the processor of other programmable data processing devices execute
In setting for the function that realization is specified in one or more flows of the flowchart and/or one or more blocks of the block diagram
It is standby.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of equipment, the commander equipment realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Although the preferred embodiment of this specification has been described, once a person skilled in the art knows basic wounds
The property made concept, then additional changes and modifications may be made to these embodiments.So the following claims are intended to be interpreted as includes
Preferred embodiment and all change and modification for falling into this specification range.
Obviously, those skilled in the art can carry out various modification and variations without departing from this specification to this specification
Spirit and scope.In this way, if these modifications and variations of this specification belong to this specification claim and its equivalent skill
Within the scope of art, then this specification is also intended to include these modifications and variations.