WO2018059310A1 - 数据处理和查询方法及装置 - Google Patents

数据处理和查询方法及装置 Download PDF

Info

Publication number
WO2018059310A1
WO2018059310A1 PCT/CN2017/102853 CN2017102853W WO2018059310A1 WO 2018059310 A1 WO2018059310 A1 WO 2018059310A1 CN 2017102853 W CN2017102853 W CN 2017102853W WO 2018059310 A1 WO2018059310 A1 WO 2018059310A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
local
aggregated
query request
query
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.)
Ceased
Application number
PCT/CN2017/102853
Other languages
English (en)
French (fr)
Inventor
李国忠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2018059310A1 publication Critical patent/WO2018059310A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24568Data stream processing; Continuous queries
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24532Query optimisation of parallel queries
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Definitions

  • the invention belongs to the field of data processing, and in particular relates to a data processing and query method and device.
  • MVCC multi-version Concurrency Control
  • the stream data in each time interval is locally combined to generate a local data.
  • the local data is landed on the storage end. For example, when it is necessary to query the total sales amount within 24 hours a day, a partial merge is performed every 6 seconds from 00:00 to obtain a partial data, and when the set is reached 24:00 The number of all local data generated in the 24 hours is 14400.
  • the local data corresponding to all the time intervals is stored in the storage end of the MVCC scheme, resulting in the storage end. Storage pressure is high.
  • the present invention provides a data processing and query method and apparatus for solving the problem that the storage pressure is large due to the storage of all local data by the storage end when the streaming data is dropped by the MVCC scheme.
  • the present invention provides a data processing method, including:
  • the currently cached data is aggregated to obtain summary data; wherein the currently cached data includes at least the local data.
  • the present invention provides a data query method, including:
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is met, where the local data is a real-time stream Data obtained by partial merging of data;
  • Aggregating data and local data when the query request is received are aggregated to obtain aggregated data
  • the present invention provides a data query method, including:
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is met, where the local data is a real-time stream Data obtained by partial merging of data;
  • the summary data and the local data when the query request is received are sent to the client.
  • the present invention provides a data query method, including:
  • the aggregated data and the local data are aggregated to obtain aggregated data.
  • the present invention provides a data processing apparatus comprising:
  • a local merging module configured to perform local merging of the real-time stream data to obtain at least one local data
  • a cache module configured to cache the local data
  • a summary module configured to summarize the currently cached data to obtain summary data when the preset summary condition is met; wherein the currently cached data includes at least the local data.
  • the present invention provides a data query device, including:
  • a receiving module configured to receive a query request sent by the client
  • a query module configured to query the summary data and the local data when the query request is received; wherein the summary data is data obtained by summarizing the currently cached data when the preset summary condition is met, the local part The data is data obtained by locally combining the real-time stream data;
  • An aggregation module configured to aggregate the aggregated data and the local data when the query request is received, to obtain aggregated data
  • a sending module configured to send the aggregated data to the client.
  • the present invention provides a data query device, including:
  • a receiving module configured to receive a query request sent by the client
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is satisfied
  • the local data is data obtained by locally combining the real-time stream data
  • a sending module configured to send the summary data and the local data when the query request is received to the client.
  • the present invention provides a data query device, including:
  • a sending module configured to send a query request to the storage end, so that the storage end queries the summary data and the local data when the query request is received according to the query request; wherein the summary data is in a preset
  • the data obtained by the current cached data is aggregated
  • the local data is data obtained by locally combining the real-time stream data
  • a receiving module configured to receive the summary data sent by the storage end and the local data
  • an aggregation module configured to aggregate the summary data and the local data to obtain aggregated data.
  • the data processing and querying method and device provided by the invention partially merges the real-time stream data to obtain at least one local data, caches the local data, and summarizes the currently cached data when the preset summary condition is met. To get summary data.
  • the cached local data is summarized, thereby reducing the amount of data stored in the floor, reducing the resources occupied by the floor storage, and reducing the requirement for real-time accumulation of local data, and reducing The calculated pressure for the final polymerization.
  • FIG. 1 is a schematic flowchart of a data processing method according to Embodiment 1 of the present invention.
  • FIG. 2 is a schematic flowchart of a data query method according to Embodiment 2 of the present invention.
  • FIG. 3 is a schematic flowchart of a data query method according to Embodiment 3 of the present invention.
  • FIG. 4 is a schematic flowchart of a data query method according to Embodiment 4 of the present invention.
  • FIG. 5 is a schematic diagram of a data processing system according to Embodiment 5 of the present invention.
  • FIG. 6 is a schematic structural diagram of a data processing apparatus according to Embodiment 6 of the present invention.
  • FIG. 7 is a schematic structural diagram of a data query apparatus according to Embodiment 7 of the present invention.
  • Embodiment 8 is a schematic structural diagram of a data query apparatus according to Embodiment 8 of the present invention.
  • FIG. 9 is a schematic structural diagram of a data query apparatus according to Embodiment 9 of the present invention.
  • FIG. 1 is a schematic flowchart diagram of a data processing method according to Embodiment 1 of the present invention.
  • the execution body is a storage end.
  • the data processing method includes the following steps:
  • the real-time stream data may be segmented according to a specific segmentation manner, and then the stream data in each segment is locally combined to obtain at least one partial data.
  • a time interval is preset, and each time the time interval is reached, the storage end performs a partial combination of all the stream data in the time interval, that is, all the stream data in the time interval are added to obtain the time interval.
  • Local data corresponding to all stream data. For example, calculate the real-time sales per minute, set a merger every 5s, and add up and summarize all the flow data in the 5s to generate a partial sales.
  • the storage end may cache the local data.
  • the current cached data includes at least partial data.
  • a summary condition is set in advance, and each time the summary condition is met, the storage end may trigger a summary calculation on the currently cached data to obtain summary data.
  • the summary condition may be a preset time length, that is, each time the preset time length is reached, the storage end summarizes all the data that has been currently cached to obtain a summary data.
  • the preset summary condition when the preset summary condition is initially satisfied, the currently cached data is local data, and from the second satisfying the preset summary condition, the currently cached data includes the previous summary data and the current Local data under summary conditions.
  • the local data under the current summary condition is the local data that is not cached under the previous summary condition.
  • the preset time length can be 1 hour. First, starting from 0 o'clock, when it reaches 1 o'clock, the storage end can summarize the local data cached in this hour to get a summary data, starting from 1 o'clock.
  • the storage end After 2 o'clock, the storage end needs to perform another summarization, and the currently cached data includes not only the local data generated by all the stream data according to the preset time interval from 1 to 2 o'clock, but also the summary after the previous hour.
  • the summary data at this time, the storage side needs to perform a summary calculation on the previous summary data and the currently cached local data, and obtain the latest summary data as the current summary data.
  • the preset summary condition is the preset time length
  • the preset time length includes 600.
  • Local data Starting from 1 o'clock, each time the storage end performs the next summary, the data currently cached in the storage end includes one last summary data, and 600 local data are generated within one hour according to a preset time interval, thereby being stored in the storage end.
  • the current number of cached data is up to 601, which reduces the storage pressure on the storage side.
  • the summary condition may be a preset number of cached data, that is, each time the number of data currently cached by the storage end reaches a preset number, the storage end may summarize the cached data once.
  • a summary of the data it should be noted here that when the preset summary condition is initially satisfied, the currently cached data is local data, and from the second satisfying the preset summary condition, the currently cached data includes the previous summary data and the current Cached local data.
  • the preset number is 10, firstly, the number of cached data is 0.
  • the 10 data currently cached in the storage end are local data, and 10 The local data is aggregated to obtain a summary data.
  • the aggregated data is cleared, and the aggregated data obtained by the cache is cached, that is, only one summary data is left after the summary calculation is performed, and when the cache is When the number of local data stored reaches 9, the summary condition of the preset number can be satisfied, and the storage side aggregates 1 summary data and 9 local data of the current cache to obtain a new summary.
  • the data is used as the current summary data.
  • the preset summary condition is the number of cached data
  • the number of data from the cache is 0, and the number of cached data is 10, for example, when the data cached by the storage side is used.
  • the storage side performs a summary.
  • only one summary data is stored in the data buffered by the storage end.
  • the storage end performs a summary, so that the number of data currently cached in the storage end is Up to 10, reducing the storage pressure on the storage side.
  • the summarized local data needs to be cleared, and the aggregated data is cached.
  • the summary data and the next summary condition are required.
  • the local data below is summarized.
  • the local data under the summary condition is aggregated to obtain a summary data under the summary condition, and the summary data under the summary condition is Current summary data.
  • the local data under the summary condition is summarized, the local data is cleared, and only the summary data under the summary condition is cached.
  • the preset summary condition is the length of time
  • the local data of the length of time is aggregated every time the length of time is reached, and the summary result of the length of time is obtained. In this summary mode, a summary result is generated for each length of time.
  • the preset summary condition is the number of cached local data, and each time the number of cached local data reaches a preset number, the local data under the current summary condition is aggregated and calculated to obtain a current The summary data under summary conditions is used as the current summary data. Whenever the number of cached local data reaches a preset number, a summary data can be obtained, and the summary data is cached on the storage end.
  • the data query method provided in this embodiment obtains local data of all stream data in a preset time interval, and caches the local data.
  • the preset summary condition is met
  • the currently cached data is summarized to obtain a summary. data.
  • the summary condition is met
  • the cached local data is summarized, thereby reducing the amount of data stored in the floor, reducing the resources occupied by the floor storage, and reducing the requirement for real-time accumulation of local data, and reducing The calculated pressure for the final polymerization.
  • FIG. 2 is a schematic flowchart diagram of a data query method according to Embodiment 2 of the present invention.
  • the execution body is a storage end.
  • the data query method includes the following steps:
  • S201 Receive a query request sent by a client.
  • the client when the user attempts to query the current aggregated data, the client may send a query request to the storage terminal, and the storage terminal may set a query interface, and the query interface receives the query request.
  • the storage side checks the currently cached data. Query to get summary data and local data when the query request is received.
  • the aggregation and the caching are performed asynchronously, that is, while the local data is cached, the cached data can be aggregated, so that the user can query the aggregated data of the current stream data in real time.
  • S203 Aggregate the aggregated data and the local data when the query request is received to obtain aggregated data.
  • the storage end After obtaining the aggregated data and the local data at the time of the query request, in order to enable the user to obtain the aggregated data, the storage end needs to perform an aggregation operation on the aggregated data and the local data at the time of the query request, to obtain an aggregated data, and send the aggregated data. To the client.
  • the summary data when the query request is received is one, and then the aggregated data when the query request is received is aggregated with the local data when the query is requested.
  • the aggregated data is sent to the client.
  • a summary data is generated and cached on the storage side every time the summary condition is satisfied, so the summary data when the query request is received is At least one of the aggregated data is aggregated with the local data of the query request when the query request is received, and the aggregated data is sent to the client.
  • the storage end summarizes the cached data when the summary condition is satisfied, thereby reducing the amount of data stored on the floor, reducing the resources occupied by the floor storage, and reducing the storage pressure of the storage end. Moreover, when the storage end is summarized, it is no longer necessary to read the local data and then fall back, saving time.
  • the data is aggregated by the storage device to obtain the aggregated data. In this embodiment, the amount of data stored in the storage is reduced, thereby reducing the pressure of the aggregation calculation on the storage end.
  • FIG. 3 is a schematic flowchart diagram of a data query method according to Embodiment 3 of the present invention.
  • the execution body is a storage end.
  • the data query method includes the following steps:
  • S301 Receive a query request sent by a client.
  • the client when the user attempts to query the current aggregated data, the client may send a query request to the storage terminal, and the storage terminal may set a query interface, and the query interface receives the query request.
  • the storage side queries the currently cached data to obtain summary data and local data when the query request is received.
  • the aggregation and the caching are performed asynchronously, that is, while the local data is cached, the cached data can be aggregated, so that the user can query the aggregated data of the current stream data in real time.
  • S303 Send summary data and local data when the query request is received to the client.
  • the storage terminal may send the summary data and the local data when the query request is obtained to the client, so that the client receives the locality. Aggregate data and local data at the time of query request are aggregated to obtain an aggregated data.
  • the summary data when the query request is received is one, and then the aggregated data when the query request is received and the local data when the query is requested are sent to the client. end.
  • a summary data is generated and cached on the storage side whenever the summary condition is satisfied, so the summary data is at least received when the query request is received.
  • the aggregated data is obtained by the client synthesizing the aggregated data and the local data.
  • the current cached data is obtained from the storage end through the query request, and the data currently cached by the storage end is aggregated at the client to obtain the aggregated data.
  • the amount of data stored in the floor is reduced, thereby reducing the amount of data sent to the client during the query, and reducing the computing pressure on the client.
  • FIG. 4 is a schematic diagram of a data query method according to Embodiment 4 of the present invention.
  • the execution entity is a client end.
  • the data query method includes the following steps:
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is satisfied, and the local data is data obtained by partially combining the real-time stream data.
  • the client when the user attempts to query the current aggregate data, the client may send a query request to the storage terminal, and the storage terminal may set a query interface, and the query interface receives the query request.
  • the storage end queries the summary data and the local data when the query request is received according to the query request.
  • the summary data and the local data refer to the description of related content in the foregoing embodiments, and details are not described herein again.
  • S402. Receive summary data sent by the storage end and local data.
  • the storage terminal may send the summary data and the local data when the query request is obtained to the client, and the client receives the summary sent by the storage terminal. Data and local data.
  • the client can locally aggregate the aggregated data and the local data when receiving the query request to obtain an aggregated data.
  • the summary data when the query request is received is one, and then the aggregated data when the query request is received and the local data when the query is requested are sent to the client. end.
  • a summary data is generated and cached on the storage side whenever the summary condition is satisfied, so the summary data is at least received when the query request is received.
  • the client may send the aggregated data to the storage end for storage.
  • the client when the user needs to aggregate the convection data, the client can obtain the currently cached data from the storage terminal through the query request, and aggregate the data currently cached by the storage end at the client to obtain the aggregated data. .
  • the amount of data stored in the floor is reduced, thereby reducing the amount of data sent to the client during the query, and reducing the computing pressure on the client.
  • FIG. 5 is a schematic diagram of a data processing system according to Embodiment 5 of the present invention.
  • the data processing system comprises: a real-time stream data module, a stream computing engine module, and a storage end.
  • the real-time stream data obtaining module can receive the real-time stream data, and send the stream data to the stream computing engine module, where the stream computing engine module can merge the stream data according to a preset time interval, and obtain the time interval correspondingly. a partial data.
  • the stream computing engine module caches local data to the storage side.
  • the storage end can merge multiple partial results in different places, that is, the storage end can summarize the cached data to obtain summary data.
  • For the process of summarizing the cached data refer to the description of the related content in the above embodiment, and no longer here. Said.
  • the storage end can provide a query interface for the client, and the client corresponding to the various services can query the aggregated data of the flow data in real time through the query interface.
  • the business can include real-time market, monitoring systems, and real-time business reports.
  • the local data is local sales, and then four partial sales will be generated in one minute, respectively: 0-15s, 16-30s,
  • the partial sales of 31 to 45 s and 46 to 60 s are as follows:
  • the preset setting has a summary condition, for example, the summary condition may be the number of local sales cached by the storage side, for example, the number of caches is set to three, and when the number of cached partial sales reaches three, The current cached sales of the storage end are 30, 30, and 40.
  • the storage side needs to summarize the three local sales, that is, when the 40 is cached, a summary of the storage end is triggered, and a summary is obtained.
  • the result 100 at which point the cache side stores a summary result 100 and a partial sales amount of 50.
  • the query interface of the storage end will perform the final aggregation operation, that is, 100 and 50 are merged to obtain 150, and then the 150 is returned to the client. .
  • the storage end aggregates the cached data when the summary condition is satisfied, thereby reducing the amount of data stored on the floor, reducing the resources occupied by the floor storage, and reducing the storage pressure of the storage end. Moreover, when the storage end is summarized, it is no longer necessary to read the local data and then fall back, saving time.
  • the data is aggregated by the storage device to obtain the aggregated data. In this embodiment, the amount of data stored in the storage is reduced, thereby reducing the pressure of the aggregation calculation on the storage end.
  • FIG. 6 is a schematic structural diagram of a data processing apparatus according to Embodiment 6 of the present invention.
  • the data processing apparatus includes a local merge module 11, a cache module 12, and a summary module 13.
  • the local merging module 11 is configured to perform local merging of the real-time stream data to obtain at least one local data.
  • the local merging module 11 may segment the real-time stream data according to a specific segmentation manner, and then combine the stream data in each segment to obtain at least one partial data.
  • a time interval is preset. When the time interval is reached, the local merging module 11 combines all the stream data in the time interval to obtain local data corresponding to all the stream data in the time interval.
  • the cache module 12 is configured to cache the local data.
  • the cache module 12 may perform a persistence on the local data, that is, cache the local data.
  • the summary module 13 is configured to summarize the currently cached data to obtain summary data when the preset summary condition is met.
  • a summary condition is set in advance, and each time the summary condition is met, the summary module 13 may trigger a summary calculation on the currently cached data to obtain summary data.
  • the currently cached data may be local data.
  • the currently cached data includes the summary data obtained when the summary condition is last met and the local data under the current summary condition.
  • the cache module 12 is further configured to: after the preset summary condition is met, summarize the currently cached data to obtain the current summary data, and then clear the summarized local data, and the cached summary. The summary data.
  • the cache module 12 is specifically configured to combine all the stream data in a preset time interval to obtain local data.
  • the summary condition is a preset time length or a number of cached data.
  • the data processing apparatus provided in this embodiment may be used to perform the data processing process shown in FIG. 1.
  • the data processing apparatus may be used to perform the data processing process shown in FIG. 1.
  • For the specific principle refer to the related description in the foregoing Embodiment 1, and details are not described herein again.
  • the data processing apparatus collects local data of all stream data in a preset time interval, and caches the local data.
  • the preset summary condition is met, the currently cached data is summarized to obtain a summary. data.
  • the summary condition is met, the cached local data is summarized, thereby reducing the amount of data stored in the floor, reducing the resources occupied by the floor storage, and reducing the requirement for real-time accumulation of local data, and reducing The calculated pressure for the final polymerization.
  • FIG. 7 is a schematic structural diagram of a data query apparatus according to Embodiment 7 of the present invention.
  • the data query device includes a receiving module 21, a query module 22, an aggregation module 23, and a sending module 24.
  • the receiving module 21 is configured to receive a query request sent by the client.
  • the query module 22 is configured to query the summary data and the local data when the query request is received.
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is met, and the local data is data obtained by locally combining the real-time stream data.
  • the summary condition is a preset time length or a number of cached data.
  • the aggregation module 23 is configured to aggregate the aggregated data and the local data when the query request is received to obtain aggregated data.
  • the sending module 24 is configured to send the aggregated data to the client.
  • the data querying device provided in this embodiment can be used to perform the data processing process shown in FIG. 2.
  • the specific principle refer to the related description in the foregoing Embodiment 2, and details are not described herein again.
  • the query request triggers the storage end to aggregate the currently cached data to obtain aggregated data, and the amount of data stored on the floor is reduced, thereby reducing the aggregation calculation of the storage end. pressure.
  • FIG. 8 is a schematic structural diagram of a data query apparatus according to Embodiment 8 of the present invention.
  • the data querying device includes: a receiving module 31, a querying module 32, and a sending module 33.
  • the receiving module 31 is configured to receive a query request sent by the client.
  • the query module 32 is configured to query the summary data and the local data when the query request is received.
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is met, and the local data is a partial combination of the real-time stream data. Data to.
  • the sending module 33 is configured to send the summary data and the local data when the query request is received to the client.
  • the receiving module 31 is further configured to: after sending the summary data and the local data when the query request is received to the client, receive the aggregated data returned by the client, where the aggregated data is Aggregated data obtained by the client when receiving the query request and local data are aggregated.
  • the data query device provided in this embodiment can be used to perform the data processing process shown in FIG. 3.
  • the data query device provided in this embodiment can be used to perform the data processing process shown in FIG. 3.
  • For the specific principle refer to the related description in the foregoing Embodiment 3, and details are not described herein again.
  • the data querying device when the user needs to aggregate the data, obtains the currently cached data from the storage terminal through the query request, and aggregates the data currently cached by the storage end at the client to obtain the aggregated data.
  • the amount of data stored in the floor is reduced, thereby reducing the amount of data sent to the client during the query, and reducing the computing pressure on the client.
  • FIG. 9 is a schematic structural diagram of a data query apparatus according to Embodiment 9 of the present invention.
  • the data querying device includes a sending module 41, a receiving module 42, and an aggregation module 33.
  • the sending module 41 is configured to send a query request to the storage end, so that the storage end queries the summary data and the local data when the query request is received according to the query request.
  • the summary data is data obtained by summarizing the currently cached data when the preset summary condition is met, and the local data is data obtained by locally combining the real-time stream data.
  • the receiving module 42 is configured to receive the summary data and the local data sent by the storage end.
  • the aggregation module 43 is configured to aggregate the summary data and the local data Aggregate data.
  • the sending module 41 is further configured to: after the aggregation module 43 aggregates the summary data and the local data to obtain aggregated data, send the aggregated data to the storage end for storage.
  • the data querying device provided in this embodiment can be used to perform the data processing process shown in FIG. 4.
  • the data querying device provided in this embodiment can be used to perform the data processing process shown in FIG. 4.
  • the data querying device when the user needs to aggregate the data, obtains the currently cached data from the storage terminal through the query request, and aggregates the data currently cached by the storage end at the client to obtain the aggregated data.
  • the amount of data stored in the floor is reduced, thereby reducing the amount of data sent to the client during the query, and reducing the computing pressure on the client.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种数据处理和查询方法及装置,通过对实时流数据进行局部合并,得到至少一个局部数据(101),将局部数据进行缓存(102),在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据(103)。所述方法及装置每当满足汇总条件时,就对缓存的局部数据进行汇总,从而减少在落地存储的数据量,减轻了落地存储占用的资源,而且减轻了对局部数据进行实时累积的要求,减小了最终聚合的计算压力。

Description

数据处理和查询方法及装置 技术领域
本发明属于数据处理领域,尤其涉及一种数据处理和查询方法及装置。
背景技术
在实时流数据落地存储的过程中,首先需要将一个时间间隔内产生的流数据需要进行一次局部合并,生成一个局部数据,然后将读取前面的累加数据,当前的流数据对应的局部数据与前面的累积数据再次进行累加,直到得到最后的累加数据。比如统计一分钟的销售额,可以每隔6秒算一个6s的销售总额,6s对应的销售总额就是一个局部数据,当到达第2次6s时,需要把第一次的6s对应的局部数据从落地的存储端中读取出来后,与第2个6s的局部数据进行累加。现有的实时流数据落地方法,整个落地过程需要内存对流数据的局部数据进行实时累积,计算压力较大,而且需要先读取一次数据再落地一次数据,耗费时间较长。
为了解决上述问题,现有技术中提出了一种多版本并发控制(Multi-Version Concurrency Control,简称MVCC)方案,在该方案中将每一个时间间隔内的流数据进行局部合并,生成一个局部数据,将该局部数据落地到存储端,例如,需要查询一天24小时内的销售总额时,从00:00开始每隔6s进行一个局部合并,得到一个局部数据,在到达设定的24:00时,这24小时内生成的所有局部数据个数为14400,而针对海量或者较长时间的流数据处理时,由于MVCC方案中的存储端中会存储了所有时间间隔对应的局部数据,导致存储端的存储压力较大。
发明内容
本发明提供一种数据处理和查询方法及装置,用于解决现有通过MVCC方案进行流数据落地时由于存储端存储所有的局部数据,存储压力较大的问题。
为了实现上述目的,本发明提供了一种数据处理方法,包括:
对实时流数据进行局部合并,得到至少一个局部数据;
将所述局部数据进行缓存;
在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据;其中所述当前缓存的数据至少包括所述局部数据。
为了实现上述目的,本发明提供了一种数据查询方法,包括:
接收客户端发送的查询请求;
查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
将接收到所述查询请求时的汇总数据以及局部数据进行聚合,以得到聚合数据;
将所述聚合数据发送给所述客户端。
为了实现上述目的,本发明提供了一种数据查询方法,包括:
接收客户端发送的查询请求;
查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端。
为了实现上述目的,本发明提供了一种数据查询方法,包括:
向存储端发送查询请求,以使所述存储端根据所述查询请求查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
接收所述存储端发送的所述汇总数据以及所述局部数据;
将所述汇总数据以及所述局部数据进行聚合得到聚合数据。
为了实现上述目的,本发明提供了一种数据处理装置,包括:
局部合并模块,用于对实时流数据进行局部合并,得到至少一个局部数据;
缓存模块,用于将所述局部数据进行缓存;
汇总模块,用于在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据;其中所述当前缓存的数据至少包括所述局部数据。
为了实现上述目的,本发明提供了一种数据查询装置,包括:
接收模块,用于接收客户端发送的查询请求;
查询模块,用于查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
聚合模块,用于将接收到所述查询请求时的汇总数据以及局部数据进行聚合,以得到聚合数据;
发送模块,用于将所述聚合数据发送给所述客户端。
为了实现上述目的,本发明提供了一种数据查询装置,包括:
接收模块,用于接收客户端发送的查询请求;
查询模块,用于查询接收到所述查询请求时的汇总数据以及局部数 据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
发送模块,用于将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端。
为了实现上述目的,本发明提供了一种数据查询装置,包括:
发送模块,用于向存储端发送查询请求,以使所述存储端根据所述查询请求查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
接收模块,用于接收所述存储端发送的所述汇总数据以及所述局部数据;
聚合模块,用于将所述汇总数据以及所述局部数据进行聚合得到聚合数据。
本发明提供的数据处理和查询方法及装置,通过对实时流数据进行局部合并,以得到至少一个局部数据,将局部数据进行缓存,在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据。本实施例每当满足汇总条件时,就对缓存的局部数据进行汇总,从而减少在落地存储的数据量,减轻了落地存储占用的资源,而且减轻了对局部数据进行实时累积的要求,减小了最终聚合的计算压力。
附图说明
图1为本发明实施例一的数据处理方法的流程示意图;
图2为本发明实施例二的数据查询方法的流程示意图;
图3为本发明实施例三的数据查询方法的流程示意图;
图4为本发明实施例四的数据查询方法的流程示意图;
图5为本发明实施例五的数据处理系统的示意图;
图6为本发明实施例六的数据处理装置的结构示意图;
图7为本发明实施例七的数据查询装置的结构示意图;
图8为本发明实施例八的数据查询装置的结构示意图;
图9为本发明实施例九的数据查询装置的结构示意图。
具体实施方式
下面结合附图对本发明实施例提供的数据处理和查询方法及装置进行详细描述。
实施例一
如图1所示,其为本发明实施例一的数据处理方法的流程示意图。本实施例中,执行主体为存储端。该数据处理方法包括以下步骤:
S101、对实时流数据进行局部合并,得到至少一个局部数据。
本实施例中,可以对实时流数据按照特定的分割方式进行分段,然后将每个分段内的流数据进行局部合并,得到至少一个局部数据。优选地,预设设置一个时间间隔,每当到达时间间隔时,存储端将该时间间隔内所有的流数据进行一个局部合并,即将该时间间隔内的所有流数据进行相加,得到该时间间隔内所有流数据对应的局部数据。比如计算每一分钟的实时销售额,设定每5s做一次合并,将该5s内的所有流数据进行一个相加汇总,生成一个局部的销售额,该局部的销售额就是局部数据,这样最后在存储端每一分钟就有60/5=12个局部的销售额。
S102、将局部数据进行缓存。
在获取到一个时间间隔的所有流数据对应的局部数据后,存储端可以对该局部数据进行缓存。
S103、在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据。
其中,所述当前缓存的数据中至少包括局部数据。
本实施例中,预先设置有汇总条件,每当满足汇总条件时,存储端则可以触发对当前缓存的数据进行汇总计算,得到汇总数据。
一种可选地对缓存的数据进行汇总的方式为:
优选地,汇总条件可以为预设的时间长度,即每当到达该预设的时间长度后,存储端对当前已经缓存的所有数据进行一次汇总,得到一个汇总数据。此处需要说明,当初始满足预设的汇总条件时,当前缓存的数据均为局部数据,而从第二次满足预设的汇总条件开始,当前缓存的数据中包括上一次的汇总数据和当前汇总条件下的局部数据。其中当前汇总条件下的局部数据为并不包括上一次汇总条件下缓存的局部数据。例如,预设的时间长度可以为1小时,首先从0点开始当到达1点后,存储端可以将这一个小时内缓存的局部数据进行一次汇总,得到一个汇总数据,从1点开始当到达到2点后,存储端需要再进行一次汇总,而当前缓存的数据中不仅包括1点到2点一个小时内所有流数据按照预设的时间间隔生成的局部数据,还包括前一个小时汇总后的汇总数据,此时存储端需要将上一次的汇总数据以及当前缓存的局部数据进行一次汇总计算,得到最新的汇总数据作为当前的汇总数据。
此处需要说明,当预设的汇总条件为预设的时间长度时,从0点开始到达1点后,以每个6s对流数据进行一次局部合并为例,则预设的时间长度内包括600个局部数据。从1点开始,每次存储端进行下一次汇总之前,存储端中当前缓存的数据包括1个上一次汇总数据,以及按照预设的时间间隔1小时内生成600个局部数据,从而存储端中当前缓存的数据个数最多为601,减少了存储端的存储压力。
可选地,汇总条件可以为预设的缓存数据的个数,即每当存储端当前缓存的数据个数到达预设的个数时,存储端就可以对已经缓存的数据进行一次汇总,得到一个汇总数据。此处需要说明,当初始满足预设的汇总条件时,当前缓存的数据均为局部数据,而从第二次满足预设的汇总条件开始,当前缓存的数据中包括上一次的汇总数据和当前缓存的局部数据。例如,预设的个数为10,首先从缓存的数据个数为0开始,当缓存的数据个数第一次到达10个时,存储端中当前缓存的10数据均为局部数据,对10个局部数据进行汇总计算,以得到一个汇总数据。本实施例中,在汇总计算后,将经过汇总后的数据进行清除,缓存得到的汇总数据,也就是说,在汇总计算后存储端缓存的数据就只剩下1个汇总数据,当缓存到存储到的局部数据数量到达9个时,此时就可以满足预设的个数这一汇总条件,存储端则对1个汇总数据和当前缓存的9个局部数据进行汇总,得到一个新的汇总数据作为当前的汇总数据。
此处需要说明,当预设的汇总条件为缓存数据的个数时,从从缓存的数据个数为0开始开,以缓存的数据个数为10为例,则当存储端缓存的数据个数到达10个时,存储端进行一次汇总。在汇总计算后存储端缓存的数据就只剩下1个汇总数据,当缓存到存储到的局部数据数量到达9个时,此时存储端进行一次汇总,从而存储端中当前缓存的数据个数最多为10,减少了存储端的存储压力。
进一步地,本实施例中在对当前的缓存数据进行汇总之后,需要将经过汇总的局部数据进行清除,将汇总数据进行缓存,等下一次满足汇总条件时,需要将汇总数据和下一汇总条件下的局部数据进行汇总。
另一种可选对当前缓存的数据进行汇总的方式为:
每当满足预设的汇总条件后,将该汇总条件下的局部数据进行汇总计算,得到一个该汇总条件下的汇总数据,该汇总条件下的汇总数据为 当前的汇总数据。在该汇总条件下的局部数据进行汇总后,将这些局部数据进行清除,只缓存该汇总条件下的汇总数据。优选地,预设的汇总条件为时间长度时,每当到达该时间长度时,就将该时间长度下的局部数据进行汇总,得到该时间长度下的汇总结果。在该汇总方式下,每个时间长度均生成一个汇总结果。
可选地,预设的汇总条件为缓存的局部数据的个数,每当缓存的局部数据的个数达到预设的个数时,将当前汇总条件下的这些局部数据进行汇总计算,得到当前汇总条件下的汇总数据作为当前的汇总数据。每当缓存的局部数据个数达到预设的个数,就可以得到一个汇总数据,这些汇总数据均缓存在存储端。
本实施例提供的数据查询方法,通过获取预设的时间间隔内所有流数据的局部数据,将局部数据进行缓存,在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据。本实施例每当满足汇总条件时,就对缓存的局部数据进行汇总,从而减少在落地存储的数据量,减轻了落地存储占用的资源,而且减轻了对局部数据进行实时累积的要求,减小了最终聚合的计算压力。
实施例二
如图2所示,其为本发明实施例二的数据查询方法的流程示意图。本实施例中,执行主体为存储端。该数据查询方法包括以下步骤:
S201、接收客户端发送的查询请求。
在上述实施例一的基础之上,用户试图查询当前的聚合数据时,可以基于客户端向存储端发送查询请求,存储端可以设置一个查询接口,通过该查询接口接收该查询请求。
S202、查询接收到查询请求时的汇总数据以及局部数据。
在接收到客户端查询请求的时刻,存储端对当前缓存的数据进行查 询,以获取在接收到该查询请求时的汇总数据和局部数据。本实施例中,聚合和缓存时异步执行的,即在缓存局部数据的同时,可以对缓存数据进行聚合操作,从而可以保证用户可以实时地查询获取当前流数据的聚合数据。
S203、将接收到查询请求时的汇总数据以及局部数据进行聚合,以得到聚合数据。
S204、将聚合数据发送给客户端。
在获取到查询请求时的汇总数据以及局部数据后,为了使用户得到聚合数据,存储端需要对该查询请求时的汇总数据以及局部数据进行一次聚合操作,得到一个聚合数据,将该聚合数据发送给客户端。
在上述实施例一中的一种对缓存的数据进行汇总的情况下,接收到查询请求时的汇总数据为一个,然后将接收到查询请求时的汇总数据与查询请求时的局部数据进行聚合,得到聚合数据发送给客户端。
在上述实施例一中的另一种对缓存的数据进行汇总的情况下,每当满足汇总条件时就会产生一个汇总数据并将其缓存在存储端,因此接收到查询请求时的汇总数据为至少一个,将接收到查询请求时所有的汇总数据与查询请求时的局部数据进行聚合,得到聚合数据发送给客户端。
本实施例提供的数据查询方法,通过每当满足汇总条件时,存储端对缓存的数据进行汇总,从而减少落地存储的数据量,减轻了落地存储占用的资源,减轻了存储端的存储压力。而且存储端进行汇总时,不再需要对局部数据进行读取后再落到,节省时间。在用户需要对流数据进行聚合时,通过查询请求触发存储端对当前缓存的数据进行聚合,得到聚合数据,本实施例由于落地存储的数据量变少,从而降低存储端的聚合计算的压力。
实施例三
如图3所示,其为本发明实施例三的数据查询方法的流程示意图。本实施例中,执行主体为存储端。该数据查询方法包括以下步骤:
S301、接收客户端发送的查询请求。
在上述实施例一的基础之上,用户试图查询当前的聚合数据时,可以基于客户端向存储端发送查询请求,存储端可以设置一个查询接口,通过该查询接口接收该查询请求。
S302、查询接收到查询请求时的汇总数据以及局部数据。
在接收到客户端查询请求的时刻,存储端对当前缓存的数据进行查询,以获取在接收到该查询请求时的汇总数据和局部数据。本实施例中,聚合和缓存时异步执行的,即在缓存局部数据的同时,可以对缓存数据进行聚合操作,从而可以保证用户可以实时地查询获取当前流数据的聚合数据。
S303、将接收到查询请求时的汇总数据以及局部数据发送给客户端。
在获取到查询请求时的汇总数据以及局部数据后,为了使用户得到聚合数据,存储端可以将获取到查询请求时的汇总数据以及局部数据发送给客户端,以使客户端在本地对接收到查询请求时的汇总数据以及局部数据进行聚合,得到一个聚合数据。
在上述实施例一中的一种对缓存的数据进行汇总的情况下,接收到查询请求时的汇总数据为一个,然后将接收到查询请求时的汇总数据与查询请求时的局部数据发送给客户端。
在上述实施例一中的另一种对缓存的数据进行汇总的情况下,每当满足汇总条件时就会产生一个汇总数据并将其缓存在存储端,因此接收到查询请求时汇总数据为至少一个,将接收到查询请求时所有的汇总数据与查询请求时的局部数据发送给客户端。
S304、接收客户端返回的聚合数据。
其中,聚合数据是由客户端对汇总数据以及局部数据进行聚合得到的。
本实施例提供的数据查询方法,在用户需要对流数据进行聚合时,通过查询请求从存储端获取当前缓存的数据,在客户端本地对存储端当前缓存的数据进行聚合,得到聚合数据。本实施例由于落地存储的数据量变少,从而减少了在查询时向客户端发送的数据量,减轻了客户端的计算压力。
实施例四
如图4所示,其为本发明实施例四的数据查询方法的示意图。本实施例中,执行主体为客户端端。该数据查询方法包括以下步骤:
S401、向存储端发送查询请求,以使存储端根据查询请求查询接收到查询请求时的汇总数据以及局部数据。
其中,汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,局部数据为对实时流数据进行局部合并得到的数据。
在上述实施例一的基础之上,当用户试图查询当前的聚合数据时,可以基于客户端向存储端发送查询请求,存储端可以设置一个查询接口,通过该查询接口接收该查询请求。
在接收到查询请求后,存储端根据该查询请求,查询接收到查询请求时的汇总数据和局部数据。其中,关于汇总数据以及局部数据的介绍,可参见上述实施例中相关内容的记载,此处不再赘述。
S402、接收存储端发送的汇总数据以及局部数据。
S403、将汇总数据以及局部数据进行聚合得到聚合数据。
在获取到查询请求时的汇总数据以及局部数据后,为了使用户得到聚合数据,存储端可以将获取到查询请求时的汇总数据以及局部数据发送给客户端,客户端接收该存储端发送的汇总数据和局部数据。
进一步地,客户端可以在本地对接收到查询请求时的汇总数据以及局部数据进行聚合,得到一个聚合数据。
在上述实施例一中的一种对缓存的数据进行汇总的情况下,接收到查询请求时的汇总数据为一个,然后将接收到查询请求时的汇总数据与查询请求时的局部数据发送给客户端。
在上述实施例一中的另一种对缓存的数据进行汇总的情况下,每当满足汇总条件时就会产生一个汇总数据并将其缓存在存储端,因此接收到查询请求时汇总数据为至少一个,将接收到查询请求时所有的汇总数据与查询请求时的局部数据发送给客户端。
进一步地,客户端在聚合得到聚合数据后,可以将该聚合数据发给存储端进行存储。
本实施例提供的数据查询方法,在用户需要对流数据进行聚合时,客户端可以通过查询请求从存储端获取当前缓存的数据,在客户端本地对存储端当前缓存的数据进行聚合,得到聚合数据。本实施例由于落地存储的数据量变少,从而减少了在查询时向客户端发送的数据量,减轻了客户端的计算压力。
实施例五
如图5所示,其为本发明实施例五的数据处理系统的示意图。该数据处理系统包括:实时流数据模块、流计算引擎模块、存储端。其中,实时流数据获取模块可以接收实时的流数据,并将流数据发送给流计算引擎模块中,在该流计算引擎模块中可以按照预设的时间间隔对流数据进行合并,得到该时间间隔对应的一个局部数据。流计算引擎模块将局部数据缓存到存储端。该存储端可以异地地合并多个局部结果,也就是说,存储端可以对缓存的数据进行汇总,得到汇总数据。关于对缓存的数据进行汇总的过程可参见上述实施例中相关内容的记载,此处不再赘 述。
进一步地,存储端可以为客户端提供一个查询接口,各种业务对应的客户端可以通过该查询接口,来实时地查询流数据的聚合数据。其中业务可以包括实时大盘、监控系统以及实时业务报表等。
为了更好地理解本发明实施例提供的数据处理方法,举例进行说明:
当前有5笔订单,其中订单就是流数据。
(20160113 13:42:00 10)
(20160113 13:42:10 20)
(20160113 13:42:20 30)
(20160113 13:42:35 40)
(20160113 13:42:50 50)
预设每15s由存储端对流数据进行一次合并,得到一个局部数据,此处局部数据为局部销售额,则一分钟就会产生4个局部销售额,分别为:0~15s、16~30s、31~45s和46~60s的局部销售额,如下:
原始订单金额     局部销售额
10+20.          30
30              30
40              40
50              50
预设设置有一个汇总条件,如该汇总条件可以为存储端缓存的局部销售额的个数,例如将缓存的个数设置为3个,当缓存的局部销售额的个数到达3个时,存储端当前缓存的销售额为30、30和40,在触发了汇总后,存储端则需要对3个局部销售额进行汇总,即当40进行缓存的时候触发了一次存储端的汇总,得到一个汇总结果100,此时缓存端存储有一个汇总结果100和一个局部销售额50。
当业务方基于客户端直接调用存储端的查询接口查询当前的实时销售额时,存储端的查询接口会做了最终一次的聚合操作,即将100和50做合并得到150,然后该150再返回给客户端。
本实施例提供的数据处理方法,通过每当满足汇总条件时,存储端对缓存的数据进行汇总,从而减少落地存储的数据量,减轻了落地存储占用的资源,减轻了存储端的存储压力。而且存储端进行汇总时,不再需要对局部数据进行读取后再落到,节省时间。在用户需要对流数据进行聚合时,通过查询请求触发存储端对当前缓存的数据进行聚合,得到聚合数据,本实施例由于落地存储的数据量变少,从而降低存储端的聚合计算的压力。
实施例六
如图6所示,其为本发明实施例六的数据处理装置的结构示意图。该数据处理装置包括:局部合并模块11、缓存模块12和汇总模块13。
其中,局部合并模块11,用于对实时流数据进行局部合并,得到至少一个局部数据。
本实施例中,局部合并模块11可以对实时流数据按照特定的分割方式进行分段,然后将每一段内的流数据进行合并,得到至少一个局部数据。优选地,预设设置一个时间间隔,每当到达时间间隔时,局部合并模块11将该时间间隔内所有的流数据进行一个合并,得到该时间间隔内所有流数据对应的局部数据。
缓存模块12,用于将所述局部数据进行缓存。
在获取到一个时间间隔的所有流数据对应的局部数据后,缓存模块12可以对该局部数据做出一次持久化,即将该局部数据进行缓存。
汇总模块13,用于在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据。
本实施例中,预先设置有汇总条件,每当满足汇总条件时,汇总模块13则可以触发对当前缓存的数据进行汇总计算,得到汇总数据。
其中,当前缓存的数据可以均为局部数据。
可选地,当前缓存的数据中包括上次满足所述汇总条件时得到的汇总数据以及当前汇总条件下的局部数据。
关于对缓存的数据进行汇总的相关内容,可参见上述实施例中相关内容的记载,此处不再赘述。
进一步地,缓存模块12,还用于在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到当前的汇总数据之后,清除经过汇总后的所述局部数据,以及缓存汇总得到的所述汇总数据。
缓存模块12,具体用于将预设的时间间隔内的所有流数据进行合并,以得到局部数据。
本实施例中,汇总条件为预设的时间长度或者缓存的数据个数。
本实施例提供的数据处理装置可用于执行图1所示数据处理流程,具体原理可参见上述实施例一中相关记载,此处不再赘述。
本实施例提供的数据处理装置,通过获取预设的时间间隔内所有流数据的局部数据,将局部数据进行缓存,在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据。本实施例每当满足汇总条件时,就对缓存的局部数据进行汇总,从而减少在落地存储的数据量,减轻了落地存储占用的资源,而且减轻了对局部数据进行实时累积的要求,减小了最终聚合的计算压力。
实施例七
如图7所示,其为本发明实施例七的数据查询装置的结构示意图。该数据查询装置包括:接收模块21、查询模块22、聚合模块23以及发送模块24。
其中,接收模块21,用于接收客户端发送的查询请求。
查询模块22,用于查询接收到所述查询请求时的汇总数据以及局部数据。
其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据。
其中,汇总条件为预设的时间长度或者缓存的数据个数。
关于汇总数据和局部数据的介绍,可参见上述实施例中相关内容的记载,此处不再赘述。
聚合模块23,用于将接收到所述查询请求时的汇总数据以及局部数据进行聚合,以得到聚合数据。
发送模块24,用于将所述聚合数据发送给所述客户端。
本实施例提供的数据查询装置可用于执行图2所示数据处理流程,具体原理可参见上述实施例二中相关记载,此处不再赘述。
本实施例提供的数据查询方法,在用户需要对流数据进行聚合时,通过查询请求触发存储端对当前缓存的数据进行聚合,得到聚合数据,由于落地存储的数据量变少,从而降低存储端的聚合计算的压力。
实施例八
图8所示,其为本发明实施例八的数据查询装置的结构示意图。该数据查询装置包括:接收模块31、查询模块32以及发送模块33。
其中,接收模块31,用于接收客户端发送的查询请求。
查询模块32,用于查询接收到所述查询请求时的汇总数据以及局部数据。
其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得 到的数据。
发送模块33,用于将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端。
进一步地,接收模块31,还用于在将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端之后,接收所述客户端返回的所述聚合数据,所述聚合数据是由所述客户端对接收到所述查询请求时的汇总数据以及局部数据进行聚合得到的。
本实施例提供的数据查询装置可用于执行图3所示数据处理流程,具体原理可参见上述实施例三中相关记载,此处不再赘述。
本实施例提供的数据查询装置,在用户需要对流数据进行聚合时,通过查询请求从存储端获取当前缓存的数据,在客户端本地对存储端当前缓存的数据进行聚合,得到聚合数据。本实施例由于落地存储的数据量变少,从而减少了在查询时向客户端发送的数据量,减轻了客户端的计算压力。
实施例九
图9所示,其为本发明实施例九的数据查询装置的结构示意图。该数据查询装置包括:发送模块41、接收模块42和聚合模块33。
其中,发送模块41,用于向存储端发送查询请求,以使所述存储端根据所述查询请求查询接收到所述查询请求时的汇总数据以及局部数据。
其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据。
接收模块42,用于接收所述存储端发送的所述汇总数据以及所述局部数据。
聚合模块43,用于将所述汇总数据以及所述局部数据进行聚合得到 聚合数据。
进一步地,发送模块41,还用于在聚合模块43将所述汇总数据以及所述局部数据进行聚合得到聚合数据之后,将所述聚合数据发送给所述存储端进行存储。
本实施例提供的数据查询装置可用于执行图4所示数据处理流程,具体原理可参见上述实施例四中相关记载,此处不再赘述。
本实施例提供的数据查询装置,在用户需要对流数据进行聚合时,通过查询请求从存储端获取当前缓存的数据,在客户端本地对存储端当前缓存的数据进行聚合,得到聚合数据。本实施例由于落地存储的数据量变少,从而减少了在查询时向客户端发送的数据量,减轻了客户端的计算压力。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (16)

  1. 一种数据处理方法,其特征在于,包括:
    对实时流数据进行局部合并,得到至少一个局部数据;
    将所述局部数据进行缓存;
    在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据;其中所述当前缓存的数据至少包括所述局部数据。
  2. 根据权利要求1所述的方法,其特征在于,所述当前缓存的数据均为局部数据。
  3. 根据权利要求1所述的方法,其特征在于,所述当前缓存的数据中包括上次满足所述汇总条件时得到的汇总数据以及当前汇总条件下的局部数据。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据之后,还包括:
    清除经过汇总后的所述局部数据;
    缓存汇总得到的所述汇总数据。
  5. 根据权利要求4所述的方法,其特征在于,所述对实施流数据进行局部合并,得到至少一个局部数据,包括:
    将预设的时间间隔内的所有流数据进行合并,以得到所述局部数据。
  6. 根据权利要求5所述的方法,其特征在于,所述汇总条件为预设的时间长度或者缓存的数据个数。
  7. 一种数据查询方法,其特征在于,包括:
    接收客户端发送的查询请求;
    查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到 的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
    将接收到所述查询请求时的汇总数据以及局部数据进行聚合,以得到聚合数据;
    将所述聚合数据发送给所述客户端。
  8. 一种数据查询方法,其特征在于,包括:
    接收客户端发送的查询请求;
    查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
    将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端。
  9. 根据权利要求8所述的方法,其特征在于,所述将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端之后,还包括:
    接收所述客户端返回的所述聚合数据,所述聚合数据是由所述客户端对接收到所述查询请求时的汇总数据以及局部数据进行聚合得到的。
  10. 一种数据查询方法,其特征在于,包括:
    向存储端发送查询请求,以使所述存储端根据所述查询请求查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
    接收所述存储端发送的所述汇总数据以及所述局部数据;
    将所述汇总数据以及所述局部数据进行聚合得到聚合数据。
  11. 根据权利要求10所述的方法,其特征在于,所述将所述汇总数据以及所述局部数据进行聚合得到聚合数据之后,包括:
    将所述聚合数据发送给所述存储端进行存储。
  12. 一种数据处理装置,其特征在于,包括:
    局部合并模块,用于对实时流数据进行局部合并,得到至少一个局部数据;
    缓存模块,用于将所述局部数据进行缓存;
    汇总模块,用于在满足预设的汇总条件时,对当前缓存的数据进行汇总,以得到汇总数据;其中所述当前缓存的数据至少包括所述局部数据。
  13. 一种数据查询装置,其特征在于,包括:
    接收模块,用于接收客户端发送的查询请求;
    查询模块,用于查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
    聚合模块,用于将接收到所述查询请求时的汇总数据以及局部数据进行聚合,以得到聚合数据;
    发送模块,用于将所述聚合数据发送给所述客户端。
  14. 一种数据查询装置,其特征在于,包括:
    接收模块,用于接收客户端发送的查询请求;
    查询模块,用于查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
    发送模块,用于将接收到所述查询请求时的汇总数据以及局部数据发送给所述客户端。
  15. 根据权利要求14所述的装置,其特征在于,所述接收模块,还 用于接收所述客户端返回的所述聚合数据,所述聚合数据是由所述客户端对接收到所述查询请求时的汇总数据以及局部数据进行聚合得到的。
  16. 一种数据查询装置,其特征在于,包括:
    发送模块,用于向存储端发送查询请求,以使所述存储端根据所述查询请求查询接收到所述查询请求时的汇总数据以及局部数据;其中,所述汇总数据为在满足预设的汇总条件时,对当前缓存的数据进行汇总得到的数据,所述局部数据为对实时流数据进行局部合并得到的数据;
    接收模块,用于接收所述存储端发送的所述汇总数据以及所述局部数据;
    聚合模块,用于将所述汇总数据以及所述局部数据进行聚合得到聚合数据。
PCT/CN2017/102853 2016-09-30 2017-09-22 数据处理和查询方法及装置 Ceased WO2018059310A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610875245.8 2016-09-30
CN201610875245.8A CN107885752A (zh) 2016-09-30 2016-09-30 数据处理和查询方法及装置

Publications (1)

Publication Number Publication Date
WO2018059310A1 true WO2018059310A1 (zh) 2018-04-05

Family

ID=61763693

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/102853 Ceased WO2018059310A1 (zh) 2016-09-30 2017-09-22 数据处理和查询方法及装置

Country Status (3)

Country Link
CN (1) CN107885752A (zh)
TW (1) TW201814558A (zh)
WO (1) WO2018059310A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115757463A (zh) * 2022-11-16 2023-03-07 上海浦东发展银行股份有限公司 数据查询方法、装置、设备、介质和产品

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004068469A2 (en) * 2003-01-17 2004-08-12 Tacit Networks, Inc. Method and system for use of storage caching with a distributed file system
CN101997701A (zh) * 2009-08-10 2011-03-30 中兴通讯股份有限公司 数据处理方法及装置
CN104216766A (zh) * 2014-08-26 2014-12-17 华为技术有限公司 对流数据进行处理的方法及装置
CN105515842A (zh) * 2015-12-01 2016-04-20 成都科来软件有限公司 一种基于网络数据的通用查询系统及查询方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104753966A (zh) * 2013-12-25 2015-07-01 明博教育科技有限公司 一种基于服务器和客户端缓存的资源文件查询方法及系统
CN104391876A (zh) * 2014-10-30 2015-03-04 北京思特奇信息技术股份有限公司 一种静态数据存储及查询方法及系统
CN105224694A (zh) * 2015-11-10 2016-01-06 中国建设银行股份有限公司 一种汇总信息查询方法、装置及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004068469A2 (en) * 2003-01-17 2004-08-12 Tacit Networks, Inc. Method and system for use of storage caching with a distributed file system
CN101997701A (zh) * 2009-08-10 2011-03-30 中兴通讯股份有限公司 数据处理方法及装置
CN104216766A (zh) * 2014-08-26 2014-12-17 华为技术有限公司 对流数据进行处理的方法及装置
CN105515842A (zh) * 2015-12-01 2016-04-20 成都科来软件有限公司 一种基于网络数据的通用查询系统及查询方法

Also Published As

Publication number Publication date
TW201814558A (zh) 2018-04-16
CN107885752A (zh) 2018-04-06

Similar Documents

Publication Publication Date Title
CN102521269B (zh) 一种基于索引的计算机连续数据保护方法
US20170351667A1 (en) Transaction processing method, processing node, central node, and cluster
CN106528451B (zh) 针对小文件的二级缓存预取的云存储框架及构建方法
WO2019033605A1 (zh) 订单异步处理的方法、装置、存储介质及终端
CN104778095B (zh) 一种云平台数据管理方法
CN105446893A (zh) 数据存储方法及设备
CN104536849B (zh) 一种基于云计算的数据备份方法
CN103854214A (zh) 竞拍数据的处理方法及系统
CN102737068B (zh) 一种用于对检索数据进行缓存管理的方法与设备
WO2015085969A1 (zh) 推荐算法优化方法、装置及系统
WO2023077451A1 (zh) 一种基于列存数据库的流式数据处理方法及系统
CN102546716B (zh) 一种缓存区管理方法、装置及流媒体点播系统
CN108280134B (zh) 基于账户额度控制的数据流通系统及方法、存储介质、终端
CN107886352B (zh) 一种广告结算的方法及系统
CN103631972B (zh) 一种列访问感知的数据缓存方法及系统
CN105989065B (zh) 一种闪拍数据处理方法及系统
WO2018059310A1 (zh) 数据处理和查询方法及装置
CN108897822A (zh) 一种数据更新方法、装置、设备及可读存储介质
CN110083666A (zh) 服务器装置、信息收集系统、信息收集方法以及记录介质
WO2019042298A1 (zh) 一种实现智能缓存的方法及装置及其计算机可读存储介质和计算机设备
CN102902735B (zh) 一种交互式网络电视iptv搜索缓存方法和系统
CN113722389A (zh) 数据管理方法、装置、电子设备及计算机可读存储介质
CN107295059A (zh) 业务推送量的统计系统及方法
CN104750696A (zh) 一种数据预取方法及装置
CN113835613A (zh) 一种文件读取方法、装置、电子设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17854760

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17854760

Country of ref document: EP

Kind code of ref document: A1