A streaming storage method and device for application observation
Through the streaming storage method for application observation, the problem of scattered storage of Metrics, Logging, and Tracing data is solved, unified storage and efficient query of data are realized, and application observation and analysis capabilities are improved.
Patent Information
- Application Number
- CN202210641383.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-06-08
AI Technical Summary
In the existing technology, the three indicators Metrics, Logging, and Tracing are scattered in different storage components and cannot be uniformly accessed and effectively aggregated, resulting in challenges for application observation and analysis.
Using the streaming storage method for application observation, Segments are formed by obtaining the data stream to be stored and sequentially processing it in the memory through block cache, variable memory table and immutable memory table, and in the hierarchical and sharded structure. Store and query in the storage area, supporting sequential writing and sequential reading, realizing hot and cold separation of data and reducing redundancy.
It realizes the integrated collection, storage and analysis of observable data such as Logs, Traces and Metrics, avoids the storage overhead caused by repeated writing and redundant copies, improves query performance and data access efficiency, and supports Update and Delete. operate.
Smart Images

Figure CN114879915B
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage, and in particular to a streaming storage method and device for application observation. Background Art
[0002] In IT systems, Logs, Traces, and Metrics are three important indicators that can be observed by applications. They can basically meet various monitoring, alarm, analysis, and troubleshooting needs, but they have their own applicable forms in actual scenarios.
[0003] In the traditional mode, in order to achieve unified analysis and display of data in these three dimensions, the general system dimension is Metrics, which is generally collected by Prometheus components and stored in the time series database TSDB; for LOG or Trace, it is mainly based on message middleware (Kafka), Elasticsearch, etc. to complete the data storage after collection. It can be seen intuitively that this architecture still uses two technology stacks, and the storage layers are still isolated from each other, which makes the three indicators of Metrics, Logging, and Tracing scattered in different storage components, unable to be uniformly accessed and effectively aggregated, which brings challenges to the subsequent observation and analysis of the application.
[0004] The emergence of stream storage regards stream and storage as one, realizing the integrated collection, storage, and analysis of observable data such as logs, traces, and metrics, and completing a system to handle all types of data. Summary of the invention
[0005] The embodiments of the present application provide a streaming storage method and device for application observation.
[0006] In a first aspect, an embodiment of the present application provides a streaming storage method for application observation, the method comprising:
[0007] Get the data stream to be stored, and store each stream included in the data stream to be stored Stream into the memory, the memory includes the block cache block cache, the mutable memory table Active Memtable and the immutable memory table ImmutableMemtable. The order of the flow of the stream to be stored in the memory is block cache, Active Memtable, and Immutable Memtable. The data stream to be stored includes one or more of the log log, the indicator Metrics or the call log Traces.
[0008] Flushing the data of the Immutable Memtable to a storage medium and forming at least one Segment to be stored in a first storage area;
[0009] The address of the storage area corresponding to each Segment in the at least one Segment, the key Key corresponding to each Segment, and the Segment identifier corresponding to each Segment are stored in the second storage area in the storage medium.
[0010] Optional,
[0011] The first storage area adopts a layered and sliced structure;
[0012] The stratification refers to dividing the first storage area into multiple levels, the number of levels is inversely correlated with the popularity of the data stored in the level, and the at least one segment is stored in at least one level of the multiple levels; different levels use different storage media, and the number of levels is inversely correlated with the price of the storage medium, so as to achieve hybrid deployment of persistent storage and long-term storage without affecting query performance;
[0013] The sharding means that the data of different storage data streams are distributed in different levels in segments. A stream contains multiple segments, and each level includes multiple segments corresponding to a stream. Among them, one or more storage data streams form an independent object set schema. Different schemas correspond to observation data of different dimensions, and the schema is defined by the user.
[0014] Optionally, the Key is also used to indicate the version of the data stream to be stored.
[0015] Optionally, the version information of the data stream to be stored includes:
[0016] The timestamp of the Key being generated;
[0017] For the Update operation, the data has the latest version information, so during the Segment sinking process, the old version data is deleted through the Key version merge;
[0018] For the Delete operation, the version information is defined as invalid information system unvalid, so that the identification in the second storage area is updated, thereby completing the logical deletion of the data.
[0019] Optionally, storing each stream included in the data stream to be stored Stream into a memory includes:
[0020] The data stream to be stored and the invalid data are stored in a first cache line in a memory, the amount of data that can be accommodated by the first cache line in the memory is greater than the amount of data corresponding to the data stream to be cached, and the sum of the amount corresponding to the data stream to be stored and the data stream of the invalid data is equal to the amount of data that can be accommodated by the first cache line.
[0021] Optionally, the data stream to be stored includes a data source of the data stream to be stored.
[0022] Optionally, the data stream to be stored is obtained in the following manner:
[0023] Collect raw data;
[0024] Adding a data source to the original data;
[0025] The data stream to be stored is obtained according to the original data and the data source of the original data.
[0026] Optionally, the original data includes any one or more of the following:
[0027] log, metrics or traces.
[0028] Optionally, the data source corresponding to the data stream to be stored includes:
[0029] One or more of log, metrics, and traces.
[0030] Optionally, the method further includes:
[0031] receiving a data query request, wherein the data query request includes a query keyword;
[0032] Using the query keyword as an index to query the second storage area, and obtaining a storage address and a segment identifier corresponding to the query keyword;
[0033] Using the storage address and the segment identifier as an index, searching the first storage area to obtain a query result;
[0034] The query result is output.
[0035] In a second aspect, an embodiment of the present application provides a streaming storage device for application observation, the device comprising:
[0036] An acquisition unit, used for acquiring a data stream to be stored;
[0037] A first storage unit is used to store each stream included in the data stream to be stored Stream into a memory, wherein the memory includes a block cache, an Active Memtable, and an Immutable Memtable. The order of the flow of the stream to be stored in the memory is block cache, Active Memtable, and Immutable Memtable, and the data stream to be stored includes one or more of a log, a metric, or a call log Traces;
[0038] A second storage unit, used to flush the data of the Immutable Memtable to a storage medium, and form at least one Segment to be stored in the first storage area;
[0039] The third storage unit is used to store the address of the storage area corresponding to each Segment in the at least one Segment, the key Key corresponding to each Segment, and the Segment identifier corresponding to each Segment in the second storage area in the storage medium.
[0040] Optional,
[0041] The first storage area adopts a layered and sliced structure;
[0042] The stratification refers to dividing the first storage area into multiple levels, the number of levels is inversely correlated with the popularity of the data stored in the level, and the at least one segment is stored in at least one level of the multiple levels; different levels use different storage media, and the number of levels is inversely correlated with the price of the storage medium, so as to achieve hybrid deployment of persistent storage and long-term storage without affecting query performance;
[0043] The sharding means that the data of different storage data streams are distributed in different levels in segments. A stream contains multiple segments, and each level includes multiple segments corresponding to a stream. Among them, one or more storage data streams form an independent object set schema. Different schemas correspond to observation data of different dimensions, and the schema is defined by the user.
[0044] Optionally, the Key is also used to indicate the version of the data stream to be stored.
[0045] Optionally, the version information of the data stream to be stored includes:
[0046] The timestamp of the Key being generated;
[0047] For the Update operation, the data has the latest version information, so during the Segment sinking process, the old version data is deleted through the Key version merge;
[0048] For the Delete operation, the version information is defined as invalid information system unvalid, so that the identification in the second storage area is updated, thereby completing the logical deletion of the data.
[0049] Optionally, storing each stream included in the data stream to be stored Stream into a memory includes:
[0050] The data stream to be stored and the invalid data are stored in a first cache line in a memory, the amount of data that can be accommodated by the first cache line in the memory is greater than the amount of data corresponding to the data stream to be cached, and the sum of the amount corresponding to the data stream to be stored and the data stream of the invalid data is equal to the amount of data that can be accommodated by the first cache line.
[0051] Optionally, the data stream to be stored includes a data source of the data stream to be stored.
[0052] Optionally, the data stream to be stored is obtained in the following manner:
[0053] Collect raw data;
[0054] Adding a data source to the original data;
[0055] The data stream to be stored is obtained according to the original data and the data source of the original data.
[0056] Optionally, the original data includes any one or more of the following:
[0057] log, metrics or traces.
[0058] Optionally, the data source corresponding to the data stream to be stored includes:
[0059] One or more of log, metrics, and traces.
[0060] Optionally, the device further comprises:
[0061] A receiving unit, configured to receive a data query request, wherein the data query request includes a query keyword;
[0062] A first query unit, configured to query the second storage area by using the query keyword as an index to obtain a storage address and a segment identifier corresponding to the query keyword;
[0063] A second query unit, configured to search the first storage area by using the storage address and the segment identifier as an index to obtain a query result;
[0064] An output unit is used to output the query result.
[0065] Compared with the prior art, the embodiments of the present application have the following advantages:
[0066] The embodiment of the present application provides a streaming storage method for application observation, which is used to store stream data (Stream) and is implemented using a two-layer architecture of stratification and sharding, wherein stratification refers to the concept of level (Level), and data of different heat is stored in different Levels. The higher the Level, the lower the data heat, thus realizing the separation of hot and cold data; different Levels can use different storage media, and generally the higher the Level, the cheaper the medium, thus realizing the hybrid deployment of persistent storage and long-term storage without affecting the query performance. Sharding means that the data of the different Streams are distributed in different Levels in units of segments (Segment), and a Stream contains multiple Segments. In each Level, a Stream is also allowed to have multiple Segments, wherein one or more Streams form an independent object set (Schema), and different Schemas correspond to observation data of different dimensions, which are defined by the user.
[0067] The embodiment of the present application provides a streaming storage method for application observation. In one example, a data stream to be stored can be obtained, and the data stream to be stored includes one or more of logs, metrics, or call logs Traces. The data stream to be stored has at least one Segment. As the amount of data increases, the Segment will gradually sink to a higher level. In the method, two storage areas are included, a first storage area and a second storage area. Among them, the first storage area sequentially stores the at least one Segment and the Segment identifiers corresponding to each Segment in the at least one Segment in at least one first storage area in the storage medium, the Segment identifier is used to identify the data source corresponding to the data stream to be stored, and the Segments will be distributed in different Levels. In this application, each Level will be set with a maximum number of bytes MAX that can be stored in a single Segment. When the amount of stored data exceeds the MAX, a new Segment will be automatically created at the next level to complete the writing of the new data, and so on, wherein different Levels can select different storage media; in the second storage area, the addresses of the storage areas corresponding to each Segment in the at least one Segment, the keys Key corresponding to each Segment, and the Segment identifiers corresponding to each Segment are stored in the second storage area in the storage medium. It can be seen that for each Segment (that is, the data stream to be stored itself), only one copy is stored, that is, stored in the first storage area, rather than storing one copy in the first storage area and one copy in the second storage area respectively. On the one hand, the problem of repeated writing is avoided and the storage overhead caused by redundant copies is reduced. On the other hand, because the Segment data in the first storage area is written sequentially, and the observation data is searched, it is also read sequentially from the Segment, which can improve the access performance. In addition, in this solution, the second storage area stores the address of the storage area corresponding to each Segment, the key corresponding to each Segment, and the Segment identifier corresponding to each Segment. Therefore, when reading the data in the first storage area with the Key as the index, it can be read sequentially. In other words, this solution can support sequential writing and sequential reading, which can effectively improve the performance of the storage medium compared with sequential writing and random reading.In this solution, there are scenarios where the Key may have key value conflicts in actual applications, so the Key includes version information, which generally refers to the timestamp when the Key is generated, but is not limited to this. For Update operations, the data has the latest version information, so that the old version data can be deleted through version merging during the Segment sinking process; for Delete operations, the version information is defined as invalid information "system unvalid", so that the identifier in the second storage area is updated, and the logical deletion of the data is completed, which makes up for the industry's shortcomings in Update and Delete operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0069] Figure 1 A schematic diagram of a flow chart of a streaming storage method for application observation provided in an embodiment of the present application;
[0070] Figure 2 A schematic diagram of storing data provided in an embodiment of the present application;
[0071] Figure 3 A flowchart of a data acquisition method provided in an embodiment of the present application;
[0072] Figure 4 A flowchart of a data query method provided in an embodiment of the present application;
[0073] Figure 5 A schematic diagram of the structure of a streaming storage device for application observation provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0075] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.
[0076] Exemplary Methods
[0077] See also Figure 1 , which is a flow chart of a streaming storage method for application observation provided in an embodiment of the present application. Figure 1 The method shown may be executed by a server, for example. In this embodiment, the method may include the following steps: S101-S103.
[0078] S101: Obtain a data stream Stream to be stored, and store each Stream in the stream to be stored into a memory, wherein the memory includes a block cache, an active memtable, and an immutable memtable.
[0079] In one example, the order of flow of the Stream to be stored in the memory is block cache, Active Memtable, and Immutable Memtable. In one example, the block cache can optimize the cache operation, and it intervenes through the posix_fadvise provided by the kernel. The block cache can achieve the purpose of alleviating memory pressure by actively releasing the page cache of the storage file without almost losing performance, so as to cope with the scenario of extreme memory demand. This optimization can well prevent the occurrence of performance jitter. However, the current block cache may have the problem of pseudo-sharing. Because the modification of the memory by one processor core will cause the cache of the other core in the memory at that location to be invalid. Specifically: when multiple threads modify seemingly independent variables, if these variables share the same cache line, they will inadvertently affect each other's performance.
[0080] In one example, in order to solve the above problem, in an embodiment of the present application, when the amount of data in the data stream to be stored is less than the amount of data that can be accommodated by a certain cache line in the memory (for example, the first cache line), the data stream to be stored is allowed to occupy the first cache line exclusively, and invalid data can be inserted into the excess portion in the first cache line. In other words, in one example, the data stream to be stored and the invalid data can be stored in the first cache line, and the amount of data that can be accommodated by the first cache line in the memory is greater than the data stream corresponding to the data stream to be cached, and the sum of the amount corresponding to the data stream to be stored and the data stream of the invalid data is equal to the amount of data that can be accommodated by the first cache line.
[0081] In one example, after the cache page in the block cache is full, the data in the page is written to the ActiveMemtable. The Active Memtable is mainly used to cache the user's write data. Generally, the maximum number of bytes AC_MAX is set. When the amount of data written exceeds the AC_MAX value, the Active Memtable automatically switches to the Immutable Memtable and re-creates the Immutable Memtable in the memory; the Immutable Memtable represents the non-writable but readable data stored therein, which represents the data written by the user to the disk file. The advantage of this is that when the memory refreshes data to the disk, the block data can better utilize IO, and the background thread stores the data of the Immutable Memtable to the disk; in the ActiveMemtable and Immutable Memtable, they are separately opened for different Schemas, and the ActiveMemtable and Immutable Memtable of different Streams are not shared.
[0082] In an embodiment of the present application, one or more streams of the data stream to be stored may be defined as different schemas depending on the source. In one example, the schema may be determined based on the data source corresponding to the data stream to be stored. For example, the data stream to be stored includes data from three data sources: log, metrics, and trace, which may be defined as three different schemas, or log and trace may be merged into one schema, depending on the needs of the user, and the schema data may be subsequently stored in the form of segments.
[0083] Regarding the data source, it should be noted that in the embodiment of the present application, the data source may include: log, metric or call log. Regarding log, metric and trace, it should be noted that:
[0084] Log: A carrier for recording changes in things. It includes common text-based data such as access logs, transaction logs, and kernel logs, as well as generic data such as GPS, audio, and video. Logs can actually be transformed into traces after the call chain scenario is structured, and become metrics after aggregation and downsampling operations.
[0085] Metrics: Aggregated indicators are relatively discrete and generally consist of a name, labels, time, and values. Metrics data is generally not large, so the storage cost is relatively low and the query speed is relatively fast.
[0086] Traces: standard call logs, in addition to defining the parent-child relationship of the call, generally define detailed information such as the service, method, attribute, status, and duration of the operation. Traces can replace part of the Log function, and the aggregation of traces can also obtain metrics indicators for each service and method.
[0087] In traditional technology, in order to achieve unified analysis and display of data in three dimensions: log, metrics, and traces. Metrics is generally stored in a time series database (TSDB). For log or trace, it is generally output to Elasticsearch (ES) for storage. It can be seen intuitively that this architecture uses two technology stacks, and the storage layers are still isolated from each other. The main problems of storage layer isolation include: data is not interoperable and the system maintenance cost is huge. In this solution, streaming storage is used to uniformly store log, metrics, and traces data, thereby effectively avoiding the above-mentioned problems of data non-interoperability and huge system maintenance cost.
[0088] In an example, the data stream to be stored includes the data source of the data stream to be stored. The data source mentioned here may include one or more of the logs, metrics or traces mentioned above.
[0089] S102: flush the data of the Immutable Memtable to a storage medium, and form at least one Segment to be stored in a first storage area.
[0090] The storage medium can be a disk storage device, which is a physical hardware device; the first storage area is located on the storage medium and includes multiple levels, and the number of levels is defined before the system is initialized. When the schema where the data is located is first written to the storage medium, the segment formed is located at Level 0, and each level is defined before the system is initialized to set the maximum number of bytes that can be stored in a single segment. When the amount of stored data exceeds the MAX, a new segment will be automatically created at the next level Level 1 to complete the writing of the new data, and so on to the storage medium where the last level is located.
[0091] The first storage area includes multiple levels, the Level number is inversely correlated with the heat of the data stored in the Level, and the at least one Segment is stored in at least one Level among the multiple Levels. That is, the higher the Level number, the lower the heat of the data stored in the Level. In the specific implementation of S102, the at least one Segment and the Segment identifiers corresponding to each Segment in the at least one Segment can be sequentially stored in at least one first storage area in the storage medium, and the Segment identifier is used to identify the data source corresponding to the data stream to be stored.
[0092] S103: Store the address of the storage area corresponding to each Segment in the at least one Segment, the Key corresponding to each Segment, and the Segment identifier corresponding to each Segment in the second storage area in the storage medium.
[0093] Regarding S102 and S103, it should be noted that the present application does not specifically limit the storage medium. The Level can be customized by the user. Different Levels can use Serial ATA (Serial Advanced Technology Attachment, SATA) storage media, and can also be Solid State Drive (SSD) and Object Storage Service (OSS). They are not listed one by one here. It is generally recommended that the higher the Level, the lower the cost of the selected storage medium.
[0094] In an example, the first storage area may correspond to a certain area in a stream storage area, and the second storage area may correspond to a certain stream storage table in a stream storage table. Figure 2 , introducing S102-S103. Figure 2 A schematic diagram of storing data provided in an embodiment of the present application.
[0095] like Figure 2As shown, the Stream Storage adopts two architectures: layered and sharded. The so-called layered means that the Stream Storage includes multiple levels, and the so-called sharded means that a Level can include multiple Segments of different Schemas, where different Levels store data of different popularity. The lower the Level, the higher the popularity, and correspondingly, the higher the data access frequency. The Stream Storage table adopts a sharded structure, which is mainly sharded according to the difference in Segments.
[0096] like Figure 2 As shown, in one example, the data to be stored in the first storage area may be stored in Level 1 of the StreamStorage, such as Figure 2 As shown, the data in Level 1 is stored in the form of {value, Segment-ID}, where the value refers to part of the data to be stored (i.e., Segment), and Segment-ID is the Segment ID corresponding to the value. Correspondingly, the data stored in the second storage area can correspond to table(1) in the streamstorage table, and the data in table(1) is stored in the form of {Key, address, Segment-ID}, where the Key is the Key corresponding to the value, and the address is the storage address of the value in Stream Storage.
[0097] It should be noted that, in one example, for logs and traces, the business (such as the business name or the business identifier) can be used as the key, and for metrics, the indicator can be used as the key.
[0098] From the above description, it can be known that, by utilizing the solution of the embodiment of the present application, for each Segment (that is, the data stream to be stored itself), only one copy is stored, that is, stored in the first storage area, rather than storing one copy in the first storage area and one copy in the second storage area respectively, thereby avoiding the problem of duplicate writing and improving the performance of the storage medium. In addition, in the present solution, the second storage area stores the address of the storage area corresponding to each Segment, the key (Key) corresponding to each Segment, and the Segment identifier corresponding to each Segment. Therefore, when reading the data in the first storage area with the Key as the index, it can be read sequentially. In other words, on the one hand, the present solution avoids the problem of duplicate writing and reduces the storage overhead caused by redundant copies. On the other hand, because the Segment data in the first storage area is written sequentially, and when looking up the observed data, it is also read sequentially from the Segment, the access performance can be improved.
[0099] In one example, considering the traditional streaming storage solution (such as the streaming storage solution based on Apache Bookkeeper (BK)), it does not support update and delete operations. In one implementation of the embodiment of the present application, the Key has a scenario of key value conflict in actual application, so the Key contains version information, which generally refers to the timestamp generated by the Key, but is not limited to this. For the Update operation, the data has the latest version information, so that the old version of the data is deleted through version merging during the Segment sinking process; for the Delete operation, the version information is defined as invalid information "system unvalid", so that the identifier in the second storage area is updated, and the logical deletion of the data is completed, which makes up for the industry's shortcomings in Update and Delete operations.
[0100] As mentioned above, the data stream to be stored can be stored in the cache. Next, combined with Figure 3 A method for obtaining the data to be cached before storing the data to be cached in a cache is introduced. Figure 3 A flowchart of a data acquisition method provided in an embodiment of the present application. Figure 3 The method shown may include the following S201-S203.
[0101] S201: Collecting raw data.
[0102] In an example, the raw data may include logs, metrics, and traces.
[0103] In an example, the log, metrics, and traces data may be collected according to data protocols respectively supported by the log, metrics, and traces data.
[0104] In an example, when S201 is implemented specifically, the original data may be collected based on flink.
[0105] Next, the implementation of S201 is introduced by taking log collection as an example.
[0106] Since the log is in the Extensible Markup Language (XML) format, it is necessary to wait for the complete structure to be received before parsing its content. As the log is a stream data, it flows into Flink one by one, and it is impossible to receive the complete structure at the same time. Considering the particularity of its structure, the Flink state feature can be used, and the parallelism of the task is set to 1 to strictly ensure the order of log reading. Since the log format is very uniform, each gc record is <gc-start>It starts and ends with , which is very convenient for locating a gc record. When the first line of a gc record is received, it will not be processed immediately but stored in the state until the last line is read and then submitted to the XML parsing class for processing. The log data can be obtained after parsing. In an example, the log obtained by parsing can be organized into a map format and output to a specified index (index) of Elasticsearch for storage.
[0107] S202: Add a data source to the original data.
[0108] S203: Obtain the data stream to be stored according to the original data and the data source of the original data.
[0109] In one example, after obtaining the original data, the original data may be further processed, for example, by adding corresponding fields (such as timestamps) to the original data to obtain processed intermediate data. Further, based on the intermediate data and the intermediate sources corresponding to the intermediate data, the data stream to be stored is obtained.
[0110] Based on the streaming storage method provided in the above embodiment, the embodiment of the present application further provides a data query method. Next, the data query method is introduced in conjunction with the accompanying drawings. Figure 4 A flowchart of a data query method provided in an embodiment of the present application. Figure 4 The method shown may include the following S301-S304.
[0111] S301: receiving a data query request, wherein the data query request includes a query keyword.
[0112] Regarding the query keyword, it should be noted that, in one example, the query keyword may be a service (eg, a service name or a service identifier) or an indicator. This embodiment of the present application does not make any specific limitation.
[0113] The data query request mentioned here may be, for example, a Structured Query Language (SQL) statement.
[0114] S302: Query the second storage area using the query keyword as an index to obtain a storage address and a Segment identifier corresponding to the query keyword.
[0115] S303: Using the storage address and Segment identifier as an index, search the first storage area to obtain a query result.
[0116] In one example, the query keyword can be used as an index to query the corresponding Key in the second storage area, thereby determining the Key that matches the query keyword. Accordingly, the storage address and Segment identifier corresponding to the Key that matches the query keyword are determined as the storage address and Segment identifier corresponding to the query keyword.
[0117] Then, the first storage area is searched using the storage address and Segment identifier as an index to obtain a query result, that is, a value corresponding to the storage address and Segment identifier.
[0118] S304: Output the query result.
[0119] After obtaining the query result, the query result can be output. In an embodiment of the present application, the query result can be output in a visual manner, for example, in the form of text and / or chart.
[0120] Exemplary Devices
[0121] Based on the method provided in the above embodiment, the embodiment of the present application further provides a device, which is described below in conjunction with the accompanying drawings.
[0122] See also Figure 5 , which is a schematic diagram of the structure of a streaming storage device for application observation provided by an embodiment of the present application. The device 500 may specifically include: an acquisition unit 501, a first storage unit 502, a second storage unit 503 and a third storage unit 504.
[0123] An acquisition unit 501 is used to acquire a data stream to be stored;
[0124] A first storage unit 502 is used to store each stream included in the data stream to be stored Stream into a memory, wherein the memory includes a block cache, an Active Memtable, and an Immutable Memtable. The order of the flow of the stream to be stored in the memory is block cache, Active Memtable, and Immutable Memtable, and the data stream to be stored includes one or more of a log, a metric, or a call log Traces;
[0125] The second storage unit 503 is used to flush the data of the Immutable Memtable to the storage medium and form at least one Segment to be stored in the first storage area;
[0126] The third storage unit 504 is used to store the address of the storage area corresponding to each Segment in the at least one Segment, the key Key corresponding to each Segment, and the Segment identifier corresponding to each Segment in the second storage area in the storage medium.
[0127] Optional,
[0128] The first storage area adopts a layered and sliced structure;
[0129] The stratification refers to dividing the first storage area into multiple levels, the number of levels is inversely correlated with the popularity of the data stored in the level, and the at least one segment is stored in at least one level of the multiple levels; different levels use different storage media, and the number of levels is inversely correlated with the price of the storage medium, so as to achieve hybrid deployment of persistent storage and long-term storage without affecting query performance;
[0130] The sharding means that the data of different storage data streams are distributed in different levels in segments. A stream contains multiple segments, and each level includes multiple segments corresponding to a stream. Among them, one or more storage data streams form an independent object set schema. Different schemas correspond to observation data of different dimensions, and the schema is defined by the user.
[0131] Optionally, the Key is also used to indicate the version of the data stream to be stored.
[0132] Optionally, the version information of the data stream to be stored includes:
[0133] The timestamp of the Key being generated;
[0134] For the Update operation, the data has the latest version information, so during the Segment sinking process, the old version data is deleted through the Key version merge;
[0135] For the Delete operation, the version information is defined as invalid information system unvalid, so that the identification in the second storage area is updated, thereby completing the logical deletion of the data.
[0136] Optionally, storing each stream included in the data stream to be stored Stream into a memory includes:
[0137] The data stream to be stored and the invalid data are stored in a first cache line in a memory, the amount of data that can be accommodated by the first cache line in the memory is greater than the amount of data corresponding to the data stream to be cached, and the sum of the amount corresponding to the data stream to be stored and the data stream of the invalid data is equal to the amount of data that can be accommodated by the first cache line.
[0138] Optionally, the data stream to be stored includes a data source of the data stream to be stored.
[0139] Optionally, the data stream to be stored is obtained in the following manner:
[0140] Collect raw data;
[0141] Adding a data source to the original data;
[0142] The data stream to be stored is obtained according to the original data and the data source of the original data.
[0143] Optionally, the original data includes any one or more of the following:
[0144] log, metrics or traces.
[0145] Optionally, the data source corresponding to the data stream to be stored includes:
[0146] One or more of log, metrics, and traces.
[0147] Optionally, the device further comprises:
[0148] A receiving unit, configured to receive a data query request, wherein the data query request includes a query keyword;
[0149] A first query unit, configured to query the second storage area by using the query keyword as an index to obtain a storage address and a segment identifier corresponding to the query keyword;
[0150] A second query unit, configured to search the first storage area by using the storage address and the segment identifier as an index to obtain a query result;
[0151] An output unit is used to output the query result.
[0152] Since the device 500 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 500 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 500, reference can be made to the description part of the above method embodiment, which will not be repeated here.
[0153] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0154] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0155] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A streaming storage method for application observation, characterized in that: The method comprises: Obtain the data stream to be stored, and store each stream included in the data stream to be stored in the memory, the memory includes the block cache, the mutable memory table Active Memtable and the immutable memory table Immutable Memtable, the data stream to be stored in the memory flows in the order of block cache, Active Memtable and ImmutableMemtable, the data stream to be stored includes one or more of the log, the metric or the call log Traces; Flushing the data of the Immutable Memtable to a storage medium and forming at least one Segment to be stored in a first storage area; The address of the storage area corresponding to each Segment in the at least one Segment, the key Key corresponding to each Segment, and the Segment identifier corresponding to each Segment are stored in the second storage area in the storage medium; The first storage area adopts a layered and sliced structure; The stratification refers to dividing the first storage area into multiple levels, the number of levels is inversely correlated with the popularity of the data stored in the level, and the at least one segment is stored in at least one level of the multiple levels; different levels use different storage media, and the number of levels is inversely correlated with the price of the storage medium, so as to achieve hybrid deployment of persistent storage and long-term storage without affecting query performance; The sharding means that the data of different storage data streams are distributed in different levels in segments. A stream contains multiple segments, and each level includes multiple segments corresponding to a stream. Among them, one or more storage data streams form an independent object set schema. Different schemas correspond to observation data of different dimensions, and the schema is defined by the user.
2. The method according to claim 1, characterized in that The Key is also used to indicate the version of the data stream to be stored.
3. The method according to claim 2, characterized in that The version information of the data stream to be stored includes: The timestamp of the Key being generated; For the Update operation, the data has the latest version information, so during the Segment sinking process, the old version data is deleted through the Key version merge; For the Delete operation, the version information is defined as invalid information system unvalid, so that the identification in the second storage area is updated, thereby completing the logical deletion of the data.
4. The method according to claim 1, characterized in that: The step of storing each stream included in the data stream to be stored Stream into the memory includes: The data stream to be stored and the invalid data are stored in a first cache line in a memory, the amount of data that can be accommodated by the first cache line in the memory is greater than the amount of data corresponding to the data stream to be stored, and the sum of the amount of data corresponding to the data stream to be stored and the amount of invalid data is equal to the amount of data that can be accommodated by the first cache line.
5. The method according to claim 1, characterized in that The data stream to be stored includes the data source of the data stream to be stored.
6. The method according to claim 1, characterized in that The data stream to be stored is obtained in the following manner: Collect raw data; Adding a data source to the original data; The data stream to be stored is obtained according to the original data and the data source of the original data.
7. The method according to claim 6, characterized in that The original data includes any one or more of the following: log, metrics or traces.
8. The method according to claim 6, characterized in that The data source corresponding to the data stream to be stored includes: One or more of log, metrics, and traces.
9. The method according to claim 1, characterized in that: The method further comprises: receiving a data query request, wherein the data query request includes a query keyword; Using the query keyword as an index to query the second storage area, and obtaining a storage address and a segment identifier corresponding to the query keyword; Using the storage address and the segment identifier as an index, searching the first storage area to obtain a query result; The query result is output.
10. A streaming storage device for application observation, characterized in that: The device comprises: An acquisition unit, used for acquiring a data stream to be stored; A first storage unit is used to store each flow included in the data flow to be stored into a memory, wherein the memory includes a block cache, an Active Memtable, and an Immutable Memtable, and the order of the flow of the data flow to be stored in the memory is block cache, Active Memtable, and Immutable Memtable, and the data flow to be stored includes one or more of a log, a metric, or a call log Traces; A second storage unit, used to flush the data of the Immutable Memtable to a storage medium, and form at least one Segment to be stored in the first storage area; A third storage unit is used to store the address of the storage area corresponding to each Segment in the at least one Segment, the key Key corresponding to each Segment, and the Segment identifier corresponding to each Segment in the second storage area in the storage medium; The first storage area adopts a layered and sliced structure; The stratification refers to dividing the first storage area into multiple levels, the number of levels is inversely correlated with the popularity of the data stored in the level, and the at least one segment is stored in at least one level of the multiple levels; different levels use different storage media, and the number of levels is inversely correlated with the price of the storage medium, so as to achieve hybrid deployment of persistent storage and long-term storage without affecting query performance; The sharding means that the data of different storage data streams are distributed in different levels in segments. A stream contains multiple segments, and each level includes multiple segments corresponding to a stream. Among them, one or more storage data streams form an independent object set schema. Different schemas correspond to observation data of different dimensions, and the schema is defined by the user.
11. The device according to claim 10, characterized in that The Key is also used to indicate the version of the data stream to be stored.
12. The device according to claim 11, characterized in that The version information of the data stream to be stored includes: The timestamp of the Key being generated; For the Update operation, the data has the latest version information, so during the Segment sinking process, the old version data is deleted through the Key version merge; For the Delete operation, the version information is defined as invalid information system unvalid, so that the identification in the second storage area is updated, thereby completing the logical deletion of the data.
13. The device according to claim 10, characterized in that The step of storing each stream included in the data stream to be stored Stream into the memory includes: The data stream to be stored and the invalid data are stored in a first cache line in a memory, the amount of data that can be accommodated by the first cache line in the memory is greater than the amount of data corresponding to the data stream to be stored, and the sum of the amount of data corresponding to the data stream to be stored and the amount of invalid data is equal to the amount of data that can be accommodated by the first cache line.
14. The device according to claim 10, characterized in that The data stream to be stored includes the data source of the data stream to be stored.
15. The device according to claim 10, characterized in that The data stream to be stored is obtained in the following manner: Collect raw data; Adding a data source to the original data; The data stream to be stored is obtained according to the original data and the data source of the original data.
16. The device according to claim 15, characterized in that The original data includes any one or more of the following: log, metrics or traces.
17. The device according to claim 15, characterized in that The data source corresponding to the data stream to be stored includes: One or more of log, metrics, and traces.
18. The device according to claim 10, characterized in that The device also includes: A receiving unit, configured to receive a data query request, wherein the data query request includes a query keyword; A first query unit, configured to query the second storage area by using the query keyword as an index to obtain a storage address and a segment identifier corresponding to the query keyword; A second query unit, configured to search the first storage area by using the storage address and the segment identifier as an index to obtain a query result; An output unit is used to output the query result.
