CN115145869A - Log data display method and device, storage medium and computer equipment - Google Patents
Log data display method and device, storage medium and computer equipment Download PDFInfo
- Publication number
- CN115145869A CN115145869A CN202210750230.4A CN202210750230A CN115145869A CN 115145869 A CN115145869 A CN 115145869A CN 202210750230 A CN202210750230 A CN 202210750230A CN 115145869 A CN115145869 A CN 115145869A
- Authority
- CN
- China
- Prior art keywords
- node
- log data
- sub
- tree
- target
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000000638 solvent extraction Methods 0.000 claims description 8
- 239000012634 fragment Substances 0.000 description 98
- 230000008569 process Effects 0.000 description 9
- 238000004088 simulation Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000007726 management method Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/14—Details of searching files based on file metadata
- G06F16/148—File search processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/1734—Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Library & Information Science (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application provides a log data display method, a log data display device, a storage medium and computer equipment, wherein the method comprises the following steps: acquiring a first tree data structure; the first tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each sub-log data one by one, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node; determining an initial search interval, and inquiring the first tree-shaped data structure according to the initial search interval and a preset inquiry rule to obtain target interval information corresponding to sub-log data to be displayed; and loading the sub-log data corresponding to the target interval information to local equipment. According to the method and the device, time consumed in determining the target interval information can be greatly reduced, and the loading efficiency of log data can be improved.
Description
Technical Field
The present application relates to the field of automatic driving technologies, and in particular, to a log data display method and apparatus, a storage medium, and a computer device.
Background
In the field of automatic driving, an algorithm engineer often restores accident scenes when debugging an automatic driving algorithm, and performs common analysis based on contents such as log data and the restored accident scenes to comb up the operation logic of the automatic driving algorithm. Because the log data has huge data volume, it takes a long time to completely download a large batch of log data from the back-end server, so that the log data can be quickly displayed on the front-end page, the log data can be loaded only in a fragment loading manner, that is, the front-end device only requests the back-end server for log data corresponding to a short period of time each time. The log data corresponding to the short period of time is a log fragment. In order to reduce the pressure of the back-end server, the front-end device only requests each log fragment once, and stores the log fragment in the local memory for repeated access when acquiring the log fragment.
In an actual application scenario, the granularity of the fragmented loading is small, each log slice corresponds to a short duration, such as 100 milliseconds. For a large batch of log data, the corresponding total time length is long, so the log data can be divided into more than one million log fragments. When the number of locally stored log fragments reaches a certain degree, how to determine the next log fragment to be loaded becomes one of the important factors related to the loading efficiency.
At present, in the prior art, a recording time period corresponding to a next log fragment is determined by traversing each locally stored log fragment, and then the next log fragment is loaded through the recording time period. Therefore, in a scenario of loading large amounts of log data, when the number of locally stored log fragments reaches a certain degree, the front-end device needs to spend a large amount of time to determine a recording time period corresponding to the next log fragment, resulting in low loading efficiency.
Disclosure of Invention
The present application is directed to solving at least one of the above technical drawbacks, and in particular, to solving the technical problem of inefficient loading when loading large volumes of log data in the prior art.
In a first aspect, an embodiment of the present application provides a log data display method, where the method includes:
acquiring a first tree data structure; the first tree-shaped data structure is a line segment tree or a tree array constructed based on interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each piece of sub-log data one by one, the sub-log data corresponding to each father node is a union set of the sub-log data corresponding to each son node under the father node, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node;
determining an initial search interval, and inquiring the first tree-shaped data structure according to the initial search interval and a preset inquiry rule to obtain target interval information corresponding to sub-log data to be displayed;
and loading the sub-log data corresponding to the target interval information to local equipment.
In one embodiment, the first tree data structure is a segment tree or a tree array constructed by partitioning the total log data based on the total recording time period corresponding to the total log data and using the sub-recording time period corresponding to each block of sub-log data as the interval information of the block of sub-log data; the initial search interval is an initial search time interval;
the identification value of each node in the first tree data structure is used for representing the utilization state information of the sub-log data corresponding to the node, and the utilization state information is used for reflecting whether the sub-log data corresponding to the node is loaded or not;
the step of querying the first tree data structure according to the initial search interval and a preset query rule to obtain target interval information corresponding to the sub-log data to be displayed includes:
inquiring the first tree-shaped data structure according to the initial search time period to obtain target interval information corresponding to the sub-log data to be displayed; and the target interval information is the earliest sub-recording time period which is not earlier than the initial searching time period in the sub-recording time period corresponding to the unloaded sub-log data of each block.
In one embodiment, if the first tree data structure is a segment tree, the method further includes:
under the condition that the sub-log data corresponding to the target interval information is loaded completely, taking a first preset value as an identification value of a target leaf node in the first tree data structure, and updating the identification value of each upper layer node of the target leaf node according to the first preset value;
the target leaf node is a leaf node corresponding to first target sub-log data, and the first target sub-log data is sub-log data corresponding to the target interval information.
In one embodiment, when the target leaf node is not allocated with a storage space, the step of using the first preset value as the identification value of the target leaf node in the first tree data structure includes:
traversing the first tree data structure according to the target interval information, and executing the following steps for the current traversal node:
determining a target child node corresponding to the first target child log data from child nodes of the node;
if the target son node is not allocated with the storage space, applying for the storage space for the target son node;
under the condition that the target son node is not the target leaf node, writing a second preset value serving as an identification value of the target son node into a corresponding storage space, and using the target son node as a next traversal node;
and under the condition that the target son node is the target leaf node, writing the first preset value serving as the identification value of the target leaf node into a corresponding storage space.
In one embodiment, when the target leaf node has been allocated a storage space, the step of using the first preset value as an identification value of the target leaf node in the first tree data structure includes:
traversing the first tree data structure according to the target interval information to determine a storage space corresponding to the target leaf node, and writing the first preset value into the storage space corresponding to the target leaf node.
In one embodiment, the identification value of each parent node in the first tree data structure is the sum of the identification values of the child nodes under the parent node; the interval information of each father node is a child recording time interval union set of child log data corresponding to child nodes under the father node;
the step of querying the first tree data structure according to the initial search time period to obtain target interval information corresponding to the sub-log data to be displayed includes:
traversing the first tree data structure in a direction from a root node to a leaf node, for a currently traversed node:
if the current traversal node is a leaf node and the identification value of the current traversal node is a second preset value, taking a sub-recording time period corresponding to second target sub-log data as the target interval information, wherein the second target sub-log data is sub-log data corresponding to the current traversal node;
if the current traversal node is not allocated with the memory space, taking the earliest sub-recording time period which is not earlier than the initial searching time period in the interval information of the current traversal node as the target interval information;
if the current traversal node is not a leaf node and the current traversal node is allocated with a storage space, judging whether the sub-log data corresponding to the current traversal node is completely loaded or not according to a comparison result between the interval length of the interval information of the current traversal node and the identification value of the current traversal node, and obtaining a judgment result; and determining the next traversal node based on the judgment result and the initial search time period.
In one embodiment, the first tree data structure is a tree array used for maintaining an original data array, and a value of an nth element in the original data array is used for representing utilization state information of sub-log data corresponding to an nth sub-recording period; the Nth sub-recording time interval is an interval of which the Nth interval length is unit duration in the total recording time interval; the identification value of each node in the first tree data structure is the sum of values of M elements maintained by the node in the original data array, and the interval information of each node in the first tree data structure is the union of the sub-recording time periods corresponding to the M elements;
the method further comprises the following steps:
under the condition that the sub-log data corresponding to the target interval information is loaded completely, updating the identification value of each target node according to a first preset value so as to update the original data array; wherein the interval information of the target node includes the target interval information.
In one embodiment, the method further comprises: acquiring a second tree data structure; the second tree data structure is a segment tree or a tree array constructed based on interval information of each block of sub-log data after the total log data is partitioned; in the second tree data structure, each leaf node corresponds to each piece of the sub-log data one to one, the sub-log data corresponding to each father node is a union of the sub-log data corresponding to each son node under the father node, and the identification value of each node in the second tree data structure is used for representing the total data volume of the sub-log data corresponding to the node;
loading the sub-log data corresponding to the target interval information to a local device, including:
searching the second tree-shaped data structure based on the target interval information to obtain the data volume to be loaded corresponding to the target interval information;
acquiring a loaded data volume, and adding the loaded data volume and the data volume to be loaded to obtain an expected data volume;
judging whether to load the sub-log data corresponding to the target interval information or not based on a comparison result of the expected data volume and a preset data volume threshold; and if the target interval information is not the sub-log data, the sub-log data corresponding to the target interval information is not loaded.
In one embodiment, the step of determining the starting search period comprises: and taking the recording time period to which the log data currently displayed by the front-end equipment belongs as a display time period, and determining the initial searching time period according to the display time period and a preset loading rule.
In a second aspect, an embodiment of the present application provides a log data presentation apparatus, where the apparatus includes:
a tree data structure obtaining module for obtaining a first tree data structure; the first tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each piece of sub-log data one to one, the sub-log data corresponding to each father node is a union set of the sub-log data corresponding to each son node under the father node, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node;
the target interval information determining module is used for determining an initial search interval and inquiring the first tree-shaped data structure according to the initial search interval and a preset inquiry rule so as to obtain target interval information corresponding to the sub-log data to be displayed;
and the loading module is used for loading the sub-log data corresponding to the target interval information to local equipment.
In a third aspect, an embodiment of the present application provides a storage medium, where computer-readable instructions are stored in the storage medium, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the log data presentation method according to any one of the foregoing embodiments.
In a fourth aspect, an embodiment of the present application provides a computer device, including: one or more processors, and a memory; the memory stores computer readable instructions, and the computer readable instructions, when executed by the one or more processors, perform the steps of the log data presentation method of any of the above embodiments.
In the log data presentation method, the log data presentation device, the computer device, and the storage medium provided in the embodiments of the present application, the first tree data structure is a segment tree or a tree array, the first tree data structure is constructed according to interval information of each block of sub-log data, and each block of sub-log data is a result obtained by partitioning the total log data. The segment tree and the tree array can divide the complete interval information corresponding to the total log data into a plurality of subintervals for management, each leaf node in the segment tree corresponds to one piece of sub-log data, and each node in the tree array corresponds to at least one piece of sub-log data, so that the utilization state information of the sub-log data corresponding to the node can be recorded through each node of the first tree data structure, and the problem of determining the next log fragment is converted into the problem of inquiring the interval of the first tree data structure.
Before loading the next log fragment, the method and the device can query the first tree-shaped data structure based on the initial search interval and a preset query rule to obtain interval information corresponding to the sub-log data to be displayed, namely target interval information. The target interval information is the interval information corresponding to the next log segment. Compared with the traversing and searching mode in the prior art, the method and the device can determine the target interval information with the time complexity of the logarithmic level, greatly reduce the time consumed in determining the target interval information in the scene of loading large-batch log data, and further improve the loading efficiency of the log data.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a diagram of an application environment of a log data presentation method in an embodiment;
FIG. 2 is a flowchart illustrating a method for displaying log data according to an embodiment;
FIG. 3 is one of the tree diagrams of a segment tree in an embodiment;
FIG. 4 is a second schematic diagram illustrating a tree shape of a line tree in an embodiment;
FIG. 5 is a flowchart illustrating a step of using a first preset value as an identification value of a target leaf node in a first tree data structure according to an embodiment;
FIG. 6 is a third exemplary tree diagram of a line tree in an embodiment;
FIG. 7 is a block schematic diagram of a log data presentation device in one embodiment;
FIG. 8 is a block diagram of a computing device in accordance with an embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The log data display method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. As shown in fig. 1, the application environment may include a front-end device 102 and a back-end device 104, wherein the front-end device 102 may be used to load and display log data, and the back-end device 104 may be used to store complete log data. In one embodiment, the front-end device 102 may be a terminal or a computer configured with a display device, and the back-end device 104 may be a server or a server cluster configured with a database.
When the algorithm engineer debugs the autopilot algorithm, the front-end device 102 may obtain corresponding log data from the back-end device 104, and store the obtained log data locally, so as to repeatedly call the log data, thereby reducing the pressure of the back-end device 104. Thus, the front-end device 102 may be divided into two parts, a data load part and a front-end presentation part. The data loading part can be used for maintaining the tree-shaped data structure and locally stored log data, and can write the log fragments into the corresponding data arrays after the log fragments are loaded, and accordingly, the tree-shaped data structure is updated. Then, the zone information (i.e. target zone information) corresponding to the next log slice to be loaded is queried, and the backend device 104 is requested to obtain the log slice. The front-end presentation part can be used for maintaining log data to be presented and continuously acquiring the log data from a local data array.
However, in the scenario of loading log data, it does not necessarily have continuity, that is, the section information of the log data to be loaded in each block is not necessarily continuous. Taking the interval information of the log data as the recording time interval as an example, because the algorithm engineer does not necessarily view the log data in sequence according to the sequence of the time axis, the front-end device 102 needs to display the log data in different time spans in the scene of log query. The front-end device 102 may obtain the initial display time input by the algorithm engineer and display the initial display time and the log data corresponding to the subsequent times. In order to enable the front-end device 102 to quickly display the corresponding log data, the front-end device 102 may determine the next log fragment to be loaded according to the currently displayed log data, instead of sequentially loading the log fragments according to the relative positions of the recording time periods corresponding to the log fragments on the time axis.
For example, the algorithm debugging process involves 30 days of log data, and for convenience of illustration, the log data of each day is divided into log fragments. The algorithm engineer may look at the 10 th-12 th day log slice first and then start watching from the 1 st day log slice. In this case, the front-end device 102 may load the log fragments corresponding to days 10 to 12 first without loading the log fragments of days 1 to 9. When the log fragment of day 1 needs to be displayed, the request is made to the backend device 104 to load the log fragment of day 1.
When the initial presentation time is adjusted, the front-end device 102 needs to determine the next log fragment that needs to be loaded according to the adjusted initial presentation time and the locally stored log data. For example, in the above example, if the front-end device 102 has loaded the log fragment on the 10 th day in advance, if the initial presentation time is the 10 th day, the front-end device 102 takes the 10 th day as the initial search time period, and determines whether the log fragment on the 10 th day exists in the local device. Since the front-end device 102 already stores the log fragments of day 10, it may determine whether the log fragments of day 11 and day 12 exist in the local device, and if not, may send a request to the back-end device 104 to obtain the log fragments of day 11-12 from the back-end device 104. In the case that the initial presentation time is adjusted to day 1, the front-end device 102 takes day 1 as an initial search period, and acquires the log data from the back-end device 104 according to the above process.
Currently, the prior art uses a way of traversing the local storage to determine the next log fragment to be loaded, which determines the next log fragment to be loaded by one of the following two ways:
(1) And traversing according to the sequence of the time period corresponding to each log fragment on the time axis by taking the first log fragment as a traversal starting point to determine the log fragments which are not loaded in the first log fragment (namely the next log fragment which needs to be loaded) after the initial display time. For example, in the above example, in the case that the initial presentation time is day 10, the front-end device needs to traverse the log fragments of days 1 to 9, so as to determine the loading condition of the log fragments of days 10 to 12.
(2) And sequentially determining whether the log fragments corresponding to the initial display time and the subsequent times are loaded or not according to the sequence of a time axis by taking the initial display time as a traversal starting point, and further determining the log fragments of which the first fragment is not loaded after the initial display time. For example, when the front-end device starts to display from the log fragment on the 10 th day again, the front-end device needs to sequentially determine the loading conditions of the log fragments on the 10 th, 11 th and 12 th days, and then can determine that the next log fragment needing to be loaded is the log fragment on the 13 th day.
When the number of log fragments stored in the front-end device reaches a certain degree, the problem of high time complexity is caused by judging the recording time period corresponding to the next log fragment through the prior art. Where the temporal complexity is a function that qualitatively describes the run-time of the algorithm.
In order to solve the problem, the method and the device can determine the target interval information with the time complexity of a logarithmic level by converting the determination problem of the next log fragment into the interval query problem of the first tree-shaped data structure, greatly reduce the time consumed in determining the target interval information under the condition of large-batch log data loading, and therefore can quickly judge the next log fragment under the conditions of no repeated loading and no log fragment omission.
In one embodiment, the present application provides a log data logging method, which may be applied to the front-end device shown in fig. 1. As shown in fig. 2, the method specifically includes the following steps:
s210, acquiring a first tree-shaped data structure, wherein the first tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each sub-log data one to one, the sub-log data corresponding to each father node is a union set of the sub-log data corresponding to each son node under the father node, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node.
The front-end device may block the total log data according to the serial number, the data size, or the recording time period to obtain multiple pieces of sub-log data. The union of all the sub-log data is equal to the total log data. The interval information of each block of sub-log data may be a sequence number corresponding to the sub-log data, a data storage address corresponding to the block of sub-log data in the total log data, or a recording period corresponding to the block of sub-log data in the total log data. In one embodiment, the first tree data structure is a segment tree or a tree array constructed by partitioning the total log data based on the total recording time period corresponding to the total log data and using the sub-recording time period corresponding to each block of sub-log data as the interval information of the block of sub-log data. For convenience of explanation, some embodiments herein describe a recording period corresponding to log data as interval information of the log data as an example.
In the first tree data structure, each leaf node corresponds to each block of sub-log data one by one, and the interval information of each leaf node is the interval information of the sub-log data corresponding to the leaf node. The child log data corresponding to each parent node is a union of the child log data corresponding to child nodes under the parent node, and the interval information of each parent node is a union of the interval information of the child log data corresponding to the parent node.
The first tree data structure may be a line segment tree or a tree array. The line segment tree is a balanced binary tree and can be used for dividing each interval with the interval length not equal to unit length delta D into a left interval and a right interval for recursive solution, and finally dividing the interval (T, T + D) into (D/. DELTA.d) subintervals, wherein T is any numerical value, and D is the interval length. The line segment tree for the maintenance interval (T, T + D) includes (D/. DELTA.d) leaf nodes, where a leaf node refers to a node in the line segment tree that has no children nodes. Each leaf node corresponds to a unit interval with the length delta d, and the interval corresponding to each father node is the union of the intervals corresponding to the two son nodes. Most interval operations can be conveniently carried out through a data structure of a line segment tree.
When a line segment tree is employed to maintain the utilization state of log data, the line segment tree may be established with the total section information of the total log data as section information of the root node of the line segment tree. In the line segment tree, the interval information of each leaf node is a sub-recording time interval of a unit time length, and it can be understood that a specific value of the unit time length can be determined according to an actual situation, which is not specifically limited by the present application. For ease of understanding, some embodiments are described with a unit duration of 100ms as an example.
In the line segment tree, each node has its corresponding identification value, and the value of the identification value may be used to reflect utilization state information representing sub-log data corresponding to the node, where the utilization state information may be, but is not limited to, loading state information or rendering state information. When the utilization state information is loading state information, it may reflect whether the corresponding sub-log data has been completely loaded, and/or the number of loaded log fragments in the sub-log data corresponding to the node. Because each leaf node in the line segment tree corresponds to one piece of sub-log data, the application can record the utilization state information of each log fragment through the identification value of each leaf node.
For example, the first tree data structure may be constructed by partitioning the total log data according to the recording time period corresponding to the total log data, and then using the sub-recording time period corresponding to each block of sub-log data as the interval information of the block of sub-log data. In this case, if the total recording period is [ T, T +800ms ], the loading state information of each log slice may be recorded through the line segment tree shown in fig. 3. In the line segment tree shown in fig. 3, the interval information of the root node S1 is [ T, T +800ms ], the interval information of the node S2 is [ T, T +400ms ], the interval information of the node S3 is [ T +401ms, T +800ms ], the interval information of the node S4 is [ T, T +200ms ], the interval information of the node S5 is [ T +201ms, T +400ms ], the interval information of the node S6 is [ T +401ms, T +600ms ], and the interval information of the node S7 is [ T +601ms, T +800ms ]. The interval information of the leaf node S8 is [ T, T +100ms ], the interval information of the leaf node S9 is [ T +101ms, T +200ms ], the interval information of the leaf node S10 is [ T +201ms, T +300ms ], the interval information of the leaf node S11 is [ T +301ms, T +400ms ], the interval information of the leaf node S12 is [ T +401ms, T +500ms ], the interval information of the leaf node S13 is [ T +501ms, T +600ms ], the interval information of the leaf node S14 is [ T +601ms, T +700ms ], and the interval information of the leaf node S15 is [ T +701ms, T +800ms ].
When a tree array is used to maintain the total interval information of the log data, the tree array can be used to maintain the original data array. Taking the total interval information as the total recording time period as an example for explanation, the value of the nth element in the original data array is used to represent the utilization state information of the sub-log data corresponding to the nth sub-recording time period. The nth sub-recording period is a period interval of which the nth interval length is a unit duration in the total recording period. For example, when the total recording period is [ T, T +800ms ], the unit duration is 100ms, the 1 st sub-recording period is [ T, T +100ms ], the 2 nd sub-recording period is [ T +101ms, T +200ms ], the 3 rd to 8 th sub-recording periods and so on. The value of the 1 st element in the original data array is used for representing the utilization state information of the sub-log data corresponding to [ T, T +100ms ], the value of the 2 nd element is used for representing the utilization state information of the sub-log data corresponding to [ T +101ms, T +200ms ], and the values of the 3 rd to 8 th elements can be pushed according to the type.
In this embodiment, a node of the tree array refers to an element in the tree array, an identification value of each node in the tree array is a sum of values of M elements maintained by the node in the original data array, and interval information of each node in the tree array is a union of sub-recording periods corresponding to the M elements. The elements maintained by each node of the tree array can be determined according to the prior art, and both N and M are positive integers.
For example, in the above example, the 1 st node of the tree array (i.e. the 1 st element of the tree array) is used to maintain the 1 st element of the original data array, and the identification value of the 1 st node of the tree array is equal to the value of the 1 st element in the original data array. The 2 nd node of the tree array is used for maintaining the 1 st element and the 2 nd element of the original data array, and the identification value of the 2 nd node of the tree array is the sum of the value of the 1 st element and the value of the 2 nd element in the original data array.
S220, determining an initial search interval, and inquiring the first tree-shaped data structure according to the initial search interval and a preset inquiry rule to obtain target interval information corresponding to the sub-log data to be displayed.
In one embodiment, the initial search interval may be determined based on parameters entered by an algorithm engineer.
After the initial search interval is obtained, the front-end device may query the first tree-shaped data structure according to the initial search interval, a preset query rule, and an identification value of each node in the first tree-shaped data structure, so as to obtain interval information corresponding to the sub-log data to be displayed, that is, target interval information. In one embodiment, the target interval information may be interval information of sub-log data corresponding to a leaf node, where the target interval information is interval information corresponding to a next log slice that needs to be loaded.
And S230, loading the sub-log data corresponding to the target interval information to local equipment. The local device is the front-end device described in the embodiments herein.
In one embodiment, the front-end device may determine, according to the target interval information, an address of a next log fragment that needs to be loaded, and send a data acquisition request to the back-end device based on the address, so as to instruct the back-end device to send the log fragment corresponding to the address to the front-end device, thereby completing loading of the next log fragment.
In this embodiment, the first tree data structure is a segment tree or a tree array, the first tree data structure is constructed according to the interval information of each block of sub-log data, and each block of sub-log data is a result obtained by partitioning the total log data. The segment tree and the tree array can divide the complete interval information corresponding to the total log data into a plurality of subintervals for management, each leaf node in the segment tree corresponds to one piece of sub-log data, and each node in the tree array corresponds to at least one piece of sub-log data, so that the utilization state information of the sub-log data corresponding to the node can be recorded through each node of the first tree data structure, and the problem of determining the next log fragment is converted into the problem of inquiring the interval of the first tree data structure.
Before loading the next log fragment, the method and the device can query the first tree-shaped data structure based on the initial search interval and a preset query rule to obtain interval information corresponding to the sub-log data to be displayed, namely target interval information. The target interval information is the interval information corresponding to the next log segment. Compared with the traversing and searching mode in the prior art, the method and the device can determine the target interval information with the time complexity of the logarithmic level, greatly reduce the time consumed in determining the target interval information in the scene of loading large-batch log data, and further improve the loading efficiency of the log data.
In an embodiment, the first tree data structure is a segment tree or a tree array constructed by partitioning the total log data based on a total recording time period corresponding to the total log data and using a sub-recording time period corresponding to each block of sub-log data as interval information of the block of sub-log data. The identification value of each node in the first tree data structure is used for representing utilization state information of the sub-log data corresponding to the node, and the utilization state information is used for reflecting whether the sub-log data corresponding to the node is loaded, that is, the utilization state information is loading state information.
The first tree data structure is a segment tree or a tree array constructed by interval information with a total recording time interval as a root node, so that the first tree data structure can be queried according to a time interval during query. That is, the aforementioned start search interval may be a start search period.
In one embodiment, the starting search period may be determined according to the starting presentation time input by the algorithm engineer, and in one example, the starting search period may be a sub-recording period with the interval length of the starting presentation time being a unit duration.
In one embodiment, when the initial search interval is the initial search time period, the front-end device may use a recording time period to which currently displayed log data belongs as the display time period, and determine the initial search time period according to the display time period and a preset loading rule. The preset loading rule may be determined according to actual conditions, which is not specifically limited in this application. For example, the preset loading rule may be to have the presentation period as the initial search period. Or, the front-end device uses the difference between the starting time of the presentation time interval and the preset threshold as the starting time of the starting search time interval, and uses the difference between the ending time of the presentation time interval and the preset threshold as the ending time of the starting search time interval. In this way, according to the present application, after a loading rule that partially meets a condition is set (for example, after a certain log fragment is loaded, the 1 st log fragment that is not loaded), a recording time period corresponding to a next log fragment that needs to be loaded is determined with a logarithmic scale of time complexity, so that the determination time for data loading can be greatly reduced, and the loading efficiency of log data can be improved.
The step of querying the first tree data structure according to the initial search interval and a preset query rule to obtain target interval information corresponding to the sub-log data to be displayed includes: inquiring the first tree-shaped data structure according to the initial search time period to obtain target interval information corresponding to the sub-log data to be displayed; and the target interval information is the earliest sub-recording time period which is not earlier than the initial searching time period in the sub-recording time period corresponding to the unloaded sub-log data of each block.
After obtaining the initial search time period, the front-end device may query the first tree data structure according to the initial search time period and the identification value of each node in the first tree data structure, and determining the loading state of the log fragment corresponding to each sub-recording time interval which is not earlier than the initial searching time interval, and accordingly obtaining a target loading time interval, wherein the target loading time interval is target interval information. In one embodiment, the target loading period may be interval information of a leaf node, and the target loading period is a recording period corresponding to a next log slice that needs to be loaded.
In the above example where the total recording period is [ T, T +800ms ], the unit duration is 100ms, if the presentation period is [ T, T +100ms ], the initial seek period may be [ T +101ms, T +200ms ]. The front-end device can query the line segment tree, determine the loading state information of the log fragments corresponding to each node according to the identification value of each node, and determine the target loading time period accordingly. For example, when the log fragments corresponding to the leaf nodes S8 to S11 are all loaded, the front-end device may know this situation according to the identification value of the node S2, and further determine the target loading period according to the identification values of the node S3, the node S6, the node S7, and/or the leaf nodes 12 to 15, without traversing the leaf nodes S8 to S11.
For example, in the above example where the total recording period is [ T, T +800ms ], the unit duration is 100ms, if the presentation period is [ T, T +100ms ], the initial seek period may be [ T +101ms, T +200ms ]. The front-end equipment can inquire the line segment tree, determine the utilization state information of the log fragments corresponding to each node according to the identification value of each node, and determine the target interval information. For example, when the log fragments corresponding to the leaf nodes S8 to S11 are all loaded, the front-end device may know this situation according to the identification value of the node S2, and further determine the target interval information according to the identification values of the node S3, the node S6, the node S7, and/or the leaf nodes 12 to 15, without traversing the leaf nodes S8 to S11.
In this embodiment, before loading the next log fragment, the first tree data structure may be queried based on the initial search time period, and an earliest sub-recording time period not earlier than the initial search time period may be determined from the sub-recording time periods corresponding to the unloaded sub-log data of each block based on the query result, and the earliest sub-recording time period may be used as the target interval information. The target interval information is the recording time interval corresponding to the next log fragment. Therefore, the target interval information can be determined according to the time complexity of the logarithmic scale, the time consumed in determining the next log fragment is greatly reduced in the scene of loading the large amount of log data, and the loading efficiency of the log data is further improved.
In one embodiment, when the first tree data structure is a tree array, the identification value of each node in the tree array is the sum of the values of M elements maintained by the node in the original data array, and the interval information of each node in the tree array is the union of the sub-recording periods corresponding to the M elements. For example, the 2 nd node in the tree array is used to maintain the 1 st element and the 2 nd element of the original data array, and the interval information of the 2 nd node in the tree array is the union of the sub-recording period corresponding to the 1 st element in the original data array and the sub-recording period of the 2 nd element in the original data array.
When the first tree data structure is a tree array, the log data display method of the application may further include: and under the condition that the sub-log data corresponding to the target interval information is loaded completely, updating the identification value of each target node according to the first preset value so as to update the original data array. The interval information of the target node comprises the target interval information.
It can be understood that the value of the first preset value can be determined according to actual situations, and the application does not specifically limit this. In one example, the first preset value may be 1.
Specifically, after the next log fragment (i.e., the log data corresponding to the target interval information) is loaded, the front-end device may update the first tree data structure, so that the identifier value of each node in the first tree data structure can accurately reflect the latest loading state of each log fragment. When the first tree data structure is a tree array, the front-end device may use a node in the tree array whose interval information includes target interval information as a target node, and update an identification value of each target node according to a first preset value, so that a value of each element in the original data array may reflect a latest loading state of each log fragment.
For example, in an example where the total recording period is [ T, T +800ms ], and the unit duration is 100ms, the 4 th node of the tree array is used to maintain the 1 st to 2 nd elements in the original data array, and the 4 th node of the tree array is used to maintain the 1 st to 4 th elements in the original data array. Therefore, when the front-end device loads the log fragment corresponding to the 2 nd element of the original data, that is, when the log data corresponding to the time period [ T +101ms, T +200ms ] is loaded, the identification value of the 2 nd node and the identification value of the 4 th node in the tree array need to be updated.
In one embodiment, in the process of updating the target nodes, for each target node, the front-end device may add the identification value of the target node to the first preset value, and use the addition result as the updated identification value of the target node.
In this embodiment, after the next log segment is loaded, the front-end device may update the identification value of the target node, so that the identification value of each node in the first tree data structure may accurately reflect the latest loading state of each log segment, further reduce the time consumed in determining the target interval information, and improve the loading efficiency of the log data.
In one embodiment, if the first tree data structure is a segment tree, the log data presentation method may further include the steps of: and under the condition that the sub-log data corresponding to the target interval information is loaded completely, taking a first preset value as an identification value of a target leaf node in the first tree data structure, and updating the identification value of each upper layer node of the target leaf node according to the first preset value. The target leaf node is a leaf node corresponding to first target sub-log data, and the first target sub-log data is sub-log data corresponding to the target interval information.
Specifically, in a case where the first tree data structure is a line segment tree, the front-end device may determine, from the line segment tree, a target leaf node for recording the utilization state information of the next log fragment, modify an identification value of the target leaf node to a first preset value, and update an identification value of each upper node of the target leaf node according to the first preset value. In one embodiment, for each upper node, the front-end device may add the original identification value of the upper node to the first preset value, and use the addition result as the updated identification value of the upper node.
Each upper node of the target leaf node may be a node whose interval information includes target interval information. For example, in the line segment tree shown in fig. 3, the upper nodes of the leaf nodes S12 include a node S6, a node S3, and a root node S1.
The modification of the identification value of the target leaf node is a single-point modification problem of the segment tree, the efficiency of the single-point modification problem is the same as that of a normal segment tree, and time complexity verification is not performed in the embodiment of the application.
In this embodiment, after the next log segment is loaded, the front-end device may update the identification value of the target leaf node and the identification value of each upper node of the target leaf node, so that the identification value of each node in the first tree data structure may accurately reflect the latest loading state of each log segment, further reduce the time consumed in determining the target interval information, and improve the loading efficiency of log data.
In one embodiment, the front-end device may apply for the corresponding storage space for each node when building the tree, that is, after building the line segment tree, each node has been allocated with the storage space. The front-end equipment can write the identification value of each node into the storage space corresponding to the node.
In this case, the step of using the first preset value as the identification value of the target leaf node in the first tree data structure may include: and traversing the first tree data structure according to the target interval information to determine a storage space corresponding to the target leaf node, and writing a first preset value into the storage space corresponding to the target leaf node.
For example, in the example shown in fig. 3-4, if the target interval information is [ T +601ms, T +700ms ], the front-end device may traverse the first tree data structure accordingly to determine the storage space corresponding to the target leaf node S14, and write the first preset value into the storage space corresponding to the target leaf node S14, so as to update the identification value of the target leaf node according to the latest loading state of the log fragment. It is to be understood that, the present application may implement traversal of the first tree data structure by using any algorithm in the prior art to determine the storage space corresponding to the target leaf node, which is not specifically limited in this application.
The front-end device can also determine a storage space corresponding to each upper layer node of the target leaf node, and write the updated identification value of each upper layer node into the corresponding storage space to complete the update of the identification value of the upper layer node. It should be noted that, the identification value of the upper node and the identification value of the target leaf node are updated, and there is no necessary sequential execution order between the two, and the application may update the identification value of the upper node first and then the identification value of the target leaf node, or may update the identification value of the target leaf node first and then the identification value of the upper node.
In this embodiment, since the storage space is already allocated to each node in the segment tree, when the identification values of the target leaf node and each upper node are updated, the updated identification values can be directly written into the storage space without waiting for memory allocation, so that the loading efficiency of log data can be further improved.
In one embodiment, if the front-end device applies for a storage space for each node when building a tree, the front-end device still needs to reserve a storage space with a length 4 times of the total number of log fragments for the segment tree even though the algorithm engineer does not need to load complete log data. For example, if the total number of log fragments is 100, the front-end device needs to reserve a storage space with a length of 400 for the segment tree. Under the scene of loading large quantities of log data, the implementation mode can cause the line segment tree to occupy excessive storage space, and the normal operation of other processes of the front-end equipment is influenced.
In order to improve the operational reliability of the front-end device and reduce the configuration requirement on the front-end device, the embodiment may dynamically apply for the storage space of the corresponding node to the memory, that is, in the process of assigning the value to the target leaf node, the front-end device may apply for the storage space for the target leaf node or an upper node of the target leaf node in a recursive traversal. Under the condition that the sub-log data corresponding to a certain leaf node is not loaded, the front-end device may not allocate the storage space of the leaf node. When the segment tree is just built, if the front-end device has not loaded any log fragment, the segment tree may only include the root node.
As shown in fig. 5, if the target leaf node is not allocated with a storage space, the step of using the first preset value as the identification value of the target leaf node in the first tree data structure includes:
traversing the first tree data structure according to the target interval information, and executing the following steps for the current traversal node:
s310, determining a target child node corresponding to first target child log data from child nodes of the node;
s320, if the target son node is not allocated with the storage space, applying for the storage space for the target son node;
s330, judging whether the target son node is a target leaf node, if not, entering the step S340, and if so, entering the step S350;
s340, under the condition that the target son node is not the target leaf node, writing a second preset value serving as an identification value of the target son node into a corresponding storage space, taking the target son node as a next traversal node, and entering the step S310;
and S350, under the condition that the target son node is the target leaf node, writing the first preset value serving as the identification value of the target leaf node into the corresponding storage space.
For example, in the examples shown in fig. 3 and 6, the front-end device may traverse in the direction from the root node to the leaf node while assigning the identification value of the target leaf node S14 to the first preset value. When the currently traversed node is the root node S1, the root node S1 includes two children nodes, which are a node S2 and a node S3, respectively. The interval information of the node S2 is [ T, T +400ms ], and the interval information of the node S3 is [ T +401ms, T +800ms ]. Thus, the head-end may have node S3 as the target child node. Since the node S3 is already allocated with the storage space, the node S3 can be used as the next traversal node, and the next round of determination is started.
In the next round of judgment, the currently traversed node is the node S3, the son node S7 of the node S3 is taken as a target son node, and whether the node S7 is allocated with a storage space is judged. Since the node S7 is not allocated with a storage space, the front-end device may apply for the storage space for the node S7. Since the node S7 is not a target leaf node, the second preset value may be written into the corresponding storage space as the identification value of the node S7, and the node S7 is used as the next traversal node, and the next two rounds of determination are started.
It can be understood that the value of the second preset value can be determined according to actual situations, and the application does not specifically limit this. In one example, the second preset value may be 0.
In the next two rounds of judgment, the currently traversed node is the node S7, and the child node S14 of the node S7 is taken as a target child node, and whether the leaf node S14 has been allocated a storage space is judged. Since the leaf node S14 is not allocated a storage space, the front-end device may apply for the storage space for the leaf node S14. Since S14 is the target leaf node, the first preset value may be written into the corresponding storage space as the identification value of the leaf node S14.
In one embodiment, the front-end device may determine whether the target children node is allocated storage by determining whether a pointer to the target children node is a null pointer. If the pointer is a null pointer, it may be determined that the target child node is not allocated memory. If the pointer is not a null pointer, it may be determined that the target child node has been allocated memory.
In one embodiment, the identification value of each parent node in the first tree data structure is the sum of the identification values of the children nodes under the parent node, that is, the identification value of a tree node in the segment tree may reflect the sum of the intervals of the children nodes of the tree node, and thus, the tree node in the segment tree may maintain the intervals and the problems. The tree node refers to other nodes except leaf nodes in the segment tree. The interval information of each parent node is a union of child recording time periods of child log data corresponding to child nodes under the parent node, in other words, the interval information of each parent node is a union of child recording time periods corresponding to third target child log data of the parent node, and the third target child log data is child log data corresponding to the parent node.
The steps of inquiring the first tree data structure according to the initial search time period and determining target interval information based on the inquiry result comprise:
traversing the first tree data structure in a direction from the root node to the leaf nodes, for a currently traversed node performing the steps of:
if the current traversal node is a leaf node and the identification value of the current traversal node is a second preset value, taking a sub-recording time period corresponding to second target sub-log data as the target interval information, wherein the second target sub-log data is sub-log data corresponding to the current traversal node;
if the current traversal node is not allocated with the memory space, taking the earliest sub-recording time period which is not earlier than the initial searching time period in the interval information of the current traversal node as target interval information;
if the current traversal node is not a leaf node and the current traversal node is allocated with a storage space, judging whether sub-log data corresponding to the current traversal node is completely loaded or not according to a comparison result between the interval length of the interval information of the current traversal node and the identification value of the current traversal node, and obtaining a judgment result; and determining the next traversal node based on the judgment result and the initial search time period.
Specifically, when determining the target interval information, the front-end device may query the first tree data structure in a direction from the root node to the leaf node. If the storage space of the current traversal node is not allocated, the log data corresponding to the current traversal node can be indicated to be not loaded at all, and therefore target interval information can be determined according to the interval information of the current traversal node.
Considering that the identification value of the leaf node in the segment tree is used for maintaining the loading state of the corresponding log fragment, the identification value of the leaf node is a second preset value under the condition that the corresponding log fragment is not loaded, and the identification value of the leaf node is a first preset value under the condition that the corresponding log fragment is loaded. Meanwhile, the parent node of the segment tree maintains intervals and questions, and thus, the query question of the target interval information can be converted into: and inquiring the leaf node of which the first identification value is the second preset value after a certain leaf node is inquired.
Because the identification value of the parent node in the segment tree can reflect the sum of the intervals of the child nodes of the parent node, the single query problem of the segment tree can be converted into the following steps based on the segment tree interval summation method: and searching incompletely loaded intervals, such as searchable intervals and intervals smaller than the interval length, on the line segment tree according to the interval sum and the interval length of each node. In this case, the time complexity of judging whether all leaf nodes in the parent node have been loaded is O (1), and the child nodes of the node are recursively queried at the same time, so the total time complexity is the same as the sum of the segment tree intervals and is O (log n). Where O (log n) is the maximum execution time required for any maximum input n, and the base of log is 2 unless otherwise specified.
Under the condition that the current traversal node is allocated with a storage space and is a father node, the embodiment of the application can judge whether log data corresponding to the current traversal node is completely loaded according to the comparison result between the interval length of the interval information of the current traversal node and the identification value of the current traversal node, and obtain the judgment result, so that the front-end device can determine the next traversal node according to the judgment result and the initial search time period. The interval length refers to a ratio of a duration corresponding to the interval information to a unit duration.
For example, when the first preset value is 1 and the second preset value is 0, the front-end device may determine that the sub-log data corresponding to the current traversal node is not completely loaded when the identification value of the current traversal node is smaller than the interval length of the node; and when the identification value of the current traversal node is equal to the interval length of the node, determining that the sub-log data corresponding to the current traversal node is completely loaded. If the sub-log data corresponding to the current traversal node is not completely loaded, a son node of the current traversal node can be used as a next traversal node according to the initial search time period. If the log data corresponding to the current traversal node is completely loaded, the parent node of the current traversal node can be used as the next traversal node.
In this embodiment of the present application, the identification value of each parent node in the first tree data structure is the sum of the identification values of the child nodes under the parent node, and the single query problem of the segment tree can be converted into: and searching the incompletely loaded interval on the line segment tree according to the interval sum and the interval length of each node. In this way, fast query of the segment tree can be realized, so as to further reduce the time consumed in determining the target interval information, and the loading efficiency of log data is improved.
To facilitate an understanding of the benefits of the present application with respect to the prior art, several simulation scenarios are provided herein, wherein the log data is divided into 2 in each simulation scenario 31 The total number of slice log slices, i.e. log slices, is 2147482648.
Simulating a first scene: no log fragment is loaded, and the front-end equipment starts to apply for loading from the 1 st log fragment;
simulating a scene two: no log shards are loaded and the front-end device is driven from 2 nd 30 The fragment log fragments start to apply for loading;
simulating a scene three: 1 st to 2 nd 30 The slice log fragments are already loaded, and the front-end equipment starts to apply for loading from the 1 st slice log fragment;
and (4) simulating a scene four: (2 th) 30 +1)~2 31 The slice log shard has already been loaded, and the front-end equipment is from 2 nd 29 The fragment log fragments start to apply for loading;
simulating a scene five: almost all log fragments are loaded, only 2 nd 31 The method comprises the following steps that (1) a piece of log fragment is not loaded, and front-end equipment starts to apply for loading from a 1 st piece of log fragment;
and (6) simulating a scene six: almost all log fragments are loaded, only 2 nd 31 The slice log slice is not loaded, and the front-end equipment is from 2 nd 31 The sharding of the sharding log starts to apply for loading.
If the number of operations per second of the front-end equipment is about 10 8 Time of each operation is 10 -8 And second. For each log fragment, the interval information of the sub-recording time period corresponding to the log fragment is included in the online segment treeThe number is 31.
For the simulation scene one, the first prior art needs 1 operation, the second prior art needs 1 operation, and the solution of the present application needs 62 operations.
For the simulation scene two, the first prior art needs 1 operation, the second prior art needs 1 operation, and the scheme of the present application needs 62 operations.
For the simulation scenario three, the first prior art described above requires 2 30 The second prior art requires 2 30 The scheme of the application needs 62 times of operations.
For the simulation scenario four, the first prior art requires 1 operation, and the second prior art requires 2 operations 29 The scheme of the application needs 62 times of operations.
For simulation scenario five, the first prior art requirement described above (2) 31 -1) operations, the second prior art mentioned above requiring (2) 31 1) operation, and the scheme of the application needs 62 operations.
For simulation scenario six, the first prior art requirement (2) described above 31 -1) operations, the second prior art described above requires 1 operation, and the solution of the present application requires 62 operations.
The time required for the solution of the present application is fixed for all simulated scenarios, approximately 62/10 -8 =6.2*10 -7 And second. Whereas both prior art solutions have more than 2 29 In the case of the sub-operation, the required operation time is more than 5.36 seconds. For the front-end equipment, the operation time 10 -8 Seconds and 6.2 x 10 -7 The second is basically considered as equal, so the scheme of the application can greatly optimize the scheduling problem in a large-batch log data loading scene under the condition of basically not sacrificing the small data loading performance.
In one embodiment, the log data presentation method further comprises: a second tree data structure is obtained. The second tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the second tree data structure, each leaf node corresponds to each piece of the sub-log data one to one, the sub-log data corresponding to each parent node is a union of the sub-log data corresponding to each child node under the parent node, and the identification value of each node in the second tree data structure is used for representing the total data volume of the sub-log data corresponding to the node. In one embodiment, the second tree data structure may be a segment tree or a tree array constructed by interval information using a total recording period of the log data as a root node, and the identification value of each node in the second tree data structure is used to represent a total data volume of each block of sub-log data corresponding to the node.
The step of loading the log data corresponding to the target interval information includes:
searching the second tree-shaped data structure based on the target interval information to obtain the data volume to be loaded of the log data corresponding to the target interval information;
acquiring the loaded data volume, and adding the loaded data volume and the data volume to be loaded to obtain an expected data volume;
judging whether sub-log data corresponding to the target interval information is loaded or not based on a comparison result of the expected data volume and a preset data volume threshold; and if the sub-log data corresponding to the loading target interval information is not loaded, the sub-log data corresponding to the loading target interval information is not loaded.
Specifically, the front-end device may record the data amount corresponding to each log slice through the second tree data structure. When the log data is loaded, the front-end device may query, from the second tree data structure, a data amount corresponding to a next log fragment that needs to be loaded, and determine a sum of data amounts of the log data that has been loaded and is to be loaded in the front-end device according to the data amount, where the sum of the data amounts is an expected data amount, so as to determine whether to load the next log fragment according to the expected data amount. Therefore, the normal operation of other processes of the front-end equipment can be prevented from being influenced by excessive log data loading, and the operation reliability of the front-end equipment can be improved.
The log data display device provided in the embodiment of the present application is described below, and the log data display device described below and the log data display method described above may be referred to in correspondence with each other.
In one embodiment, the present application provides a log data presentation apparatus 400. As shown in fig. 7, the apparatus includes a tree data structure obtaining module 410, a target interval information determining module 420, and a loading module 430. Wherein:
a tree data structure obtaining module 410, configured to obtain a first tree data structure; the first tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each piece of sub-log data one to one, the sub-log data corresponding to each father node is a union set of the sub-log data corresponding to each son node under the father node, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node;
a target interval information determining module 420, configured to determine an initial search interval, and query the first tree data structure according to the initial search interval and a preset query rule, so as to obtain target interval information corresponding to sub-log data to be displayed;
a loading module 430, configured to load the sub-log data corresponding to the target interval information to a local device.
In one embodiment, the first tree data structure is a segment tree or a tree array constructed by partitioning the total log data based on a total recording time period corresponding to the total log data and taking a sub-recording time period corresponding to each block of sub-log data as interval information of the block of sub-log data; the initial search interval is an initial search time period.
And the identification value of each node in the first tree data structure is used for representing the utilization state information of the sub-log data corresponding to the node, and the utilization state information is used for reflecting whether the sub-log data corresponding to the node is loaded or not.
The target interval information determination module 420 includes a target period determination unit. The target time interval determining unit is used for inquiring the first tree-shaped data structure according to the initial searching time interval so as to obtain target interval information corresponding to the sub-log data to be displayed; and the target interval information is the earliest sub-recording time period which is not earlier than the initial searching time period in the sub-recording time period corresponding to the unloaded sub-log data of each block.
In one embodiment, if the first tree data structure is a segment tree, the apparatus further includes a first identification value updating module. The first identification value updating module is used for taking a first preset value as an identification value of a target leaf node in the first tree data structure under the condition that sub-log data corresponding to the target interval information is loaded completely, and updating the identification value of each upper layer node of the target leaf node according to the first preset value; the target leaf node is a leaf node corresponding to first target sub-log data, and the first target sub-log data is sub-log data corresponding to the target interval information.
In one embodiment, the first identification value update module includes a first traversal unit when the target leaf node is not allocated storage space. The first traversal unit is configured to traverse the first tree data structure according to the target interval information, and execute the following steps for a current traversal node:
determining a target child node corresponding to the first target child log data from child nodes of the node; if the target son node is not allocated with the storage space, applying for the storage space for the target son node; under the condition that the target son node is not the target leaf node, writing a second preset value serving as an identification value of the target son node into a corresponding storage space, and using the target son node as a next traversal node; and under the condition that the target son node is the target leaf node, writing the first preset value serving as the identification value of the target leaf node into a corresponding storage space.
In one embodiment, the first identification value update module includes a second traversal unit when the target leaf node has been allocated storage space. The second traversal unit is configured to traverse the first tree data structure according to the target interval information to determine a storage space corresponding to the target leaf node, and write the first preset value into the storage space corresponding to the target leaf node.
In an embodiment, the identification value of each parent node in the first tree data structure is a sum of identification values of children nodes under the parent node, and the interval information of each parent node is a child recording time period union of child log data corresponding to the children nodes under the parent node. The target period determination unit comprises a third traversal unit for traversing the first tree data structure in a direction from a root node to a leaf node, for a currently traversed node performing the following steps:
if the current traversal node is a leaf node and the identification value of the current traversal node is a second preset value, taking a sub-recording time period corresponding to second target sub-log data as the target interval information, wherein the second target sub-log data is sub-log data corresponding to the current traversal node; if the current traversal node is not allocated with the memory space, taking the earliest sub-recording time period which is not earlier than the initial searching time period in the interval information of the current traversal node as the target interval information; if the current traversal node is not a leaf node and the current traversal node is allocated with a storage space, judging whether sub-log data corresponding to the current traversal node is completely loaded or not according to a comparison result between the interval length of the interval information of the current traversal node and the identification value of the current traversal node, and obtaining a judgment result; and determining the next traversal node based on the judgment result and the initial search time period.
In one embodiment, the first tree data structure is a tree array used for maintaining an original data array, and a value of an nth element in the original data array is used for representing utilization state information of sub-log data corresponding to an nth sub-recording period; the Nth sub-recording time interval is a time interval with the length of the Nth interval as unit duration in the total recording time interval; the identification value of each node in the first tree data structure is the sum of values of M elements maintained by the node in the original data array, and the interval information of each node in the first tree data structure is the union of the sub-recording time periods corresponding to the M elements. The apparatus also includes a second identification value update module. The second identification value updating module is used for updating the identification value of each target node according to a first preset value under the condition that the log data corresponding to the target interval information is loaded completely so as to update the original data array; wherein the interval information of the target node includes the target interval information.
In one embodiment, the tree data structure obtaining module 410 is further configured to obtain a second tree data structure; the second tree data structure is a segment tree or a tree array constructed based on interval information of each block of sub-log data after the total log data is partitioned; in the second tree data structure, each leaf node corresponds to each piece of the sub-log data one to one, the sub-log data corresponding to each parent node is a union of the sub-log data corresponding to each child node under the parent node, and the identification value of each node in the second tree data structure is used for representing the total data volume of the sub-log data corresponding to the node.
The loading module 430 includes a to-be-loaded data amount acquisition unit, an expected data amount acquisition unit, and a loading unit. The data volume to be loaded acquiring unit is configured to search the second tree data structure based on the target interval information to obtain data to be loaded of the log data corresponding to the target interval information. The expected data volume obtaining unit is used for obtaining the loaded data volume and adding the loaded data volume and the data volume to be loaded to obtain the expected data volume. The loading unit is used for judging whether to load the sub-log data corresponding to the target interval information or not based on the comparison result of the expected data volume and a preset data volume threshold; and if the target interval information is not the sub-log data, the sub-log data corresponding to the target interval information is not loaded.
In one embodiment, the target interval information determination module 420 includes a start search period determination unit. The initial search time period determining unit is used for taking a recording time period to which the log data currently displayed by the front-end equipment belongs as a display time period and determining the initial search time period according to the display time period and a preset loading rule.
In one embodiment, the present application further provides a storage medium having stored therein computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the log data presentation method as described in any one of the above embodiments.
In one embodiment, the present application further provides a computer device having computer readable instructions stored therein, which when executed by one or more processors, cause the one or more processors to perform the steps of the log data presentation method as described in any one of the above embodiments.
Fig. 8 is a schematic diagram illustrating an internal structure of a computer device according to an embodiment of the present application, and the computer device 900 may be provided as a server, as shown in fig. 8. Referring to fig. 8, computer device 900 includes a processing component 902 that further includes one or more processors, and memory resources, represented by memory 901, for storing instructions, e.g., applications, that are executable by processing component 902. The application programs stored in memory 901 may include one or more modules that each correspond to a set of instructions. Further, the processing component 902 is configured to execute the instructions to perform the log data presentation method of any of the embodiments described above.
The computer device 900 may also include a power component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input/output (I/O) interface 905. The computer device 900 may operate based on an operating system stored in memory 901, such as Windows Server, mac OS XTM, unix, linux, free BSDTM, or the like.
Finally, it should also be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element. As used herein, the terms "a," "an," "the," and "the" can also include the plural forms as well, unless the context clearly indicates otherwise. Plural means at least two cases, such as 2, 3, 5 or 8, etc. "and/or" includes any and all combinations of the associated listed items.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, the embodiments may be combined as needed, and the same and similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (12)
1. A log data presentation method, characterized in that the method comprises:
acquiring a first tree data structure; the first tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each piece of sub-log data one to one, the sub-log data corresponding to each father node is a union set of the sub-log data corresponding to each son node under the father node, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node;
determining an initial search interval, and inquiring the first tree-shaped data structure according to the initial search interval and a preset inquiry rule to obtain target interval information corresponding to sub-log data to be displayed;
and loading the sub-log data corresponding to the target interval information to local equipment.
2. The log data presentation method according to claim 1, wherein the first tree data structure is a segment tree or a tree array constructed by partitioning the total log data based on a total recording period corresponding to the total log data and using a sub-recording period corresponding to each piece of sub-log data as interval information of the piece of sub-log data; the initial search interval is an initial search time interval;
the identification value of each node in the first tree data structure is used for representing the utilization state information of the sub-log data corresponding to the node, and the utilization state information is used for reflecting whether the sub-log data corresponding to the node is loaded or not;
the step of querying the first tree data structure according to the initial search interval and a preset query rule to obtain target interval information corresponding to the sub-log data to be displayed includes:
inquiring the first tree-shaped data structure according to the initial search time period to obtain target interval information corresponding to the sub-log data to be displayed; and the target interval information is the earliest sub-recording time period which is not earlier than the initial searching time period in the sub-recording time period corresponding to the unloaded sub-log data of each block.
3. The log data presentation method of claim 2, wherein if the first tree data structure is a line tree, the method further comprises:
under the condition that the sub-log data corresponding to the target interval information is loaded completely, taking a first preset value as an identification value of a target leaf node in the first tree data structure, and updating the identification value of each upper layer node of the target leaf node according to the first preset value;
the target leaf node is a leaf node corresponding to first target sub-log data, and the first target sub-log data is sub-log data corresponding to the target interval information.
4. The log data presentation method of claim 3, wherein when the target leaf node is not allocated a storage space, the step of using the first preset value as an identification value of the target leaf node in the first tree data structure comprises:
traversing the first tree data structure according to the target interval information, and executing the following steps for the current traversal node:
determining a target child node corresponding to the first target child log data from child nodes of the node;
if the target son node is not allocated with the storage space, applying for the storage space for the target son node;
under the condition that the target son node is not the target leaf node, writing a second preset value serving as an identification value of the target son node into a corresponding storage space, and using the target son node as a next traversal node;
and under the condition that the target son node is the target leaf node, writing the first preset value serving as the identification value of the target leaf node into a corresponding storage space.
5. The log data presentation method of claim 3, wherein when the target leaf node has been allocated storage space, the step of using the first preset value as an identification value of the target leaf node in the first tree data structure comprises:
traversing the first tree data structure according to the target interval information to determine a storage space corresponding to the target leaf node, and writing the first preset value into the storage space corresponding to the target leaf node.
6. The log data presentation method of any one of claims 3 to 5, wherein the identification value of each parent node in the first tree data structure is a sum of identification values of child nodes under the parent node; the interval information of each father node is a child recording time interval union set of child log data corresponding to child nodes under the father node;
the step of querying the first tree data structure according to the initial search time period to obtain target interval information corresponding to the sub-log data to be displayed includes:
traversing the first tree data structure in a direction from a root node to a leaf node, for a currently traversed node performing the steps of:
if the current traversal node is a leaf node and the identification value of the current traversal node is a second preset value, taking a sub-record time period corresponding to second target sub-log data as the target interval information, wherein the second target sub-log data is sub-log data corresponding to the current traversal node;
if the current traversal node is not allocated with the memory space, taking the earliest sub-recording time period which is not earlier than the initial searching time period in the interval information of the current traversal node as the target interval information;
if the current traversal node is not a leaf node and the current traversal node is allocated with a storage space, judging whether the sub-log data corresponding to the current traversal node is completely loaded or not according to a comparison result between the interval length of the interval information of the current traversal node and the identification value of the current traversal node, and obtaining a judgment result; and determining the next traversal node based on the judgment result and the initial search time period.
7. The log data presentation method of claim 2, wherein the first tree data structure is a tree array for maintaining an original data array, and a value of an nth element in the original data array is used to represent utilization state information of sub-log data corresponding to an nth sub-recording period; the Nth sub-recording time interval is an interval of which the Nth interval length is unit duration in the total recording time interval; the identification value of each node in the first tree data structure is the sum of values of M elements maintained by the node in the original data array, and the interval information of each node in the first tree data structure is the union of the sub-recording time periods corresponding to the M elements;
the method further comprises the following steps:
under the condition that the sub-log data corresponding to the target interval information is loaded completely, updating the identification value of each target node according to a first preset value so as to update the original data array; wherein the interval information of the target node includes the target interval information.
8. The log data presentation method according to any one of claims 1 to 5 and 7, further comprising:
acquiring a second tree data structure; the second tree-shaped data structure is a segment tree or a tree array constructed based on interval information of each block of sub-log data after the total log data is partitioned; in the second tree data structure, each leaf node corresponds to each piece of the sub-log data one to one, the sub-log data corresponding to each father node is a union of the sub-log data corresponding to each son node under the father node, and the identification value of each node in the second tree data structure is used for representing the total data volume of the sub-log data corresponding to the node;
loading the sub-log data corresponding to the target interval information to a local device, including:
searching the second tree-shaped data structure based on the target interval information to obtain the data volume to be loaded corresponding to the target interval information;
acquiring a loaded data volume, and adding the loaded data volume and the data volume to be loaded to obtain an expected data volume;
judging whether to load the sub-log data corresponding to the target interval information or not based on a comparison result of the expected data volume and a preset data volume threshold; and if the target interval information is not the sub-log data, the sub-log data corresponding to the target interval information is not loaded.
9. The log data presentation method of any one of claims 2 to 5 and 7, wherein the step of determining a starting search period comprises:
and taking the recording time period to which the log data currently displayed by the front-end equipment belongs as a display time period, and determining the initial searching time period according to the display time period and a preset loading rule.
10. An apparatus for presenting log data, the apparatus comprising:
a tree data structure obtaining module, configured to obtain a first tree data structure; the first tree-shaped data structure is a segment tree or a tree array constructed on the basis of interval information of each block of sub-log data after the total log data is partitioned; in the first tree data structure, each leaf node corresponds to each piece of sub-log data one to one, the sub-log data corresponding to each father node is a union set of the sub-log data corresponding to each son node under the father node, and the identification value of each node is used for representing the utilization state information of the sub-log data corresponding to the node;
the target interval information determining module is used for determining an initial search interval and inquiring the first tree-shaped data structure according to the initial search interval and a preset inquiry rule so as to obtain target interval information corresponding to the sub-log data to be displayed;
and the loading module is used for loading the sub-log data corresponding to the target interval information to local equipment.
11. A storage medium, characterized by: the storage medium has stored therein computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the log data presentation method of any one of claims 1 to 9.
12. A computer device, comprising: one or more processors, and a memory;
the memory has stored therein computer-readable instructions that, when executed by the one or more processors, perform the steps of the log data presentation method of any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210750230.4A CN115145869A (en) | 2022-06-29 | 2022-06-29 | Log data display method and device, storage medium and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210750230.4A CN115145869A (en) | 2022-06-29 | 2022-06-29 | Log data display method and device, storage medium and computer equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115145869A true CN115145869A (en) | 2022-10-04 |
Family
ID=83410719
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210750230.4A Pending CN115145869A (en) | 2022-06-29 | 2022-06-29 | Log data display method and device, storage medium and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115145869A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115935090A (en) * | 2023-03-10 | 2023-04-07 | 北京锐服信科技有限公司 | Data query method and system based on time slicing |
CN116225855A (en) * | 2023-05-10 | 2023-06-06 | 荣耀终端有限公司 | Log generation method, electronic equipment and storage medium |
-
2022
- 2022-06-29 CN CN202210750230.4A patent/CN115145869A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115935090A (en) * | 2023-03-10 | 2023-04-07 | 北京锐服信科技有限公司 | Data query method and system based on time slicing |
CN116225855A (en) * | 2023-05-10 | 2023-06-06 | 荣耀终端有限公司 | Log generation method, electronic equipment and storage medium |
CN116225855B (en) * | 2023-05-10 | 2023-09-12 | 荣耀终端有限公司 | Log generation method, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115145869A (en) | Log data display method and device, storage medium and computer equipment | |
CN110427368B (en) | Data processing method and device, electronic equipment and storage medium | |
US7707136B2 (en) | System and method for providing high availability data | |
CN106874281B (en) | Method and device for realizing database read-write separation | |
CN109547807B (en) | Information processing method and device based on live broadcast and server | |
CN110427386B (en) | Data processing method, device and computer storage medium | |
CN109634989B (en) | HIVE task execution engine selection method and system | |
CN111414379A (en) | Serial number generation method, device, equipment and computer readable storage medium | |
CN111427931A (en) | Distributed query engine and method for querying relational database by using same | |
CN111596945B (en) | Differential upgrading method for dynamic multi-partition firmware of embedded system | |
CN114329155A (en) | Multi-mode storage caching system containing time sequence database and query method | |
CN112650449B (en) | Method and system for releasing cache space, electronic device and storage medium | |
CN111506573B (en) | Database table partitioning method, device, computer equipment and storage medium | |
CN110825953B (en) | Data query method, device and equipment | |
CN112527479A (en) | Task execution method and device, computer equipment and storage medium | |
CN116842244A (en) | Search engine data synchronization method, system, device and storage medium | |
CN114969165B (en) | Data query request processing method, device, equipment and storage medium | |
CN116304079A (en) | Timing-based profile data management method, apparatus, and readable storage medium | |
CN115129981A (en) | Information recommendation method, device, equipment and storage medium | |
CN110162467B (en) | Software testing method, device, computer equipment and readable storage medium | |
CN113609168A (en) | Data export method, device, terminal and readable storage medium | |
CN111651449A (en) | Data storage method, information rollback method, terminal and storage medium | |
CN110688387A (en) | Data processing method and device | |
CN116578247B (en) | Metadata-based data access method and system | |
CN115905402B (en) | Method and device for processing transaction log |
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 |