Method and device for real-time aggregation and interval aggregation of data

Through the combination of HDFS and HBase, parallel aggregation and storage of massive real-time data are realized, which solves the problems of data loss, high resource usage and poor scalability in the existing technology, and provides the flexibility and readability of real-time and interval aggregation.

CN113760900BActive Publication Date: 2024-10-18XIAN JINGXUNDI SUPPLY CHAIN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110188972.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-19
Publication Date
2024-10-18
Estimated Expiration
2041-02-19

AI Technical Summary

Technical Problem

The existing technology has problems of data loss, high resource usage, poor scalability and poor coding readability in the correlation and summary of massive real-time data, especially the system complexity and complexity caused by ElasticSearch's quasi-real-time storage and independently deployed consumer program groups. Increased risk.

Method used

Deploy HBase-based RegionServer through HDFS to achieve parallel aggregation and storage of data, reduce network transmission, support SQL parallel processing, and implement interval aggregation through scheduling expressions, reducing system complexity and resource usage.

Benefits of technology

It achieves complete real-time processing and storage, reduces summary time, provides resource scalability and SQL support, improves the readability and flexibility of the system, and adapts to different data volume scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760900B_ABST
    Figure CN113760900B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for real-time aggregation and interval aggregation of data, and relates to the field of computer technology. A specific implementation of the method includes: deploying a predetermined number of RegionServers based on HBase via HDFS; each RegionServer aggregates data in parallel according to a predetermined field, and sends the aggregated data of each RegionServer to the client for secondary aggregation of the data. This implementation reduces full real-time processing and storage; places storage and computing resources on the same machine, minimizes data network transmission and thus reduces aggregation time; achieves resource expansion without program perception; provides support for SQL to make readability better; and provides real-time aggregation and interval aggregation to solve different data volume scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for real-time aggregation and interval aggregation of data. Background Art

[0002] In the current context of large amounts of business data, the association and aggregation of massive amounts of real-time data has always been a difficult problem in the field. The main steps of the current solution are: aggregate the data generated in real time by each business table into the Topic of Kafka; use a consumer application group to cache or read back the associated fields in ElasticSearch, associate the two business table programs and store them in the wide table created by ElasticSearch; periodically start the aggregation application group to read the wide table data of the period to be aggregated, aggregate and process it, and store it in the cache or relational database.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] -ElasticSearch only stores data in quasi-real time, which results in loss of data during the period of data writing to disk;

[0005] - The independent deployment of the consumer application group and the aggregate application group takes up a lot of machine resources, which greatly increases the complexity and risk points of the entire system;

[0006] - Calculation and data are on different machines. Due to the huge amount of data, a lot of network transmission is required, which causes the aggregation stage to occupy a lot of network resources and also increases the aggregation time.

[0007] - Poor scalability of both computing resources and storage resources; and

[0008] -ElasticSearch API coding is difficult to read and difficult to get started with. Summary of the invention

[0009] In view of this, an embodiment of the present invention provides a real-time data aggregation method and an interval aggregation method and a device thereof, which can achieve:

[0010] -Fully real-time processing and storage;

[0011] -Put storage and computing resources on the same machine, minimizing data network transmission and thus reducing aggregation time;

[0012] -Realize resource expansion without program awareness;

[0013] - Provides support for SQL to make it more readable; and

[0014] -Provide real-time aggregation and interval aggregation to solve different data volume scenarios.

[0015] To achieve the above object, according to a first aspect of an embodiment of the present invention, a real-time data aggregation method is provided, comprising:

[0016] Deploy a predetermined number of RegionServers based on HBase via HDFS;

[0017] Each RegionServer aggregates data in parallel based on the predetermined fields, and

[0018] The RegionServer's respective aggregated data is sent to the client for secondary aggregation of the data.

[0019] Preferably, according to the real-time data aggregation method of the first aspect, wherein RegionServer aggregates data according to predetermined fields respectively, comprising the following steps:

[0020] The HBase server receives the SQL query statement sent by the client;

[0021] The predetermined number of RegionServers on the HBase server side parse the received SQL query statement according to the predetermined fields to convert the SQL query statement into an API; and

[0022] The data in the pre-stored data table is inserted or read through the API, and the data in the data table after the processing operation is summarized in each RegionServer.

[0023] Preferably, the real-time data aggregation method according to the first aspect further includes: a coprocessor program is pre-embedded in the coprocessor of the RegionServer, and the coprocessor program converts the corresponding field data into a character stream according to the table data type in the pre-maintained metadata and stores it in the HBase table.

[0024] Preferably, according to the real-time data aggregation method of the first aspect, the coprocessor program also records the data type of the field and the primary key formation rule of the HBase table into the metadata for storage.

[0025] Preferably, according to the real-time data aggregation method of the first aspect, data in a pre-stored data table is inserted or read in HDFS through an API and returned to the coprocessor.

[0026] Preferably, according to the real-time data aggregation method of the first aspect, during the insert or read process, the corresponding data type and primary key conversion is performed and returned to the client.

[0027] Preferably, according to the real-time data aggregation method of the first aspect, the detailed data is aggregated once through large-scale parallel processing, and the result set of the aggregation is returned to the client.

[0028] According to a second aspect of an embodiment of the present invention, there is provided a method for summarizing data by intervals, comprising: presetting a scheduling expression; and

[0029] In a state where the scheduling expression is satisfied, the real-time data aggregation method according to the first aspect is cyclically executed by calling an interface to obtain interval stage results of the data.

[0030] Preferably, the interval aggregation method for data in the second aspect further includes: saving the interval stage results to a relational database or cache.

[0031] According to a third aspect of an embodiment of the present invention, a real-time data aggregation device is provided, comprising:

[0032] An extension module that deploys a predetermined number of HBase-based RegionServers via HDFS;

[0033] A parallel aggregation module that enables each RegionServer to aggregate data in parallel according to a predetermined field; and

[0034] The sending module sends the aggregated data of each RegionServer to the client for secondary aggregation of the data.

[0035] According to a fourth aspect of an embodiment of the present invention, there is provided a data interval aggregation device, comprising:

[0036] An extension module that deploys a predetermined number of HBase-based RegionServers via HDFS;

[0037] Parallel aggregation module, which enables each RegionServer to aggregate data in parallel according to predetermined fields;

[0038] A sending module, which sends the aggregated data of each RegionServer to the client for secondary aggregation of the data; and

[0039] The calling module, under the condition that the preset scheduling expression is satisfied, cyclically calls the extension module, the parallel aggregation module and the sending module through the calling interface to obtain the interval stage result of the data.

[0040] A fourth aspect of this embodiment further provides an electronic device for real-time aggregation of data, which includes:

[0041] one or more processors;

[0042] a storage device for storing one or more programs,

[0043] When the one or more programs are executed by the one or more processors, the one or more processors implement the methods according to the first aspect and the second aspect.

[0044] A fifth aspect of this embodiment provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in the first aspect and the second aspect is implemented.

[0045] An embodiment of the above invention has the following advantages or beneficial effects: because HD FS (distributed file system) is used to ensure the scalability of storage, the computing program based on the data node ensures that the computing power can be linearly expanded with the storage resources; in addition, because the data is summarized in parallel at a predetermined number of RegionServers of HBase, it can achieve complete real-time processing and storage, so that storage and computing resources are placed on the same machine (server side), minimizing data network transmission to reduce the aggregation time, and achieving resource expansion without program perception. Furthermore, since the method of this embodiment converts SQL into API, in subsequent operations, there is no need to perform ElasticSearch API coding separately, providing support for SQL, making it more readable. In addition, by calling according to the scheduling expression, two methods of real-time aggregation and interval aggregation are provided to solve different data volume scenarios.

[0046] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0048] Figure 1 is a schematic diagram of the main process of the real-time data aggregation method according to an embodiment of the present invention;

[0049] Figure 2 is a schematic diagram of main modules of a real-time data aggregation device according to an embodiment of the present invention;

[0050] Figure 3 is a schematic diagram of a specific process of an example of a real-time data aggregation method according to an embodiment of the present invention;

[0051] Figure 4 is a schematic diagram of the main process of the interval aggregation method of data to which the real-time aggregation method of data according to an embodiment of the present invention is applied;

[0052] Figure 5 is a schematic diagram of a process of creating a wide table according to an embodiment of the present invention;

[0053] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0054] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0055] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0056] Figure 1 Schematic diagram of the main process of the real-time data aggregation method according to an embodiment of the present invention. Figure 1 As shown, the real-time aggregation method of the data is mainly implemented through steps S101 to S103.

[0057] In step S101, a predetermined number of RegionServers based on HBase are deployed via HDFS. In this embodiment, the number of RegionServers can be as follows: Figure 3 The above are 5, but this is not restrictive, and the number of RegionServer deployments can be determined based on the amount of data.

[0058] The HDFS mentioned above is the Hadoop Distributed File System (HDFS), which is designed to be a distributed file system suitable for running on commodity hardware and can be easily expanded.

[0059] The HBase mentioned above is a distributed, column-oriented open source database based on HDFS. In addition, the RegionServer mentioned above is the most important component in HBase, responsible for the actual reading and writing of table data and managing Regions. In a distributed cluster, the RegionServer is generally on the same node as the DataNode to achieve data locality and improve read and write efficiency.

[0060] In step S102, each RegionServer aggregates data in parallel according to the predetermined fields. Figure 3 As shown, it can specifically include: the HBase server receives the SQL query statement sent by the client; the predetermined number of RegionServers of the HBase server parse the received SQL query statement according to the predetermined fields to convert the SQL query statement into an API; and insert or read the data in the pre-stored data table through the API, and summarize the data in the data table after the processing operation in each RegionServer.

[0061] In step S103, the aggregated data of each RegionServer is sent to the client for secondary aggregation of the data. Accordingly, the client can receive the aggregated data of each RegionServer, so that the client program can secondary aggregate the aggregated data of each RegionServer to obtain complete aggregated data.

[0062] According to the above-mentioned real-time data aggregation method including steps S101 to S103, because HDFS (distributed file system) is used to ensure storage scalability, the computing program based on the data node ensures that the computing power is linearly expanded with the storage resources; in addition, because the data is aggregated in parallel at a predetermined number of RegionServers of H Base, it can achieve full real-time processing and storage, so that storage and computing resources are placed on the same machine (server side), minimizing data network transmission to reduce aggregation time, and achieving resource expansion without program perception. Furthermore, since the method of this embodiment converts SQL into API, in subsequent operations, there is no need to perform ElasticSearch API encoding separately, providing support for SQL, making it more readable.

[0063] Below, we will refer to the attached Figure 3 The flowchart more clearly describes an example of a method for real-time aggregation of data according to an embodiment of the present invention.

[0064] Since the time sequence of data arrival cannot be determined in real-time business data processing, a distributed cache is used to store the first-arrived data. The later-arrived data is read from the cache to form complete data and sent to the client module of the present invention. The coprocessor program embedded in the RegionServer converts the corresponding field data into a character stream according to the table data type in the metadata maintained in advance and stores it in the HBase table. When the stage summarizes the data, the coprocessor program of the RegionServer coprocessor receives the corresponding SQL statement, parses it into the corresponding HBase API code, summarizes the data that meets the predetermined conditions on the local machine, and returns it to the query machine. The query machine, i.e., the client, performs secondary summarization after receiving the data summarized by each HBase.

[0065] like Figure 3 As shown in FIG. 1 , HDFS is deployed with five HBase-based RegionServers. A coprocessor program is embedded in the coprocessor of each RegionServer, which can parse SQL statements and convert them into APIs.

[0066] More specifically, in Figure 3 In the process, first, the client sends an SQL statement to HBase; then, the coprocessor program of the coprocessor embedded in the HBaseRegionServer parses the SQL statement and converts it into an API; after that, in HDFS, the corresponding table data is inserted / read through the API and returned to the coprocessor; then, the coprocessor program aggregates the local data in the RegionServer (one-time aggregation) and returns the aggregation result to the client; finally, the client performs a secondary aggregation on the data returned by multiple H BaseRegionServers.

[0067] Figure 3 A specific example of the real-time aggregation method of data in is suitable for data volumes within the computing power of storage (about millions of aggregations on a single data node), in which the distributed file system (HDFS) is used to ensure storage scalability, and the computing program based on the data node ensures that the computing power expands linearly with the storage resources. The coprocessor program embedded in the RegionServer parses SQL and converts data types, and aggregates the data on the local machine in parallel on each data node (each HBase Region Server) and returns it, thereby ensuring the minimum transmission of data on network nodes. No matter how large the amount of data is aggregated, only n×summary result key-value pair bytes (n is the number of HBase Region Server nodes) are transmitted on the network. After receiving the returned data, the client program will perform a secondary aggregation based on the key value and return it to the caller.

[0068] As can be clearly seen above, according to the real-time data aggregation method of the present invention, HDFS (distributed file system) is used to ensure the scalability of storage, and the computing program based on the data node ensures that the computing power expands linearly with the storage resources, and can achieve complete real-time processing and storage, so that storage and computing resources are placed on the same machine (server side), minimizing data network transmission to reduce aggregation time, and achieving resource expansion without program perception. Furthermore, since the method of this embodiment converts SQL into API, in subsequent operations, there is no need to perform ElasticSearchAPI encoding separately, providing support for SQL, making it more readable.

[0069] Figure 4 A schematic diagram showing the main flow of a method for summarizing data within an interval using the method for summarizing data in real time according to an embodiment of the present invention is shown.

[0070] Compared with real-time data aggregation, the amount of data in interval aggregation is larger, and accordingly, the amount of storage and calculation is also larger. However, for such interval aggregation with huge data volume, using Figure 1 , 3 The real-time data aggregation method according to the embodiment of the present invention can flexibly and conveniently process interval aggregation of data.

[0071] More specifically, for interval aggregation of data, it is only necessary to add a scheduling framework to the above-mentioned real-time aggregation method of data. Figure 4 As shown, according to the pre-configured scheduling expression, the real-time summary result of the data is cyclically called when the scheduling expression is met ( Figure 4 The client program, or the result of the secondary aggregation in the real-time aggregation of the data implemented by the client program), and the interval stage results are saved to the corresponding relational database or cache, so as to realize the interval aggregation of the data.

[0072] The interval aggregation method of data according to the embodiment of the present invention adopts the real-time aggregation result of data, and therefore can accordingly achieve the technical effect of real-time aggregation of data mentioned above.

[0073] According to an embodiment of the present invention, no matter whether a real-time data aggregation method or an interval data aggregation method is adopted, there is no need to independently apply for an aggregation application group, because the data processing work is transferred to the distributed data node machines, which not only eliminates the network transmission of large amounts of data but also streamlines the architecture of the entire system, and can flexibly handle various data volume requirements.

[0074] Figure 5 4 is a schematic diagram of a process of creating a wide table according to an embodiment of the present invention.

[0075] exist Figure 3 In the step of sending SQL statements from the client program to the HBase table, for the creation of a wide table, since HBase can only store byte types and the query performance is closely related to the primary key of the HBase table, Figure 5 As shown in the figure, when creating a wide table, the field data type and primary key formation rules need to be recorded and stored in the metadata. When inserting and reading data later, the corresponding data type and row key conversion are performed and returned to the client program.

[0076] Examples

[0077] The following briefly describes an example of a use scenario of real-time aggregation of data of the present invention. In this embodiment, the data of the business table needs to be aggregated in real time.

[0078] Business table: In this example, the business table takes the waybill table as an example. Because the amount of data related to the waybill is huge and involves many fields, it is split into three MySQL tables waybill_m, waybill_c, and waybill_e and supported in the form of separate libraries and tables.

[0079] The main field information of the three tables is shown in table waybill_m, table waybill_c, and table waybill_e below.

[0080] Waybill_m:

[0081]

[0082] Waybill_c:

[0083] Fields Remark WAYBILL_CODE Waybill Number VENDOR_ID Order Number ARRIVE_AREA Destination area name PROVINCE_NAME Province Name The remaining thirty or so columns...

[0084] Waybill_e

[0085]

[0086]

[0087] Requirements and scenarios: In this example, for example, it is necessary to summarize and count the actual amount of normal waybills received in the seven regions starting from 0:00 on the day, the freight priced according to the contract, the service fee priced according to the contract, and the total packaging cost in real time. If factors such as the amount of data are not considered, the SQL required to achieve this is as follows:

[0088] SELECT

[0089] c.ARRIVE_AREA,

[0090] SUM(m.ACTUAL_COLLECTION)AS'actual amount received',

[0091] SUM(e.FREIGHT)AS'Freight priced according to the contract',

[0092] SUM(e.SERVICE_CHARGE)AS'Service fee calculated by contract',

[0093] SUM(e.PACKING_CHARGES)AS'Total packaging cost'

[0094] FROM waybill_m m

[0095] JOIN waybill_c c

[0096] ON m.WAYBILL_CODE=c.WAYBILL_CODE

[0097] JOIN waybill_e e

[0098] ON m.WAYBILL_CODE=e.WAYBILL_CODE

[0099] WHERE

[0100] m.SIGN_STATE=1AND DATE(SIGN_DATE)=TODAY()AND m.WAYBILL_TYPE=0

[0101] GROUP BY

[0102] c.ARRIVE_AREA

[0103] Since the three tables have billions of stored data and are evenly distributed in different databases and tables, MySQL cannot perform associated summary queries on the three tables, let alone return results within seconds.

[0104] Table creation and writing: According to the real-time summary and distribution of data of the present invention, a wide table creation statement is created using the client. The table creation statement and the corresponding field type will be stored in the metadata and used to convert the bytes of the HBase column into the corresponding data type. The table creation statement is as follows:

[0105]

[0106] In the configuration, select grouping fields, filter expressions, summary fields, summary types, and summary fields. Select DATE (SIGN_DATE) and ARRIVE_AREA as grouping fields; SIGN_STATE = 1 and WAYBILL_TYPE = 0 as filter expressions; SUM as summary type; and ACTUAL_COLLECTION, FREIGHT, SERVICE_CHARGE, and PACKING_CHARGES as summary fields.

[0107] The above configuration information will be stored in the metadata according to the embodiment of the present invention. According to the real-time data aggregation method of the present invention, it creates a summary HBase table `waybill_mce_sum` with DATE (SIGN_DATE) and ARRIVE_AREA as row keys based on the grouping fields. When the stream processing application uses the client insert statement of the present invention, such as:

[0108] INSERT INTO waybill_mce VALUES(`JDX08808`,50,0,1,0,1,`2020-06-28 21:05:56`,`North China`,21.5,43.2,9.4); The server-side program (invention) embedded in the Region Server parses the SQL and returns the field information of the table and the configured pre-aggregation information from the metadata, reads the record row with the row key of `2020-06-28+North China` in the summary table `waybill_mce_sum`, accumulates the four summary columns respectively and overwrites the row.

[0109] Realize imperceptible query and aggregation: Using the real-time aggregation method of data of the present invention, when the client attempts to query the aggregated index in real time, send SQL such as:

[0110] SELECT

[0111] SUM(ACTUAL_COLLECTION)AS'actual amount collected',

[0112] SUM(FREIGHT)AS'Freight priced according to the contract',

[0113] SUM(SERVICE_CHARGE)AS'Service fee calculated by contract',

[0114] SUM(PACKING_CHARGES)AS'Total packaging cost'

[0115] FROM waybill_mce

[0116] WHERE SIGN_STATE=1AND DATE(SIGN_DATE)=TODAY()AND WAYBILL_TYPE=0

[0117] GROUP BY ARRIVE_AREA.

[0118] Therefore, the server program (invention) embedded in the Region Server parses the received SQL statement, matches the corresponding HBase summary table `waybill_mce_sum` according to the summary condition group configured in the metadata, and then returns the result set of the scanned records with the row key prefix of 2020-06-28 to the client. This result set is the final summary indicator value of the seven regions. If it is a detailed query, the original HBase table `waybill_mce` is directly queried to return the detailed result set.

[0119] So far, in this example, real-time aggregation of the data in the above-mentioned “requirements and scenarios” is achieved imperceptibly.

[0120] In addition, you can also consider no aggregation configuration. If the user does not configure aggregation for the table, with the help of HBase's distributed multi-RegionServer feature (HBase can configure the number of RegionServers generated by the table), the co-processing service program will obtain all qualified detailed data through the RegionServer and perform an MPP aggregation before returning the result set to the client program. The number of records received by the client is 7 (number of regions) * number of RegionServers. The client performs a secondary aggregation of the data set based on the secondary aggregation flag returned by the server to obtain the final aggregation result. If the number of RegionServers is reasonably set, the response can be achieved in seconds or even milliseconds without aggregation configuration.

[0121] The MPP (Massively Parallel Processing) mentioned above refers to large-scale parallel processing. In a non-shared database cluster, each node has an independent disk storage system and memory system. Business data is divided into each node according to the database model and application characteristics. Each data node is connected to each other through a dedicated network or a commercial general network, and they collaborate with each other to provide database services as a whole.

[0122] The embodiment of the present invention also provides a real-time data aggregation device 200. Figure 2As shown, the real-time data aggregation device 200 includes: an expansion module 201, which deploys a predetermined number of RegionServers based on HBase via HDFS; a parallel aggregation module 202, which enables each RegionServer to aggregate data in parallel according to predetermined fields; and a sending module 203, which sends the aggregated data of each RegionServer to the client for secondary aggregation of the data.

[0123] A coprocessor program is embedded in the coprocessor of each of the predetermined number of RegionServers of the extension module 201 , and the coprocessor program can parse the SQL statement and convert it into an API.

[0124] The parallel aggregation module 202 enables each RegionServer to aggregate data in parallel according to predetermined fields, which can specifically include the following steps in the parallel aggregation module 202: the HBase server receives the SQL query statement sent by the client; the predetermined number of RegionServers on the HBase server parse the received SQL query statement according to the predetermined fields to convert the SQL query statement into an API; and insert or read data in a pre-stored data table through the API, and aggregate the data in the data table after the processing operation in each RegionServer.

[0125] According to an embodiment of the present invention, a data interval aggregation device is also provided. Figure 2 On the basis of the real-time data aggregation device 200 shown, a calling module is added, so that when a preset scheduling expression is met, the calling module cyclically calls the extension module, the parallel aggregation module and the sending module through the calling interface to obtain the interval stage results of the data.

[0126] Figure 6 An exemplary system architecture 600 is shown to which the method for real-time aggregation of data or interval aggregation of data or the apparatus for real-time aggregation of data or interval aggregation of data according to the embodiments of the present invention can be applied.

[0127] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0128] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0129] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0130] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0131] It should be noted that the method for real-time aggregation of data or interval aggregation of data provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the device for real-time aggregation of data or interval aggregation of data is generally set in the server 605 .

[0132] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0133] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0134] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0135] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0136] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0137] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0138] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0139] The "modules" involved in the embodiments of the present invention may be implemented in software or hardware. The described "modules" may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."

[0140] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: deploying a predetermined number of RegionServers based on HBase via HDFS; each RegionServer summarizes data in parallel according to a predetermined field, and sends the summarized data of each RegionServer to the client for secondary aggregation of data; or the device includes: presetting a scheduling expression; and in a state where the scheduling expression is satisfied, by calling an interface, cyclically executing real-time aggregation of data and performing interval aggregation to obtain interval stage results of data.

[0141] According to the technical solution of the embodiment of the present invention, HDFS (distributed file system) is used to ensure the scalability of storage, and the computing program based on the data node ensures that the computing power expands linearly with the storage resources, which can achieve full real-time processing and storage, so that storage and computing resources are placed on the same machine (server side), minimize data network transmission, thereby reducing aggregation time, and achieving resource expansion without program perception. Furthermore, since the method of this embodiment converts SQL into API, in subsequent operations, there is no need to perform Elastic Search API coding separately, providing support for SQL and making it more readable.

[0142] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A real-time data aggregation method, characterized in that: include: Deploy a predetermined number of RegionServers based on HBase via HDFS; Each RegionServer aggregates data in parallel based on the predetermined fields, and Send the RegionServer's aggregated data to the client for secondary data aggregation; The RegionServers each aggregate data according to predetermined fields, including the following steps: The HBase server receives the SQL query statement sent by the client; The predetermined number of RegionServers on the HBase server side parse the received SQL query statement according to the predetermined fields to convert the SQL query statement into an API; as well as Insert or read data from a pre-stored data table through an API, and aggregate the data in the data table after the processing operation in each RegionServer; The coprocessor of the RegionServer is pre-embedded with a coprocessor program, which converts the corresponding field data into a character stream according to the table data type in the pre-maintained metadata and stores it in the HBase table; The coprocessor program also records the data type of the field and the primary key formation rule of the HBase table into the metadata; Insert or read data from a pre-stored data table in HDFS through an API, and return the data to the coprocessor; During the insert or read process, the corresponding data type and primary key conversion is performed and returned to the client, so that the client performs secondary aggregation on the returned data according to the key value in the returned data.

2. The real-time data aggregation method according to claim 1, characterized in that: The coprocessor program obtains all detailed data that meets the predetermined conditions through the RegionServer and summarizes them once through large-scale parallel processing, and the result set of the summary is returned to the client.

3. A method for summarizing data intervals, characterized in that: Preset scheduling expressions; and In a state where the scheduling expression is satisfied, the real-time data aggregation method according to any one of claims 1 to 2 is cyclically executed by calling an interface to obtain interval stage results of the data.

4. The interval aggregation method of data according to claim 3, characterized in that: Also includes: The interval stage results are saved in a relational database or cache.

5. A real-time data aggregation device, characterized in that: include: An extension module that deploys a predetermined number of RegionServers based on HBase via HDFS; A parallel aggregation module that enables each RegionServer to aggregate data in parallel according to predetermined fields; as well as The sending module sends the aggregated data of each RegionServer to the client for secondary aggregation of the data; The parallel aggregation module enables each RegionServer to perform data aggregation in parallel according to a predetermined field, specifically including the following steps in the parallel aggregation module: The HBase server receives the SQL query statement sent by the client; the predetermined number of RegionServers of the HBase server parse the received SQL query statement according to the predetermined fields to convert the SQL query statement into an API; And insert or read the data in the pre-stored data table through the API, and summarize the data in the data table after the processing operation in each RegionServer; The coprocessor of the RegionServer is pre-embedded with a coprocessor program, which converts the corresponding field data into a character stream according to the table data type in the pre-maintained metadata and stores it in the HBase table; The coprocessor program also records the data type of the field and the primary key formation rule of the HBase table into the metadata; The parallel aggregation module inserts or reads data from a pre-stored data table in HDFS through an API and returns the data to the coprocessor; The parallel summary module performs the corresponding data type and primary key conversion and returns the data to the client during the insertion or reading process, so that the client performs secondary summary on the returned data according to the key value in the returned data.

6. The device according to claim 5, characterized in that The coprocessor program obtains all detailed data that meets the predetermined conditions through the RegionServer and summarizes them once through large-scale parallel processing, and the result set of the summary is returned to the client.

7. A data interval aggregation device, characterized in that: include: modules for pre-defined scheduling expressions, and The calling module, when a preset scheduling expression is satisfied, cyclically calls the real-time data aggregation device as described in any one of claims 5-6 through a calling interface to obtain the interval stage result of the data.

8. An electronic device for real-time data aggregation, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-2.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • Distributed NewSQL database system

    CN107451220A