WO2016188291A1 - 一种数据处理方法和设备 - Google Patents
一种数据处理方法和设备 Download PDFInfo
- Publication number
- WO2016188291A1 WO2016188291A1 PCT/CN2016/080308 CN2016080308W WO2016188291A1 WO 2016188291 A1 WO2016188291 A1 WO 2016188291A1 CN 2016080308 W CN2016080308 W CN 2016080308W WO 2016188291 A1 WO2016188291 A1 WO 2016188291A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- time point
- channel processing
- time
- processed
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2308—Concurrency control
- G06F16/2315—Optimistic concurrency control
- G06F16/2322—Optimistic concurrency control using timestamps
Definitions
- the embodiments of the present invention relate to the field of communications technologies, and in particular, to a data processing method and device.
- the data location can be based on the data points after the service is restarted, so that the service can be started from the saved synchronization progress without having to restart all.
- the dispatcher module allocates the data and distributes it to different channel devices for transmission, and when the channel device transmits data, the dispatcher The module will block the reception of data, and the different channel devices are serially connected for data transmission. This causes all channel devices to complete the data transmission, and the dispatcher module will complete the last data point persistence. Processing, and continue to receive data, causing the data stream to have a periodic spike state, traffic fluctuations are relatively large, and the channel device is inefficient.
- the data is blocked when the data is transmitted, and the data is transmitted in the channel device in a serial manner, which causes the data stream to have a periodic peak group state, and the channel device is inefficient.
- the application proposes a data processing method and apparatus to improve efficiency and avoid periodic spikes in the data stream.
- the present application provides a data processing method, which is applied to a system including a data persistence device and a plurality of channel processing devices, wherein the plurality of channel processing devices are independent of each other, including:
- the channel processing device receives the data to be processed forwarded by the data persistence device, where each data Both are set with time points;
- the channel processing device processes the data and records a time point of the processed data
- the channel processing device When the preset reporting condition is reached, the channel processing device periodically reports the time point of the processed data to the data persistence device.
- the channel processing device reports the time point of the processed data to the data persistence device, and specifically includes:
- the channel processing device acquires a time point of data processed within a predetermined length of time before the current time;
- the channel processing device reports the earliest time point to the data persistence device.
- the channel processing device statistically processes the data
- the channel processing device acquires a time point of the data processed within a predetermined length of time before the current time;
- the channel processing device reports the earliest time point to the data persistence device.
- the present application also provides a data processing method for use in a system including a data persistence device and a plurality of channel processing devices, the method comprising:
- the data persistence device receives the data to be processed, and sends the data to the channel processing device, wherein each piece of data is set with a time point;
- the data persistence device determines the earliest time point in the returned time point and persists the earliest time point to the database.
- the data persistence device receives the data to be processed, and sends the data to the channel processing device, specifically:
- the data persistence device receives the data to be processed, and performs hash calculation on the data to determine a channel processing device corresponding to each piece of data;
- the data persistence device assigns the data to a corresponding channel processing device based on the results of the hash calculation.
- the data persistence device determines the earliest time point in the returned time point bit, and persists the earliest time point bit to the database, specifically:
- the data persistence device determines a time corresponding to the received time point
- the data persistence device acquires the earliest time in the time, and determines a time point corresponding to the earliest time;
- the data persistence device stores the time point corresponding to the earliest time in a database.
- the application also proposes a channel processing device, including:
- a receiving module configured to receive data to be processed forwarded by the data persistence device, where each piece of data is set with a time point;
- a processing module configured to process the data, and record a time point of processing the completed data
- the reporting module is configured to report the time point of the processed data to the data persistence device when the preset reporting condition is reached.
- reporting module is specifically configured to:
- the application also proposes a data persistence device, including:
- a forwarding module configured to receive data to be processed, and send the data to a channel processing device, where each piece of data is set with a time point;
- a receiving module configured to receive a time point returned by the channel processing device
- a persistence module that determines the earliest time point in the returned time point and persists the earliest time point to the database.
- the forwarding module is specifically configured to:
- the data is distributed to the corresponding channel processing device based on the results of the hash calculation.
- the persistence module is specifically configured to:
- the time point corresponding to the earliest time is stored in the database.
- the data processing is processed in parallel by setting channel processing devices in the present application, thereby ensuring the efficiency of data processing, and additionally setting the time point of the channel processing device to independently report the data processed by itself, so that the channel processing device When data processing is performed, the time point bit can also be reported in parallel, so that when the time point is reported, the data processing can be ensured. Break and avoid periodic spikes in the data stream.
- FIG. 1 is a schematic flowchart of a data processing method according to an embodiment of the present application.
- FIG. 2 is a schematic flowchart of a data processing method according to an embodiment of the present application.
- FIG. 3 is a schematic diagram of data processing in a specific scenario according to an embodiment of the present application.
- FIG. 4 is a schematic structural diagram of a channel processing device according to an embodiment of the present application.
- FIG. 5 is a schematic structural diagram of a data persistence device according to an embodiment of the present application.
- a data processing method is proposed in the present application, which is applied to a system including a data persistence device and a plurality of channel processing devices. As shown in FIG. 1, the method includes the following steps:
- Step 101 The channel processing device receives the data to be processed forwarded by the data persistence device, where each piece of data is set with a time point.
- time point can be the time when the data is recorded in the database, and each data is There is only one time, that is, the time point is unique.
- the time point set for data 1 is 2013.03.21.06.23 (that is, 6:23 on March 21, 2013).
- the time point may be other forms, and is not limited to the above one, as long as the data can be uniquely identified and the order of the data can be identified.
- the time points can be stored in the attribute field of each piece of data for delivery along with the data.
- Step 102 The channel processing device processes the data, and records the time point of the processed data.
- the channel processing device After receiving the data, the channel processing device processes the received data, for example, receives the data 1, processes the data 1, and when the data 1 is processed, records the time point of the data 1, and at the same time, Continue to receive other data, such as data 2, and process data 2, and record the time point of the processed data 2, as for data 3 and other data, and the same is not repeated here.
- Step 103 When the preset reporting condition is reached, the channel processing device reports the time point of the processed data to the data persistence device.
- the process of reporting the time point includes:
- the channel processing device sets a timer; when the timer expires, the channel processing device acquires a time point of the data processed within a predetermined length of time before the current time; the channel processing device determines the time point of the time in the acquired time point Bit; the channel processing device reports the earliest time point to the data persistence device; or
- the channel processing device statistically processes the data; when the data amount of the processed data exceeds the threshold, the channel processing device acquires the time point of the data processed within a predetermined length of time before the current time; the channel processing device determines the acquired time point The earliest time point of the medium time; the channel processing device reports the earliest time point to the data persistence device.
- reporting conditions can be set based on the need, for example, when the time for processing a certain data crosses a preset time, and the report can be performed for each channel processing device.
- the preset reporting conditions are set independently, so that when the reporting condition is met, the reporting process is performed, and each channel processing device is independent of each other, and the reporting process is also independent, and is not subject to other channel processing devices. Impact.
- each channel processing device reports the time of the earliest time in the data processed by itself, for example, there are channel processing devices 1, 2, and 3, for each channel processing device, and channel processing device 1
- the channel device 1 determines the predetermined length of time before the current time, for example, the data processed within a length of 10 minutes, for example, at a time of 23 o'clock on August 1, 2014. 20 to 30 minutes
- the processed data which assumes that data 3 was processed at 2:20 on August 1, 2014. Since the time point of data 3 is 2014.08.01.23.20, the time is the earliest during this time, so this time
- the point is reported to the data persistence device, thereby reducing the amount of data received by the data persistence device and facilitating subsequent data persistence processing.
- the embodiment of the present application further discloses a data processing method, which is applied to a system including a data persistence device and a plurality of channel processing devices. As shown in FIG. 2, the method includes:
- Step 201 The data persistence device receives the data to be processed, and sends the data to the channel processing device, where each piece of data is set with a time point.
- the specific data persistence device receives the data to be processed, and sends the data to the channel processing device, which specifically includes:
- the data persistence device receives the data to be processed, and performs hash calculation on the data to determine a channel processing device corresponding to each piece of data; the data persistence device distributes the data to the corresponding channel processing device based on the result of the hash calculation.
- the data persistence device receives the data 1 to be processed, the data 1 is hashed, and it is determined that the received data 1 is processed by the channel processing device 1 by the hash.
- the data 1 can be It is sent to the channel processing device 1 for processing.
- Other data is similar.
- it is determined that the data 2 to be processed should be processed by the channel processing device 2, and then the data 2 is sent to the channel processing device 2, and no further description is made here.
- there are other ways to determine for example, based on the performance of the channel processing device, the load and the load required for the data to be processed, etc., and Not limited to hash calculations.
- Step 202 The data persistence device receives a time point returned by the channel processing device.
- the data persistence device sends the data to the channel number device, it receives the time point returned by the channel device, where the returned time point is Identifies the data that has been completed, or the earliest data that has been processed.
- Step 203 The data persistence device determines the earliest time point in the returned time point, and persists the earliest time point to the database.
- the data persistence device determines the earliest time point in the returned time point, and persists the earliest time point to the database, including:
- the data persistence device determines the time corresponding to the received time point; the data persistence device acquires the earliest time in the time, and determines the time point corresponding to the earliest time; the time corresponding to the earliest time of the data persistence device The point is stored in the database.
- the data persistence device may receive multiple time points, for example, the received time points have Time point 1 (corresponding to time 13:23 on February 8, 2013), time point 2 (corresponding to time 13:24 on February 8, 2013), time point 3 (corresponding time February 8, 2013) At 13:35, the time is 4 (corresponding to the time of February 8, 2013 at 13:25), the time is 5 (corresponding to the time of February 8, 2013 at 13:26), and four time points
- the time corresponding to the bit is sorted in order from morning to night, with time point 1 and time point 2, time point 4, time point 5, time point 3, and the earliest time point is time.
- the embodiment of the present application further discloses a data processing method in a specific scenario.
- the data persistence device includes a dispatcher device. And a plurality of table tables (table table 1 and table 2, respectively), and each table table corresponding to multiple channel processing devices, the method includes the following steps:
- Step 1 The dispatcher device receives the data to be processed, and distributes the received data to table table 1 and table table 2, wherein each data is set with a time point.
- Step 2 The table table hashes the data to determine the channel processing device of the data, and sends the data to the determined channel processing device.
- each table table allocates data to the corresponding channel processing device, wherein as shown in FIG. 3, the table1 table has four channel processing devices (named channel processing device 0, channel processing device 1, channel respectively).
- the processing device 2 and the channel processing device 3), and the table 2 table corresponds to two channel processing devices (named channel processing device 4 and channel processing device 5 respectively), for example, data 1 is assigned to the channel processing device 3, and data 2 is allocated.
- the channel processing device 2 is processed so that the channel processing device receives the data and processes it, and the processing between the respective channel processing devices does not interfere with each other.
- Step 3 After processing the data, the channel processing device reports the time point of the data to the corresponding table.
- the time point of each processed data may be reported to the corresponding table, or the time point with the earliest time may be reported to the correspondingABLE table, similar to the process of processing, and each channel is processed.
- the reporting process of the device is also mutually interfered and affected. It can be reported according to the rules set in advance for each channel processing device.
- the channel processing device 1 is used for description.
- the preset reporting rule of the channel processing device 1 can be set to be timed. Reporting, for example, every 10 minutes, of course, you can also set other rules, no longer here.
- Step 4 The table table determines the earliest time of the received time point, and reports the time point of the earliest time to the dispatcher device.
- Step 5 The dispatcher device determines the earliest time in the time point reported by the table, and stores the earliest time point in the database.
- the processing of the data and the reporting of the time point are asynchronously parallel, and when the time point is reported, the processing of the data can be ensured without interruption, and the data is blocked when the data is transmitted in the prior art.
- Receive, and the data is transmitted in the channel device is the serial side of the The method avoids the periodic peak state of the data flow existing in the prior art, and at the same time improves the efficiency of the channel processing device.
- the embodiment of the present application further discloses a channel processing device, as shown in FIG. 4, including:
- the receiving module 401 is configured to receive data to be processed forwarded by the data persistence device, where each piece of data is set with a time point;
- a processing module 402 configured to process the data, and record a time point of processing the completed data
- the reporting module 403 is configured to report the time point of the processed data to the data persistence device when the preset reporting condition is reached.
- reporting module 403 is specifically configured to:
- the embodiment of the present application further discloses a data persistence device, as shown in FIG. 5, including:
- the forwarding module 501 is configured to receive data to be processed, and send the data to the channel processing device, where each piece of data is set with a time point;
- the receiving module 502 is configured to receive a time point returned by the channel processing device
- a persistence module 503 configured to determine the earliest time point of the returned time point bit, and The earliest time point is persisted to the database.
- the forwarding module 501 is specifically configured to:
- the data is distributed to the corresponding channel processing device based on the results of the hash calculation.
- the persistence module 503 is specifically configured to:
- the time point corresponding to the earliest time is stored in the database.
- the data processing is processed in parallel by setting channel processing devices in the present application, thereby ensuring the efficiency of data processing, and additionally setting the time point of the channel processing device to independently report the data processed by itself, so that the channel processing device When data processing is performed, the time point bit can also be reported in parallel, so that when the time point is reported, the data processing can be ensured without interruption, and the periodic peak state of the data stream is avoided.
- the present application can be implemented by hardware, or by software plus a necessary general hardware platform.
- the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several The instructions are for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various implementation scenarios of the present application.
- modules in the apparatus in the implementation scenario may be distributed in the apparatus for implementing the scenario according to the implementation scenario description, or may be correspondingly changed to be different from the implementation.
- the modules of the above implementation scenarios may be combined into one module, or may be further split into multiple sub-modules.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Telephonic Communication Services (AREA)
- Computer And Data Communications (AREA)
Abstract
一种数据处理方法和设备,该方法应用于包括数据持久化设备和多个通道处理设备的系统中,多个通道处理设备之间相互独立,包括:通道处理设备接收数据持久化设备转发的待处理的数据,其中每条数据都设置有时间点位(101);通道处理设备处理数据,并记录处理完成的数据的时间点位(102);当达到预设上报条件时,通道处理设备向数据持久化设备上报所处理的数据的时间点位(103);通过设置通道处理设备之间并行处理数据,从而保证了数据处理的效率,另外设置通道处理设备独立上报自身处理完成的数据的时间点位,以便通道处理设备在进行数据处理时,还可以异步并行上报时间点位,以此在进行时间点位的上报时,可以保证数据的处理不被中断。
Description
本申请实施例涉及通信技术领域,特别涉及一种数据处理方法和设备。
由于数据流需要定期的持久化数据点位(即当前同步进度)便于服务重启后可以基于数据点位进行数据定位,从而使得服务可以从保存的同步进度来启动,而不会必须全部重新开始。
现有技术中的数据持久化处理的过程中,dispatcher(发报)模块在接收到数据后,会将数据进行分配,分配到不同的通道设备来进行传输,且当通道设备传输数据时,dispatcher模块将阻塞数据的接收,而不同的通道设备之间是串行的方式来进行数据传输的,这样导致必须所有的通道设备都完成数据传输,dispatcher模块才会完成上一次的数据点位持久化处理,并继续接收数据,使得数据流出现周期性尖峰状态,流量波动比较大,且导致通道设备的效率很低。
发明内容
针对现有技术中在传输数据时阻塞数据的接收,且数据在通道设备中传输是采用的串行的方式,导致数据流出现周期性尖峰组状态,且使得通道设备的效率低下的缺陷,本申请提出了一种数据处理方法和设备,用以提高效率,且避免数据流出现周期性尖峰状态。
本申请提出了一种数据处理方法,应用于包括数据持久化设备和多个通道处理设备的系统中,所述多个通道处理设备之间相互独立,包括:
通道处理设备接收数据持久化设备转发的待处理的数据,其中每条数据
都设置有时间点位;
所述通道处理设备处理所述数据,并记录处理完成的数据的时间点位;
当达到预设上报条件时,所述通道处理设备定时向所述数据持久化设备上报所处理的数据的时间点位。
可选的,当达到预设上报条件时,所述通道处理设备向所述数据持久化设备上报所处理的数据的时间点位,具体包括:
所述通道处理设备设置定时器;
当所述定时器超时时,所述通道处理设备获取在当前时间之前的预定时间长度内所处理的数据的时间点位;
所述通道处理设备确定获取的时间点位中时间最早的时间点位;
所述通道处理设备向所述数据持久化设备上报所述时间最早的时间点位;或
所述通道处理设备统计处理的数据;
当处理的数据的数据量超过阈值时,所述通道处理设备获取在当前时间之前的预定时间长度内所处理的数据的时间点位;
所述通道处理设备确定获取的时间点位中时间最早的时间点位;
所述通道处理设备向所述数据持久化设备上报所述时间最早的时间点位。
本申请还提出了一种数据处理方法,应用于包括数据持久化设备和多个通道处理设备的系统中,该方法包括:
数据持久化设备接收待处理的数据,并将所述数据发送给通道处理设备,其中,每条数据都设置有时间点位;
所述数据持久化设备接收所述通道处理设备返回的时间点位;
所述数据持久化设备确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中。
可选的,所述数据持久化设备接收待处理的数据,并将所述数据发送给通道处理设备,具体包括:
所述数据持久化设备接收待处理的数据,并对所述数据进行hash计算,以确定每条数据所对应的通道处理设备;
所述数据持久化设备基于hash计算的结果将所述数据分配到对应的通道处理设备。
可选的,所述数据持久化设备确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中,具体包括:
所述数据持久化设备确定接收到的时间点位所对应的时间;
所述数据持久化设备获取所述时间中最早的时间,并确定所述最早的时间所对应的时间点;
所述数据持久化设备将所述最早的时间所对应的时间点位存储到数据库中。
本申请还提出了一种通道处理设备,包括:
接收模块,用于接收数据持久化设备转发的待处理的数据,其中每条数据都设置有时间点位;
处理模块,用于处理所述数据,并记录处理完成的数据的时间点位;
上报模块,用于当达到预设上报条件时,向所述数据持久化设备上报所处理的数据的时间点位。
可选的,所述上报模块,具体用于:
设备设置定时器;
当所述定时器超时时,获取在当前时间之前的预定时间长度内所处理的数据的时间点位;
确定获取的时间点位中时间最早的时间点位;
向所述数据持久化设备上报所述时间最早的时间点位;或
统计处理的数据;
当处理的数据的数据量超过阈值时,获取在当前时间之前的预定时间长度内所处理的数据的时间点位;
确定获取的时间点位中时间最早的时间点位;
向所述数据持久化设备上报所述时间最早的时间点位。。
本申请还提出了一种数据持久化设备,包括:
转发模块,用于接收待处理的数据,并将所述数据发送给通道处理设备,其中,每条数据都设置有时间点位;
接收模块,用于接收所述通道处理设备返回的时间点位;
持久化模块,用于确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中。
可选的,所述转发模块,具体用于:
接收待处理的数据,并对所述数据进行hash计算,以确定每条数据所对应的通道处理设备;
基于hash计算的结果将所述数据分配到对应的通道处理设备。
可选的,所述持久化模块,具体用于:
确定接收到的时间点位所对应的时间;
获取所述时间中最早的时间,并确定所述最早的时间所对应的时间点;
将所述最早的时间所对应的时间点位存储到数据库中。
与现有技术相比,本申请中通过设置通道处理设备之间并行处理数据,从而保证了数据处理的效率,另外设置通道处理设备独立上报自身处理完成的数据的时间点位,以便通道处理设备在进行数据处理时,还可以异步并行上报时间点位,以此在进行时间点位的上报时,可以保证数据的处理不被中
断,且避免数据流出现周期性尖峰状态。
图1为本申请实施例提出的一种数据处理方法的流程示意图;
图2为本申请实施例提出的一种数据处理方法的流程示意图;
图3为本申请实施例提出的一种具体场景下的数据处理的示意图;
图4为本申请实施例提出的一种通道处理设备的结构示意图;
图5为本申请实施例提出的一种数据持久化设备的结构示意图。
如背景技术,针对现有技术中的缺陷,本申请中提出了一种数据处理方法,应用于包括数据持久化设备和多个通道处理设备的系统中,如图1所示,包括以下步骤:
步骤101、通道处理设备接收数据持久化设备转发的待处理的数据,其中每条数据都设置有时间点位。
由于是需要对处理完成的数据进行持久化处理的,因此首先就为每条数据设置时间点位,用于标识该数据,其中时间点位可以是数据记录在数据库中的时间,每个数据都有唯一的一个时间,也即时间点位是唯一的。例如为数据1设置的时间点位为2013.03.21.06.23(即表示2013年3月21日6点23分),当然也可以根据需要进行继续精确,例如精确到秒,甚至毫秒,微秒等除此以外,时间点位还可以是其他的形式,并不限于上述一种,只要能唯一标识数据,且能标识数据的顺序即可。而时间点位可以存储在每条数据的属性字段中,以便随着数据的传递而一并传递。
步骤102、通道处理设备处理数据,并记录处理完成的数据的时间点位。
通道处理设备接收到数据之后,就处理接收的数据,例如接收到数据1,处理该数据1,当处理完数据1时,记录该数据1的时间点位,与此同时,继
续接收其他的数据,例如数据2,和处理数据2,以及记录处理完成的数据2的时间点位,至于数据3等等其他数据,与此相同,在此不再进行赘叙。
步骤103、当达到预设上报条件时,通道处理设备向数据持久化设备上报所处理的数据的时间点位。
具体的,上报时间点位的过程,具体包括:
通道处理设备设置定时器;当定时器超时时,通道处理设备获取在当前时间之前的预定时间长度内所处理的数据的时间点位;通道处理设备确定获取的时间点位中时间最早的时间点位;通道处理设备向数据持久化设备上报时间最早的时间点位;或
通道处理设备统计处理的数据;当处理的数据的数据量超过阈值时,通道处理设备获取在当前时间之前的预定时间长度内所处理的数据的时间点位;通道处理设备确定获取的时间点位中时间最早的时间点位;通道处理设备向数据持久化设备上报时间最早的时间点位。
除了基于时间,和数据量以外,还可以基于需要设置其他的上报条件,例如当处理某一数据的时间跨某一预设时间时,进行上报,具体的可以基于需要为每个通道处理设备进行独立设置预设的上报条件,以此当满足上报条件时,就执行上报过程,而每个通道处理设备都是相互独立的,上报的过程也都是独立的,并不会受到其他通道处理设备的影响。
具体的,由于进行数据持久化处理时,是将处理的数据中的时间最早的时间点位持久化到数据库中,也即将时间最早的间点位存储在数据库中,因此可以在上报时就进行筛选,每个通道处理设备在进行上报时,将自身处理的数据中时间最早的时间点位进行上报,例如有通道处理设备1、2、3,针对每一个通道处理设备,以通道处理设备1为例,通道设备1每隔一段时间,例如10分钟,确定在当前时间之前的预定时间长度,例如10分钟长度内所处理的数据,具体的例如获取在时间为2014年8月1日23时20分到30分
所处理的数据,其中假设2014年8月1日23时20分处理了数据3,由于数据3的时间点位是2014.08.01.23.20,时间上是这段时间内最早的,因此将该时间点位上报给数据持久化设备,从而减少数据持久化设备接收的数据量,也便于后续进行数据持久化处理。
本申请实施例还公开了一种数据处理方法,应用于包括数据持久化设备和多个通道处理设备的系统中,如图2所示,该方法包括:
步骤201、数据持久化设备接收待处理的数据,并将数据发送给通道处理设备,其中,每条数据都设置有时间点位。
具体的数据持久化设备接收待处理的数据,并将数据发送给通道处理设备,具体包括:
数据持久化设备接收待处理的数据,并对数据进行hash计算,以确定每条数据所对应的通道处理设备;数据持久化设备基于hash计算的结果将数据分配到对应的通道处理设备。
具体的,例如数据持久化设备接收到待处理的数据1后,对数据1进行hash计算,确定收到的数据1被hash应该被通道处理设备1处理,在此情况下,就可以将数据1发送给通道处理设备1进行处理,其他的数据与此类似,例如确定待处理的数据2应该是由通道处理设备2处理,则将数据2发送给通道处理设备2,在此不再进行赘叙,当然除了进行hash计算,以确定数据处理的通道处理设备以外,还可以有别的方式来确定,例如基于通道处理设备的性能,负载以及待处理的数据所需要的负载等等来考虑,并不限于hash计算。
步骤202、数据持久化设备接收通道处理设备返回的时间点位。
与前述实施例的步骤103对应的,数据持久化设备在发送了数据给通道数量设备之后,会接收到通道设备返回的时间点位,其中返回的时间点位是
标识已经出来完成的数据,或者已经处理完成的时间最早的数据。
步骤203、数据持久化设备确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中。
具体的,数据持久化设备确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中,具体包括:
数据持久化设备确定接收到的时间点位所对应的时间;数据持久化设备获取时间中最早的时间,并确定最早的时间所对应的时间点;数据持久化设备将最早的时间所对应的时间点位存储到数据库中。
具体的,由于通道处理设备有多个,且每个通道处理设备还可能发送多个时间点位,因此数据持久化设备接收到的时间点位会有多个,例如接收到的时间点位有时间点位1(对应时间2013年2月8日13时23分),时间点位2(对应时间2013年2月8日13时24分),时间点位3(对应时间2013年2月8日13时35分),时间点位4(对应时间2013年2月8日13时25分),时间点位5(对应时间2013年2月8日13时26分),而四个时间点位所对应的时间按照从早到晚的次序进行排序,依次时间点位1,时间点位2,时间点位4,时间点位5,时间点位3,可见时间最早的时间点位为时间点位1,因此此次将数据点位1存储在数据库中,同时也准备着接收下次的时间点位,并对下次的时间点位进行与此类似的持续化处理,以此当服务中断后,可以从数据库中提取最新持久化的时间点位,并基于该时间点位找到对应的数据继续服务,而不会需要重新开始。
为了对本申请进行进一步的说明,本申请实施例还公开了一种具体场景下的数据处理方法,在该具体的应用场景中,如图3所示,数据持久化设备包括dispatcher(发报)设备和多个table表(分别为table表1和table表2),而每个table表会对应有多个通道处理设备,该方法包括以下步骤:
步骤1、dispatcher设备接收需要处理的数据,并将接收到的数据分给table表1和table表2,其中每个数据都设置有时间点位。
步骤2、table表对数据进行hash,以确定数据的通道处理设备,并将数据发送给确定的通道处理设备。
具体的,也就是每个table表将数据分配给对应的通道处理设备,其中如图3所示,table1表对应有4个通道处理设备(分别命名为通道处理设备0、通道处理设备1、通道处理设备2、通道处理设备3),而table2表对应有2个通道处理设备(分别命名为通道处理设备4、通道处理设备5),例如将数据1分配给通道处理设备3,将数据2分配给通道处理设备2,以便通道处理设备接收到数据后进行处理,各个通道处理设备之间的处理是互不干扰的。
步骤3、通道处理设备处理完数据后,将数据的时间点位上报给对应的table表。
可选的,可以将每个处理完的数据的时间点位上报给对应的table表,也可以选择其中时间最早的一个时间点位上报给对应的able表,与处理的过程类似,各个通道处理设备的上报过程也是各自互干扰和影响的,可以按照预先为每个通道处理设备设置的规则进行上报,其中以通道处理设备1来进行说明,可以设置通道处理设备1的预设上报规则为定时上报,例如每隔10分钟上报一次,当然也可以也设置别的规则,在此不再进行赘叙。
步骤4、table表确定接收到的时间点位中时间最早的,并将时间最早的时间点位上报给dispatcher设备。
步骤5、dispatcher设备确定table表上报的时间点位中时间最早的,并将时间最早的时间点位存储在数据库中。
以此通过上述方案,使得数据的处理和时间点位的上报异步并行,在进行时间点位的上报时,可以保证数据的处理不被中断,相比较于现有技术中在传输数据时阻塞数据的接收,且数据在通道设备中传输是采用的串行的方
式,避免了现有技术中会存在的数据流出现周期性尖峰状态,且同时提高了通道处理设备的效率。
本申请实施例还公开了一种通道处理设备,如图4所示,包括:
接收模块401,用于接收数据持久化设备转发的待处理的数据,其中每条数据都设置有时间点位;
处理模块402,用于处理所述数据,并记录处理完成的数据的时间点位;
上报模块403,用于当达到预设上报条件时,向所述数据持久化设备上报所处理的数据的时间点位。
具体的,所述上报模块403,具体用于:
设备设置定时器;
当所述定时器超时时,获取在当前时间之前的预定时间长度内所处理的数据的时间点位;
确定获取的时间点位中时间最早的时间点位;
向所述数据持久化设备上报所述时间最早的时间点位;或
统计处理的数据;
当处理的数据的数据量超过阈值时,获取在当前时间之前的预定时间长度内所处理的数据的时间点位;
确定获取的时间点位中时间最早的时间点位;
向所述数据持久化设备上报所述时间最早的时间点位。
本申请实施例还公开了一种数据持久化设备,如图5所示,包括:
转发模块501,用于接收待处理的数据,并将所述数据发送给通道处理设备,其中,每条数据都设置有时间点位;
接收模块502,用于接收所述通道处理设备返回的时间点位;
持久化模块503,用于确定返回的时间点位中时间最早的时间点位,并将
时间最早的时间点位持久化到数据库中。
具体的,所述转发模块501,具体用于:
接收待处理的数据,并对所述数据进行hash计算,以确定每条数据所对应的通道处理设备;
基于hash计算的结果将所述数据分配到对应的通道处理设备。
所述持久化模块503,具体用于:
确定接收到的时间点位所对应的时间;
获取所述时间中最早的时间,并确定所述最早的时间所对应的时间点;
将所述最早的时间所对应的时间点位存储到数据库中.
与现有技术相比,本申请中通过设置通道处理设备之间并行处理数据,从而保证了数据处理的效率,另外设置通道处理设备独立上报自身处理完成的数据的时间点位,以便通道处理设备在进行数据处理时,还可以异步并行上报时间点位,以此在进行时间点位的上报时,可以保证数据的处理不被中断,且避免数据流出现周期性尖峰状态。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本申请可以通过硬件实现,也可以借助软件加必要的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施场景所述的方法。
本领域技术人员可以理解附图只是一个优选实施场景的示意图,附图中的模块或流程并不一定是实施本申请所必须的。
本领域技术人员可以理解实施场景中的装置中的模块可以按照实施场景描述进行分布于实施场景的装置中,也可以进行相应变化位于不同于本实施
场景的一个或多个装置中。上述实施场景的模块可以合并为一个模块,也可以进一步拆分成多个子模块。
上述本申请序号仅仅为了描述,不代表实施场景的优劣。
以上公开的仅为本申请的几个具体实施场景,但是,本申请并非局限于此,任何本领域的技术人员能思之的变化都应落入本申请的保护范围。
Claims (10)
- 一种数据处理方法,其特征在于,应用于包括数据持久化设备和多个通道处理设备的系统中,所述多个通道处理设备之间相互独立,该方法包括:通道处理设备接收数据持久化设备转发的待处理的数据,其中每条数据都设置有时间点位;所述通道处理设备处理所述数据,并记录处理完成的数据的时间点位;当达到预设上报条件时,所述通道处理设备向所述数据持久化设备上报所处理的数据的时间点位。
- 如权利要求1所述的方法,其特征在于,所述当达到预设上报条件时,所述通道处理设备向所述数据持久化设备上报所处理的数据的时间点位,具体包括:所述通道处理设备设置定时器;当所述定时器超时时,所述通道处理设备获取在当前时间之前的预定时间长度内所处理的数据的时间点位;所述通道处理设备确定获取的时间点位中时间最早的时间点位;所述通道处理设备向所述数据持久化设备上报所述时间最早的时间点位;或所述通道处理设备统计处理的数据;当处理的数据的数据量超过阈值时,所述通道处理设备获取在当前时间之前的预定时间长度内所处理的数据的时间点位;所述通道处理设备确定获取的时间点位中时间最早的时间点位;所述通道处理设备向所述数据持久化设备上报所述时间最早的时间点位。
- 一种数据处理方法,其特征在于,应用于包括数据持久化设备和多个通道处理设备的系统中,该方法包括:数据持久化设备接收待处理的数据,并将所述数据发送给通道处理设备,其中,每条数据都设置有时间点位;所述数据持久化设备接收所述通道处理设备返回的时间点位;所述数据持久化设备确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中。
- 如权利要求1所述的方法,其特征在于,所述数据持久化设备接收待处理的数据,并将所述数据发送给通道处理设备,具体包括:所述数据持久化设备接收待处理的数据,并对所述数据进行hash计算,以确定每条数据所对应的通道处理设备;所述数据持久化设备基于hash计算的结果将所述数据分配到对应的通道处理设备。
- 如权利要求1所述的方法,其特征在于,所述数据持久化设备确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中,具体包括:所述数据持久化设备确定接收到的时间点位所对应的时间;所述数据持久化设备获取所述时间中最早的时间,并确定所述最早的时间所对应的时间点;所述数据持久化设备将所述最早的时间所对应的时间点位存储到数据库中。
- 一种通道处理设备,其特征在于,包括:接收模块,用于接收数据持久化设备转发的待处理的数据,其中每条数据都设置有时间点位;处理模块,用于处理所述数据,并记录处理完成的数据的时间点位;上报模块,用于当达到预设上报条件时,向所述数据持久化设备上报所 处理的数据的时间点位。
- 如权利要求6所述的设备,其特征在于,所述上报模块,具体用于:设备设置定时器;当所述定时器超时时,获取在当前时间之前的预定时间长度内所处理的数据的时间点位;确定获取的时间点位中时间最早的时间点位;向所述数据持久化设备上报所述时间最早的时间点位;或统计处理的数据;当处理的数据的数据量超过阈值时,获取在当前时间之前的预定时间长度内所处理的数据的时间点位;确定获取的时间点位中时间最早的时间点位;向所述数据持久化设备上报所述时间最早的时间点位。
- 一种数据持久化设备,其特征在于,包括:转发模块,用于接收待处理的数据,并将所述数据发送给通道处理设备,其中,每条数据都设置有时间点位;接收模块,用于接收所述通道处理设备返回的时间点位;持久化模块,用于确定返回的时间点位中时间最早的时间点位,并将时间最早的时间点位持久化到数据库中。
- 如权利要求8所述的设备,其特征在于,所述转发模块,具体用于:接收待处理的数据,并对所述数据进行hash计算,以确定每条数据所对应的通道处理设备;基于hash计算的结果将所述数据分配到对应的通道处理设备。
- 如权利要求8所述的设备,其特征在于,所述持久化模块,具体用于:确定接收到的时间点位所对应的时间;获取所述时间中最早的时间,并确定所述最早的时间所对应的时间点;将所述最早的时间所对应的时间点位存储到数据库中。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510280415.3 | 2015-05-27 | ||
| CN201510280415.3A CN106294444B (zh) | 2015-05-27 | 2015-05-27 | 一种数据处理方法和设备 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2016188291A1 true WO2016188291A1 (zh) | 2016-12-01 |
Family
ID=57392583
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2016/080308 Ceased WO2016188291A1 (zh) | 2015-05-27 | 2016-04-27 | 一种数据处理方法和设备 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN106294444B (zh) |
| WO (1) | WO2016188291A1 (zh) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111596645B (zh) * | 2020-05-19 | 2022-01-21 | 北京微科能创科技有限公司 | 数据处理方法、装置和计算机可读存储介质 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130086303A1 (en) * | 2011-09-30 | 2013-04-04 | Fusion-Io, Inc. | Apparatus, system, and method for a persistent object store |
| CN104219288A (zh) * | 2014-08-14 | 2014-12-17 | 中国南方电网有限责任公司超高压输电公司 | 基于多线程的分布式数据同步方法及其系统 |
| CN104506373A (zh) * | 2015-01-07 | 2015-04-08 | 国家计算机网络与信息安全管理中心 | 网络信息采集与处理的装置和方法 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101635680B (zh) * | 2009-08-07 | 2011-08-31 | 中国电信股份有限公司 | 一种业务路由方法和系统 |
| CN103873507A (zh) * | 2012-12-12 | 2014-06-18 | 鸿富锦精密工业(深圳)有限公司 | 数据分块上传与存储系统及方法 |
| CN104317958B (zh) * | 2014-11-12 | 2018-01-16 | 北京国双科技有限公司 | 一种实时数据处理方法及系统 |
-
2015
- 2015-05-27 CN CN201510280415.3A patent/CN106294444B/zh active Active
-
2016
- 2016-04-27 WO PCT/CN2016/080308 patent/WO2016188291A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130086303A1 (en) * | 2011-09-30 | 2013-04-04 | Fusion-Io, Inc. | Apparatus, system, and method for a persistent object store |
| CN104219288A (zh) * | 2014-08-14 | 2014-12-17 | 中国南方电网有限责任公司超高压输电公司 | 基于多线程的分布式数据同步方法及其系统 |
| CN104506373A (zh) * | 2015-01-07 | 2015-04-08 | 国家计算机网络与信息安全管理中心 | 网络信息采集与处理的装置和方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106294444A (zh) | 2017-01-04 |
| CN106294444B (zh) | 2020-02-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107332876B (zh) | 区块链状态的同步方法及装置 | |
| US10298436B2 (en) | Arbitration processing method after cluster brain split, quorum storage apparatus, and system | |
| US9984013B2 (en) | Method, controller, and system for service flow control in object-based storage system | |
| CN103607302B (zh) | 故障信息上报方法、监控设备及管理设备 | |
| CN110083651B (zh) | 一种数据加载的方法和装置 | |
| CN105718484A (zh) | 写文件、读文件、删除文件、查询文件的方法及客户端 | |
| CN106936620B (zh) | 一种告警事件的处理方法和处理装置 | |
| CN107231400B (zh) | 一种数据的同步方法和装置 | |
| CN105933369A (zh) | 一种消息转发方法及设备 | |
| WO2017219740A1 (zh) | 基于时间轮盘和页面心跳的活跃用户集维护方法及系统 | |
| CN104572344B (zh) | 一种多云间数据备份的方法和系统 | |
| RU2016138537A (ru) | Способ передачи информации, базовая станция и абонентское оборудование | |
| WO2017162073A1 (zh) | 一种数据去重的方法和设备 | |
| US20160105544A1 (en) | Voice Service Evaluation Processing Method and Apparatus | |
| CN107846476B (zh) | 一种信息同步方法、设备及存储介质 | |
| CN111522876A (zh) | 区块链共识方法、装置和计算机设备、及区块链节点 | |
| WO2016188291A1 (zh) | 一种数据处理方法和设备 | |
| US10992760B2 (en) | Information processing system, session management method, and non-transitory computer-readable storage medium | |
| CN117354312A (zh) | 访问请求处理方法、装置、系统、计算机设备和存储介质 | |
| CN113760519A (zh) | 分布式事务处理方法、装置、系统和电子设备 | |
| TW201735584A (zh) | 訊息的發送方法和終端設備 | |
| CN107547420B (zh) | 一种流表控制方法和装置 | |
| CN103117883B (zh) | 一种分组设备运行状态同步方法 | |
| CN104348906B (zh) | 一种分布式系统中数据协商方法及装置 | |
| CN111506655A (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: 16799180 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: 16799180 Country of ref document: EP Kind code of ref document: A1 |