WO2020186791A1 - 数据传输方法、装置、设备及存储介质 - Google Patents

数据传输方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2020186791A1
WO2020186791A1 PCT/CN2019/118537 CN2019118537W WO2020186791A1 WO 2020186791 A1 WO2020186791 A1 WO 2020186791A1 CN 2019118537 W CN2019118537 W CN 2019118537W WO 2020186791 A1 WO2020186791 A1 WO 2020186791A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target
storage layer
preset
processed
Prior art date
Application number
PCT/CN2019/118537
Other languages
English (en)
French (fr)
Inventor
袁宝驹
杨洋
沙成阳
朱红晓
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020186791A1 publication Critical patent/WO2020186791A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application relates to the field of cloud processing, and in particular to a data transmission method, device, equipment, and storage medium.
  • the main purpose of this application is to provide a data transmission method, device, equipment, and storage medium, aiming to solve the technical problems of low resource utilization, poor reliability, and complicated implementation steps in disk read and write in the prior art.
  • this application provides a data transmission method, which includes the following steps:
  • the corresponding target data is transmitted through the input and output interface of the target storage layer.
  • the data transmission method proposed in this application sets a target storage layer on the consumer side according to the key-value storage database LevelDB; after receiving the to-be-processed data sent by the producer, the to-be-processed data is cached to the target storage layer When a data consumption instruction is received, the corresponding target data is transmitted through the input and output interface of the target storage layer, which can effectively improve resource utilization, increase the speed of data writing and reading, ensure data integrity, and effectively avoid The data is lost.
  • FIG. 1 is a schematic diagram of the structure of a data transmission device in a hardware operating environment involved in a solution of an embodiment of the application;
  • FIG. 3 is a schematic flowchart of a second embodiment of a data transmission method according to this application.
  • FIG. 4 is a schematic flowchart of a third embodiment of a data transmission method according to this application.
  • Fig. 5 is a functional block diagram of the first embodiment of the data transmission device of this application.
  • this application sets the target storage layer on the consumer side according to the key-value storage database LevelDB; after receiving the to-be-processed data sent by the producer, the to-be-processed data is cached in all The target storage layer; when a data consumption instruction is received, the corresponding target data is transmitted through the input and output interface of the target storage layer, which can effectively improve resource utilization, increase the speed of data writing and reading, and ensure data integrity
  • This method effectively avoids data loss, and solves the technical problems of low resource utilization, poor reliability and complicated implementation steps in disk read and write in the prior art.
  • FIG. 1 is a schematic structural diagram of a data transmission device in a hardware operating environment involved in a solution of an embodiment of the application.
  • the data transmission device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface).
  • the memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable memory (Non-volatile Memory, NVM), such as a disk memory.
  • the memory 1005 may also be a storage device independent of the foregoing processor 1001.
  • FIG. 1 does not constitute a limitation on the data transmission device, and may include more or less components than shown in the figure, or a combination of certain components, or different components. Component arrangement.
  • the storage medium of the present application may be a non-volatile computer-readable storage medium.
  • the memory 1005 may include an operating device, a network communication module, a user-side interface module, and computer-readable instructions.
  • the data transmission device executes the steps corresponding to the data transmission method provided in the embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a first embodiment of a data transmission method according to this application.
  • the data transmission method includes the following steps:
  • Step S10 Set a target storage layer on the consumer side according to the key-value storage database LevelDB.
  • LevelDB is a C++ program library that can handle the persistent storage of key-value data with a scale of billions.
  • LevelDB stores data, it is stored in an orderly manner according to the recorded key values. , That is, adjacent key values are stored sequentially in the storage file, and the application can customize the key size comparison function, LevelDB can store the key value records in order according to the user-defined comparison function; through LevelDB, it can be on the consumer side Set the target storage layer to store the data to be processed.
  • the step S10 specifically includes the following steps:
  • the serialization function API is encapsulated on the basis of, and the virtual storage layer is set according to the serialization function API.
  • serialization function application programming interface Application Programming Interface
  • API Application Programming Interface
  • the serialization function API is a preset function with sequence function. Generally, it can store the database LevelDB according to the key value Set the target storage layer in the local disk on the consumer side, in LevelDB
  • the serialization function API is encapsulated on the basis of the local disk.
  • the local disk is used as a medium to buffer the target data of the subsequent disk input and output interfaces.
  • the purpose of encapsulation is not to modify the code of LevelDB and to facilitate access to the storage layer Calling the data can effectively improve resource utilization, speed up data writing and reading, and ensure data integrity.
  • serialization function API is encapsulated on the basis of, and setting the virtual storage layer according to the serialization function API specifically includes the following steps:
  • a preset number of target memory spaces with established operating interfaces are used as the target storage layer.
  • LevelDB A preset number of target memory spaces are allocated in the memory of the.
  • the preset number is the number corresponding to the preset memory space, which can be a preset number of target memory spaces allocated in the memory MemTable in levelDB.
  • the number of settings can be determined according to the number of historical processes;
  • the preset sorting function is a preset sorting function
  • the preset packaging format is a preset packaging format
  • the serialization function API is combined with the target memory space according to the preset sorting function and preset packaging format.
  • the serialization function API is organically combined with the operation code of the target memory space. Through the combination of the operation code, an operation interface corresponding to the target memory space can be established.
  • the serialization function API may include but not Limited to inserting the PUT interface, obtaining the GET interface, setting the SET interface, deleting the DELETE interface, associating the virtual storage layer with the local disk on the consumer side, and using the associated virtual storage layer as the target storage layer on the consumer side .
  • Step S20 After receiving the to-be-processed data sent by the producer, buffer the to-be-processed data to the target storage layer.
  • the to-be-processed data is cached in the target storage layer, and both the producer and consumer can be a bunch of threads, After the to-be-processed data is cached in the target storage layer, data can be transmitted when subsequent consumption instructions arrive.
  • the target storage layer can use a local disk as a medium and serve as a reservoir for reading and writing the message queue network.
  • Step S30 When the data consumption instruction is received, the corresponding target data is transmitted through the input/output interface of the target storage layer.
  • the corresponding target data can be transmitted according to the input/output interface of the target storage layer, which can effectively improve resource utilization.
  • a target storage layer is set on the consumer side by using the key-value storage database LevelDB; after receiving the to-be-processed data sent by the producer, the to-be-processed data is cached to the target storage layer; When a data consumption instruction is received, the corresponding target data is transmitted through the input and output interface of the target storage layer, which can effectively improve resource utilization, increase the speed of data writing and reading, ensure data integrity, and effectively avoid data lost.
  • FIG. 3 is a schematic flowchart of the second embodiment of the data transmission method of this application.
  • the second embodiment of the data transmission method of this application is proposed based on the first embodiment.
  • the steps S20 specifically includes the following steps:
  • Step S21 After receiving the to-be-processed data sent by the producer, the to-be-processed data is cached to the target storage layer in a preset data format through LevelDB.
  • the preset data format is a preset data format. After receiving the to-be-processed data sent by the producer, the to-be-processed data can be cached to the target in the preset data format through LevelDB. Storage layer.
  • the data to be processed is cached in the target storage layer according to the preset data format through LevelDB, and at the same time, the revelation cache time and the current call status can be recorded; the data is buffered on the disk through LevelDB, so even downstream If the landing fails, the data will still be stored on the disk, because using LevelDB's own lsm strategy, the write throughput can reach nearly append write efficiency, rather than inefficient random write efficiency.
  • step S21 includes the following steps:
  • a thread pool is created in LevelDB, and the thread pool includes multiple threads;
  • the data units of the same data type are divided into a group, and the corresponding target threads are arranged for each group of data units according to a preset transmission strategy in a group unit.
  • the preset queue mode is a preset queue. According to the preset queue mode, the data to be processed sent by the producer is continuously received, and after receiving the data to be processed sent by the producer, A thread pool can be created in LevelDB, and the thread pool includes multiple threads, and then data is cached according to the data type of the data to be processed.
  • receiving the data to be processed is a continuous process, continuously receiving the data to be processed sent by the producer, before the data to be processed is cached in the target storage layer, it is necessary to The data to be processed is analyzed to obtain the data type of the data to be processed, a corresponding data index is established in the target storage layer according to the data type, and the data index is stored.
  • different data types correspond to different data indexes, and indexing by storing data can quickly locate required data in massive data.
  • a thread pool needs to be created in LevelDB.
  • the thread pool contains multiple threads to divide the data to be processed with the same data type into one.
  • Group the corresponding thread is arranged to transmit the same group of data to be processed according to the preset transmission strategy in the unit of group.
  • the corresponding thread can be arranged by assigning the data in each thread through the preset hash algorithm, and then the corresponding data to be processed
  • thread transmission may be synchronous thread transmission or asynchronous thread transmission, of course, it may also be other transmission methods, which is not limited in this embodiment.
  • a preset queue mode is established in the target storage layer, and the pending data sent by the producer is continuously received according to the preset queue mode; after receiving the pending data sent by the producer,
  • create a thread pool in LevelDB which includes multiple threads; analyze the data to be processed to obtain the data type corresponding to each data unit in the data to be processed;
  • the same data unit is divided into a group, and the corresponding target thread is arranged for each group of data units according to the preset transmission strategy in the unit of group; each group of data units is formatted according to the preset data format, and each group after the format is processed
  • the data unit is cached to the target storage layer with the corresponding target thread, which can effectively improve resource utilization, increase the speed of data writing and reading, ensure data integrity, and effectively avoid data loss.
  • FIG. 4 is a schematic flowchart of the third embodiment of the data transmission method of this application.
  • the third embodiment of the data transmission method of this application is proposed based on the second embodiment.
  • the steps S30 includes the following steps:
  • Step S31 When a data consumption instruction is received, a corresponding data index is found in the target storage layer according to the data consumption instruction as the target data index.
  • the data consumption instruction is a consumption instruction generated by the consumer end, which is used as the target data index by searching for a data index in the target storage layer.
  • Step S32 Find the corresponding target data according to the target data index, and transmit the target data through the input/output interface of the target storage layer.
  • the corresponding index is found in the target storage layer, the corresponding target data can be found according to the target index, and the target data can be transmitted through the input and output ports. It can effectively improve resource utilization and speed up data writing and reading.
  • the method further includes the following steps:
  • the cache corresponding to the target data is a timeout cache
  • the cache corresponding to the target data is deleted in the target storage layer.
  • the current invocation state is the current invocation state of the target data
  • the caching time of the target data can be analyzed according to the invocation state
  • the preset caching time is a preset caching time, according to As a result of comparing the cache time with the preset cache time, it can be determined whether the cache corresponding to the target data is an overtime cache, and the cache corresponding to the target data is deleted in the target storage layer.
  • the cache corresponding to the target data is deleted in the target storage layer, and it can be determined whether the target data transmission is completed by detecting the current call status of the target data
  • the cache time of different data to be processed can be determined by the start cache time and the current time. By comparing the cache time with the preset timeout cache time, it can be determined that the cached data has expired, that is, the cached data can be determined to have timed out The data is useless data. At this time, the cache corresponding to the useless data can be clear from the target storage layer, thereby avoiding data redundancy in the target storage layer and improving the utilization rate of the storage space of the target storage layer.
  • the corresponding data index is found in the target storage layer according to the data consumption instruction as the target data index; the corresponding data index is found according to the target data index Target data.
  • the target data is transmitted through the input/output interface of the target storage layer, which can effectively improve resource utilization, increase the speed of data writing and reading, ensure data integrity, and effectively avoid data loss.
  • this application further provides a data transmission device.
  • FIG. 5 is a functional module diagram of a first embodiment of a data transmission device according to the present application.
  • the data transmission device includes: a setting module 10, a cache module 20, and a transmission module 30;
  • the setting module 10 is used to set the target storage layer on the consumer side according to the key-value storage database LevelDB.
  • LevelDB is a C++ program library that can handle the persistent storage of key-value data with a scale of billions.
  • LevelDB stores data, it is stored in an orderly manner according to the recorded key values. , That is, adjacent key values are stored sequentially in the storage file, and the application can customize the key size comparison function, LevelDB can store the key value records in order according to the user-defined comparison function; through LevelDB, it can be on the consumer side Set the target storage layer to store the data to be processed.
  • the setting module 10 includes:
  • Encapsulation module used in the key-value storage database LevelDB
  • the serialization function API is encapsulated on the basis of, and the virtual storage layer is set according to the serialization function API.
  • serialization function application programming interface Application Programming Interface
  • API Application Programming Interface
  • the serialization function API is a preset function with sequence function. Generally, it can store the database LevelDB according to the key value Set the target storage layer in the local disk on the consumer side, in LevelDB
  • the serialization function API is encapsulated on the basis of the local disk.
  • the local disk is used as a medium to buffer the target data of the subsequent disk input and output interfaces.
  • the purpose of encapsulation is not to modify the code of LevelDB and to facilitate access to the storage layer Calling the data can effectively improve resource utilization, speed up data writing and reading, and ensure data integrity.
  • packaging module includes:
  • the space allocation module is used to allocate a preset amount of target memory space in the memory of the key-value storage database LevelDB.
  • the interface establishment module is used to combine the serialization function API with the operation code of the target memory space according to the preset sorting function and the preset packaging format to establish an operation interface corresponding to the target memory space.
  • the storage layer establishment module is used to set a preset number of target memory spaces with established operating interfaces as the target storage layer.
  • LevelDB A preset number of target memory spaces are allocated in the memory of the.
  • the preset number is the number corresponding to the preset memory space, which can be a preset number of target memory spaces allocated in the memory MemTable in levelDB.
  • the number of settings can be determined according to the number of historical processes;
  • the preset sorting function is a preset sorting function
  • the preset packaging format is a preset packaging format
  • the serialization function API is combined with the target memory space according to the preset sorting function and preset packaging format.
  • the serialization function API is organically combined with the operation code of the target memory space. Through the combination of the operation code, an operation interface corresponding to the target memory space can be established.
  • the serialization function API may include but not Limited to inserting the PUT interface, obtaining the GET interface, setting the SET interface, deleting the DELETE interface, associating the virtual storage layer with the local disk on the consumer side, and using the associated virtual storage layer as the target storage layer on the consumer side .
  • the cache module 20 is configured to cache the to-be-processed data to the target storage layer after receiving the to-be-processed data sent by the producer.
  • the to-be-processed data is cached in the target storage layer, and both the producer and consumer can be a bunch of threads, After the to-be-processed data is cached in the target storage layer, data can be transmitted when subsequent consumption instructions arrive.
  • the target storage layer can use a local disk as a medium and serve as a reservoir for reading and writing the message queue network.
  • the cache module 20 includes:
  • the format cache module is used to cache the to-be-processed data in a preset data format to the target storage layer through LevelDB after receiving the to-be-processed data sent by the producer.
  • the preset data format is a preset data format. After receiving the to-be-processed data sent by the producer, the to-be-processed data can be cached to the target in the preset data format through LevelDB. Storage layer.
  • the data to be processed is cached in the target storage layer according to the preset data format through LevelDB, and at the same time, the revelation cache time and the current call status can be recorded; the data is buffered on the disk through LevelDB, so even downstream If the landing fails, the data will still be stored on the disk, because using LevelDB's own lsm strategy, the write throughput can reach nearly append write efficiency, rather than inefficient random write efficiency.
  • format cache module includes:
  • the queue receiving module is configured to establish a preset queue mode in the target storage layer, and continuously receive the to-be-processed data sent by the producer according to the preset queue mode;
  • the thread pool creation module is used to create a thread pool in LevelDB after receiving the to-be-processed data sent by the producer, and the thread pool includes multiple threads;
  • the data analysis module is used to analyze the data to be processed to obtain the data type corresponding to each data unit in the data to be processed;
  • the thread arrangement module is used to group the data units of the same data type into a group, and arrange the corresponding target thread for each group of data units according to a preset transmission strategy in a group unit.
  • the format processing module is configured to perform format processing on each group of data units according to a preset data format, and cache each group of data units after format processing to the target storage layer with a corresponding target thread.
  • the preset queue mode is a preset queue. According to the preset queue mode, the data to be processed sent by the producer is continuously received, and after receiving the data to be processed sent by the producer, A thread pool can be created in LevelDB, and the thread pool includes multiple threads, and then data is cached according to the data type of the data to be processed.
  • receiving the data to be processed is a continuous process, continuously receiving the data to be processed sent by the producer, before the data to be processed is cached in the target storage layer, it is necessary to The data to be processed is analyzed to obtain the data type of the data to be processed, a corresponding data index is established in the target storage layer according to the data type, and the data index is stored.
  • different data types correspond to different data indexes, and indexing by storing data can quickly locate required data in massive data.
  • a thread pool needs to be created in LevelDB.
  • the thread pool contains multiple threads to divide the data to be processed with the same data type into one.
  • Group the corresponding thread is arranged to transmit the same group of data to be processed according to the preset transmission strategy in the unit of group.
  • the corresponding thread can be arranged by assigning the data in each thread through the preset hash algorithm, and then the corresponding data to be processed
  • thread transmission may be synchronous thread transmission or asynchronous thread transmission, of course, it may also be other transmission methods, which is not limited in this embodiment.
  • the transmission module 30 is configured to transmit the corresponding target data through the input/output interface of the target storage layer when the data consumption instruction is received.
  • the corresponding target data can be transmitted according to the input/output interface of the target storage layer, which can effectively improve resource utilization.
  • the transmission module 30 includes:
  • the index module is used to find the corresponding data index in the target storage layer according to the data consumption instruction when the data consumption instruction is received, as the target data index.
  • the data consumption instruction is a consumption instruction generated by the consumer end, which is used as the target data index by searching for a data index in the target storage layer.
  • the searching module is configured to find the corresponding target data according to the target data index, and transmit the target data through the input and output interface of the target storage layer.
  • the corresponding index is found in the target storage layer, the corresponding target data can be found according to the target index, and the target data can be transmitted through the input and output ports. It can effectively improve resource utilization and speed up data writing and reading.
  • the transmission module 30 further includes:
  • a calling state obtaining module used to obtain the current calling state of the target data
  • a cache time determining module configured to obtain the cache time of the target data according to the current calling state
  • a cache comparison module configured to compare the cache time with a preset cache time to determine whether the cache corresponding to the target data is an overtime cache
  • the deletion module is configured to delete the cache corresponding to the target data in the target storage layer when the cache corresponding to the target data is a timeout cache.
  • the current invocation state is the current invocation state of the target data
  • the caching time of the target data can be analyzed according to the invocation state
  • the preset caching time is a preset caching time, according to As a result of comparing the cache time with the preset cache time, it can be determined whether the cache corresponding to the target data is an overtime cache, and the cache corresponding to the target data is deleted in the target storage layer.
  • the cache corresponding to the target data is deleted in the target storage layer, and it can be determined whether the target data transmission is completed by detecting the current call status of the target data
  • the cache time of different data to be processed can be determined by the start cache time and the current time. By comparing the cache time with the preset timeout cache time, it can be determined that the cached data has expired, that is, the cached data can be determined to have timed out The data is useless data. At this time, the cache corresponding to the useless data can be clear from the target storage layer, thereby avoiding data redundancy in the target storage layer and improving the utilization rate of the storage space of the target storage layer.
  • a target storage layer is set on the consumer side by using the key-value storage database LevelDB; after receiving the to-be-processed data sent by the producer, the to-be-processed data is cached to the target storage layer; When a data consumption instruction is received, the corresponding target data is transmitted through the input and output interface of the target storage layer, which can effectively improve resource utilization, increase the speed of data writing and reading, ensure data integrity, and effectively avoid data lost.
  • an embodiment of the present application also proposes a storage medium.
  • the storage medium of the present application may be a non-volatile computer-readable storage medium.
  • the storage medium stores computer-readable instructions, and the computer-readable instructions are processed. The corresponding steps of the data transmission method are realized when the device is executed.

Landscapes

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

Abstract

一种数据传输方法、装置、设备及存储介质,通过根据键值存储数据库LevelDB在消费者端设置目标存储层(S10);在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层(S20);在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输(S30),可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失。

Description

数据传输方法、装置、设备及存储介质
本申请要求于2019年03月16日提交中国专利局、申请号为201910202064.2、发明名称为“数据传输方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及云处理领域,尤其涉及一种数据传输方法、装置、设备及存储介质。
背景技术
在日常办公过程中,现阶段,各大公司开源项目中对于磁盘读写、数据库读写缓冲大多是利用消息队列实现,且多多是通过网络读写,但是存在资源利用率较低,可靠性较差且实现步骤比较繁琐的问题,如果本地磁盘损坏,则存在数据丢失的风险。
发明内容
本申请的主要目的在于提供一种数据传输方法、装置、设备及存储介质,旨在解决现有技术中磁盘读写存在资源利用率较低,可靠性较差且实现步骤比较繁琐的技术问题。
为实现上述目的,本申请提供一种数据传输方法,所述数据传输方法包括以下步骤:
根据键值存储数据库LevelDB在消费者端设置目标存储层;
在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;
在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
本申请提出的数据传输方法,通过根据键值存储数据库LevelDB在消费者端设置目标存储层;在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失。
本申请的一个或多个实施例的细节在下面的附图和描述中提出,本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显 。
附图说明
图1为本申请实施例方案涉及的硬件运行环境的数据传输设备结构示意图;
图2为本申请数据传输方法第一实施例的流程示意图;
图3为本申请数据传输方法第二实施例的流程示意图;
图4为本申请数据传输方法第三实施例的流程示意图;
图5为本申请数据传输装置第一实施例的功能模块图。
本申请目的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例的解决方案主要是:本申请通过根据键值存储数据库LevelDB在消费者端设置目标存储层;在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失,解决了现有技术中磁盘读写存在资源利用率较低,可靠性较差且实现步骤比较繁琐的技术问题。
参照图1,图1为本申请实施例方案涉及的硬件运行环境的数据传输设备结构示意图。
如图1所示,该数据传输设备可以包括:处理器1001,例如中央处理器(CentralProcessingUnit,CPU),通信总线1002、用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如无线保真(WIreless-FIdelity,WI-FI)接口)。存储器1005可以是高速的随机存取存储器(RandomAccessMemory,RAM)存储器,也可以是稳定的存储器(Non-volatileMemory,NVM),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
本领域技术人员可以理解,图1中示出的数据传输设备结构并不构成对该数据传输设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,本申请的存储介质可以为非易失性计算机可读存储介质,作为一种存储介质的存储器1005中可以包括操作装置、网络通信模块、用户端接口模块以及计算机可读指令,所述数据传输设备执行本申请实施例提供的数据传输方法对应的步骤。
基于上述硬件结构,提出本申请数据传输方法实施例。
参照图2,图2为本申请数据传输方法第一实施例的流程示意图。
在第一实施例中,所述数据传输方法包括以下步骤:
步骤S10、根据键值存储数据库LevelDB在消费者端设置目标存储层。
需要说明的是,所述键值存储数据库LevelDB是能够处理十亿级别规模键值Key-Value型数据持久性存储的C++程序库,LevelDB在存储数据时,是根据记录的key值有序存储的,即相邻的key值在存储文件中是依次顺序存储的,而应用可以自定义key大小比较函数,LevelDB可以按照用户自定义的比较函数依序存储键值记录;通过LevelDB可以在消费者端设置目标存储层,用于存储待处理数据。
所述步骤S10具体包括以下步骤:
在键值存储数据库LevelDB 的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层。
应当理解的是,所述序列化功能应用程序编程接口(Application Programming Interface,API)为具有序列功能的预先设定的函数,一般的,可以根据键值存储数据库LevelDB 在消费者端的本地磁盘中设置目标存储层,在LevelDB 的基础上封装序列化功能API,通过所述本地磁盘作为介质,可以为缓冲后续磁盘输入输出接口的目标数据进行传输,封装的目的是为了不修改LevelDB的代码,并且方便对所述存储层中的数据进行调用,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性。
进一步地,所述在键值存储数据库LevelDB 的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层具体包括以下步骤:
在键值存储数据库LevelDB 的内存中分配出预设数量的目标内存空间;
根据预设排序函数和预设封装格式将序列化功能API与所述目标内存空间的操作代码结合,建立所述目标内存空间对应的操作接口;
将建立了操作接口的预设数量的目标内存空间作为目标存储层。
可以理解的是,可以在键值存储数据库LevelDB 的内存中分配出预设数量的目标内存空间,所述预设数量为预先设置的内存空间对应的数量,可以是在levelDB中的内存MemTable中分配出预设数量的目标内存空间,所述预设数量可以根据历史进程数量确定;
应当理解的是,所述预设排序函数为预先设置的排序函数,所述预设封装格式为预先设置的封装格式,根据预设排序函数和预设封装格式将序列化功能API与目标内存空间的操作代码结合,建立目标内存空间的操作接口,将多个建立了操作接口的目标内存空间作为目标存储层,可以是获得目标内存空间的操作数据,将所述操作数据分解成字节流,根据预设排序函数将序列化功能API与目标内存空间的操作代码进行有机结合,通过操作代码的结合,可以建立与所述目标内存空间对应的操作接口,所述序列化功能API可以包括但不限于插入PUT接口,获取GET接口,设置SET接口,删除DELETE接口,将所述虚拟存储层与所述消费者端的本地磁盘进行关联,将关联之后的虚拟存储层作为所述消费者端的目标存储层。
步骤S20、在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层。
可以理解的是,在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层,所述生产者端和所述消费者端都可以是一堆线程,将所述待处理数据缓存至所述目标存储层后,可以在后续消费指令到达时进行数据传输,所述目标存储层可以通过本地磁盘作为介质,作为消息队列网络读写的蓄水池。
步骤S30、在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
应当理解的是,在接收到数据消费指令时,可以根据所述目标存储层的输入输出接口将对应的目标数据进行传输,能够有效提高资源利用率。
本实施例通过上述方案,通过根据键值存储数据库LevelDB在消费者端设置目标存储层;在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失。
进一步地,图3为本申请数据传输方法第二实施例的流程示意图,如图3所示,基于第一实施例提出本申请数据传输方法第二实施例,在本实施例中,所述步骤S20,具体包括以下步骤:
步骤S21、在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
需要说明的是,所述预设数据格式为预先设置是数据格式,在接收完生产者端发送的待处理数据时,可以通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
在具体实现中,通过LevelDB将所述待处理数据根据预设数据格式缓存至所述目标存储层中,同时可以记录启示缓存时间以及当前调用状态;数据通过LevelDB缓冲到磁盘上,所以即使下游的落地失败,数据仍然会保存在磁盘上,因为利用LevelDB本身的lsm策略,写的吞吐量可以达到近乎append写效率,而非低效的随机写的效率。
进一步地,所述步骤S21包括以下步骤:
在所述目标存储层中建立预设队列模式,根据所述预设队列模式持续接收生产者端发送的待处理数据;
在接收完所述生产者端发送的待处理数据时,在LevelDB中创建线程池,所述线程池中包括多个线程;
对所述待处理数据进行分析,获得所述待处理数据中各数据单元对应的数据类型;
将所述数据类型相同的数据单元分为一组,以组为单位根据预设传输策略为各组数据单元安排对应的目标线程。
根据预设数据格式对各组数据单元进行格式处理,将格式处理后的各组数据单元以对应的目标线程缓存至所述目标存储层。
应当理解的是,所述预设队列模式为预先设置的队列,根据所述预设队列模式持续接收生产者端发送的待处理数据,在接收完所述生产者端发送的待处理数据时,可以在LevelDB中创建线程池,所述线程池中包括多个线程,进而根据所述待处理数据的数据类型进行数据缓存。
可以理解的是,根据预设队列模式持续接收所述生产者端发送的多个待处理数据;对于生产者会生成任务并持久化在存储上,消费者会不断的消费存储层上的数据,并往下游持久或者当即消费计算,接收待处理数据是一个持续的过程,持续接收生产者端发送的待处理数据,在将所述待处理数据缓存至所述目标存储层之前,还需要对所述待处理数据进行分析,获得所述待处理数据的数据类型,根据所述数据类型在所述目标存储层中建立对应的数据索引,并将数据索引进行存储,所述数据索引与所述待处理数据对应,不同的数据类型对应不同的数据索引,通过存储数据建立索引,可以实现在海量数据中快速定位需求数据。
应当理解的是,在将所述待处理数据缓存至所述目标存储层之前,还需要在LevelDB中创建线程池,线程池中包含有多个线程,将数据类型相同的待处理数据分为一组,以组为单位根据预设传输策略安排对应的线程传输同一组的待处理数据,安排对应的线程可以是通过预设哈希算法将数据在各线程中分配,进而将对应的待处理数据与线程匹配对应,线程传输可以是同步线程传输,也可以是异步线程传输,当然也可以是其他传输方式,本实施例对此不加以限制。
本实施例通过上述方案,通过在所述目标存储层中建立预设队列模式,根据所述预设队列模式持续接收生产者端发送的待处理数据;在接收完所述生产者端发送的待处理数据时,在LevelDB中创建线程池,所述线程池中包括多个线程;对所述待处理数据进行分析,获得所述待处理数据中各数据单元对应的数据类型;将所述数据类型相同的数据单元分为一组,以组为单位根据预设传输策略为各组数据单元安排对应的目标线程;根据预设数据格式对各组数据单元进行格式处理,将格式处理后的各组数据单元以对应的目标线程缓存至所述目标存储层,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失。
进一步地,图4为本申请数据传输方法第三实施例的流程示意图,如图4所示,基于第二实施例提出本申请数据传输方法第三实施例,在本实施例中,所述步骤S30包括以下步骤:
步骤S31、在接收到数据消费指令时,根据所述数据消费指令在所述目标存储层中找到对应的数据索引,作为目标数据索引。
需要说明的是,所述数据消费指令为所述消费者端生成的消费指令,通过查找所述目标存储层中的数据索引,作为所述目标数据索引。
步骤S32、根据所述目标数据索引查找到对应的目标数据,通过所述目标存储层的输入输出接口将所述目标数据进行传输。
应当理解的是,根据所述数据消费指令在所述目标存储层中找到对应的索引,根据所述目标索引可以查到对应的目标数据,再通过输入输出口可以对所述目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度。
进一步地,所述步骤S30之后,所述方法还包括以下步骤:
获取所述目标数据的当前调用状态;
根据所述当前调用状态获取所述目标数据的缓存时间;
将所述缓存时间与预设缓存时间比较,确定所述目标数据对应的缓存是否为超时缓存;
在所述目标数据对应的缓存为超时缓存时,将所述目标数据对应的缓存在所述目标存储层中删除。
需要说明的是,所述当前调用状态为所述目标数据当前的调用状态,根据所述调用状态可以分析出所述目标数据的缓存时间,所述预设缓存时间为预先设置的缓存时间,根据所述缓存时间与所述预设缓存时间比较结果,可以确定所述目标数据对应的缓存是否为超时缓存,将所述目标数据对应的缓存在所述目标存储层中删除。
可以理解的是,在对应的目标数据传输完成后,将所述目标数据对应的缓存在所述目标存储层中删除,可以通过检测所述目标数据的当前调用状态确定所述目标数据是否传输完成;通过所述开始缓存时间和当前时间可以确定不同的待处理数据的缓存时间,通过将所述缓存时间与预设超时缓存时间比较,可以确定已经超时缓存的数据,即可以认定已经超时缓存的数据为无用数据,此时可以将无用数据对应的缓存从所述目标存储层中清楚,从而避免了目标存储层的数据冗杂,提高目标存储层存储空间的利用率。
本实施例通过上述方案,通过在接收到数据消费指令时,根据所述数据消费指令在所述目标存储层中找到对应的数据索引,作为目标数据索引;根据所述目标数据索引查找到对应的目标数据,通过所述目标存储层的输入输出接口将所述目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失。
基于上述数据传输方法的实施例,本申请进一步提供一种数据传输装置。
参照图5,图5为本申请数据传输装置第一实施例的功能模块图。
本申请数据传输装置第一实施例中,该数据传输装置包括:设置模块10、缓存模块20和传输模块30;
其中,所述设置模块10,用于根据键值存储数据库LevelDB 在消费者端设置目标存储层。
需要说明的是,所述键值存储数据库LevelDB是能够处理十亿级别规模键值Key-Value型数据持久性存储的C++程序库,LevelDB在存储数据时,是根据记录的key值有序存储的,即相邻的key值在存储文件中是依次顺序存储的,而应用可以自定义key大小比较函数,LevelDB可以按照用户自定义的比较函数依序存储键值记录;通过LevelDB可以在消费者端设置目标存储层,用于存储待处理数据。
进一步地,所述设置模块10包括:
封装模块,用于在键值存储数据库LevelDB 的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层。
应当理解的是,所述序列化功能应用程序编程接口(Application Programming Interface,API)为具有序列功能的预先设定的函数,一般的,可以根据键值存储数据库LevelDB 在消费者端的本地磁盘中设置目标存储层,在LevelDB 的基础上封装序列化功能API,通过所述本地磁盘作为介质,可以为缓冲后续磁盘输入输出接口的目标数据进行传输,封装的目的是为了不修改LevelDB的代码,并且方便对所述存储层中的数据进行调用,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性。
进一步地,所述封装模块包括:
空间分配模块,用于在键值存储数据库LevelDB 的内存中分配出预设数量的目标内存空间。
接口建立模块,用于根据预设排序函数和预设封装格式将序列化功能API与所述目标内存空间的操作代码结合,建立所述目标内存空间对应的操作接口。
存储层建立模块,用于将建立了操作接口的预设数量的目标内存空间作为目标存储层。
可以理解的是,可以在键值存储数据库LevelDB 的内存中分配出预设数量的目标内存空间,所述预设数量为预先设置的内存空间对应的数量,可以是在levelDB中的内存MemTable中分配出预设数量的目标内存空间,所述预设数量可以根据历史进程数量确定;
应当理解的是,所述预设排序函数为预先设置的排序函数,所述预设封装格式为预先设置的封装格式,根据预设排序函数和预设封装格式将序列化功能API与目标内存空间的操作代码结合,建立目标内存空间的操作接口,将多个建立了操作接口的目标内存空间作为目标存储层,可以是获得目标内存空间的操作数据,将所述操作数据分解成字节流,根据预设排序函数将序列化功能API与目标内存空间的操作代码进行有机结合,通过操作代码的结合,可以建立与所述目标内存空间对应的操作接口,所述序列化功能API可以包括但不限于插入PUT接口,获取GET接口,设置SET接口,删除DELETE接口,将所述虚拟存储层与所述消费者端的本地磁盘进行关联,将关联之后的虚拟存储层作为所述消费者端的目标存储层。
缓存模块20,用于在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层。
可以理解的是,在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层,所述生产者端和所述消费者端都可以是一堆线程,将所述待处理数据缓存至所述目标存储层后,可以在后续消费指令到达时进行数据传输,所述目标存储层可以通过本地磁盘作为介质,作为消息队列网络读写的蓄水池。
进一步地,所述缓存模块20包括:
格式缓存模块,用于在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
需要说明的是,所述预设数据格式为预先设置是数据格式,在接收完生产者端发送的待处理数据时,可以通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
在具体实现中,通过LevelDB将所述待处理数据根据预设数据格式缓存至所述目标存储层中,同时可以记录启示缓存时间以及当前调用状态;数据通过LevelDB缓冲到磁盘上,所以即使下游的落地失败,数据仍然会保存在磁盘上,因为利用LevelDB本身的lsm策略,写的吞吐量可以达到近乎append写效率,而非低效的随机写的效率。
进一步地,所述格式缓存模块包括:
队列接收模块,用于在所述目标存储层中建立预设队列模式,根据所述预设队列模式持续接收生产者端发送的待处理数据;
线程池创建模块,用于在接收完所述生产者端发送的待处理数据时,在LevelDB中创建线程池,所述线程池中包括多个线程;
数据分析模块,用于对所述待处理数据进行分析,获得所述待处理数据中各数据单元对应的数据类型;
线程安排模块,用于将所述数据类型相同的数据单元分为一组,以组为单位根据预设传输策略为各组数据单元安排对应的目标线程。
格式处理模块,用于根据预设数据格式对各组数据单元进行格式处理,将格式处理后的各组数据单元以对应的目标线程缓存至所述目标存储层。
应当理解的是,所述预设队列模式为预先设置的队列,根据所述预设队列模式持续接收生产者端发送的待处理数据,在接收完所述生产者端发送的待处理数据时,可以在LevelDB中创建线程池,所述线程池中包括多个线程,进而根据所述待处理数据的数据类型进行数据缓存。
可以理解的是,根据预设队列模式持续接收所述生产者端发送的多个待处理数据;对于生产者会生成任务并持久化在存储上,消费者会不断的消费存储层上的数据,并往下游持久或者当即消费计算,接收待处理数据是一个持续的过程,持续接收生产者端发送的待处理数据,在将所述待处理数据缓存至所述目标存储层之前,还需要对所述待处理数据进行分析,获得所述待处理数据的数据类型,根据所述数据类型在所述目标存储层中建立对应的数据索引,并将数据索引进行存储,所述数据索引与所述待处理数据对应,不同的数据类型对应不同的数据索引,通过存储数据建立索引,可以实现在海量数据中快速定位需求数据。
应当理解的是,在将所述待处理数据缓存至所述目标存储层之前,还需要在LevelDB中创建线程池,线程池中包含有多个线程,将数据类型相同的待处理数据分为一组,以组为单位根据预设传输策略安排对应的线程传输同一组的待处理数据,安排对应的线程可以是通过预设哈希算法将数据在各线程中分配,进而将对应的待处理数据与线程匹配对应,线程传输可以是同步线程传输,也可以是异步线程传输,当然也可以是其他传输方式,本实施例对此不加以限制。
传输模块30,用于在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
应当理解的是,在接收到数据消费指令时,可以根据所述目标存储层的输入输出接口将对应的目标数据进行传输,能够有效提高资源利用率。
进一步地,所述传输模块30包括:
索引模块,用于在接收到数据消费指令时,根据所述数据消费指令在所述目标存储层中找到对应的数据索引,作为目标数据索引。
需要说明的是,所述数据消费指令为所述消费者端生成的消费指令,通过查找所述目标存储层中的数据索引,作为所述目标数据索引。
查找模块,用于根据所述目标数据索引查找到对应的目标数据,通过所述目标存储层的输入输出接口将所述目标数据进行传输。
应当理解的是,根据所述数据消费指令在所述目标存储层中找到对应的索引,根据所述目标索引可以查到对应的目标数据,再通过输入输出口可以对所述目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度。
进一步地,所述传输模块30还包括:
调用状态获取模块,用于获取所述目标数据的当前调用状态;
缓存时间确定模块,用于根据所述当前调用状态获取所述目标数据的缓存时间;
缓存比较模块,用于将所述缓存时间与预设缓存时间比较,确定所述目标数据对应的缓存是否为超时缓存;
删除模块,用于在所述目标数据对应的缓存为超时缓存时,将所述目标数据对应的缓存在所述目标存储层中删除。
需要说明的是,所述当前调用状态为所述目标数据当前的调用状态,根据所述调用状态可以分析出所述目标数据的缓存时间,所述预设缓存时间为预先设置的缓存时间,根据所述缓存时间与所述预设缓存时间比较结果,可以确定所述目标数据对应的缓存是否为超时缓存,将所述目标数据对应的缓存在所述目标存储层中删除。
可以理解的是,在对应的目标数据传输完成后,将所述目标数据对应的缓存在所述目标存储层中删除,可以通过检测所述目标数据的当前调用状态确定所述目标数据是否传输完成;通过所述开始缓存时间和当前时间可以确定不同的待处理数据的缓存时间,通过将所述缓存时间与预设超时缓存时间比较,可以确定已经超时缓存的数据,即可以认定已经超时缓存的数据为无用数据,此时可以将无用数据对应的缓存从所述目标存储层中清楚,从而避免了目标存储层的数据冗杂,提高目标存储层存储空间的利用率。
本实施例通过上述方案,通过根据键值存储数据库LevelDB在消费者端设置目标存储层;在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输,可以有效提高资源利用率,提升数据写入读取速度,保证了数据完整性,有效避免了数据丢失。
此外,本申请实施例还提出一种存储介质,本申请的存储介质可以为非易失性计算机可读存储介质,所述存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现数据传输方法对应的步骤。

Claims (20)

  1. 一种数据传输方法,其特征在于,所述方法包括:
    根据键值存储数据库LevelDB在消费者端设置目标存储层;
    在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;
    在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
  2. 如权利要求1所述的方法,其特征在于,所述根据键值存储数据库LevelDB在消费者端设置目标存储层的步骤,包括:
    在键值存储数据库LevelDB的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层。
  3. 如权利要求2所述的方法,其特征在于,所述在键值存储数据库LevelDB的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层的步骤,包括:
    在键值存储数据库LevelDB的内存中分配出预设数量的目标内存空间;
    根据预设排序函数和预设封装格式将序列化功能API与所述目标内存空间的操作代码结合,建立所述目标内存空间对应的操作接口;
    将建立了操作接口的预设数量的目标内存空间作为目标存储层。
  4. 如权利要求3所述的方法,其特征在于,所述在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层的步骤,包括:
    在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
  5. 如权利要求4所述的方法,其特征在于,所述在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层的步骤,包括:
    在所述目标存储层中建立预设队列模式,根据所述预设队列模式持续接收生产者端发送的待处理数据;
    在接收完所述生产者端发送的待处理数据时,在LevelDB中创建线程池,所述线程池中包括多个线程;
    对所述待处理数据进行分析,获得所述待处理数据中各数据单元对应的数据类型;
    将所述数据类型相同的数据单元分为一组,以组为单位根据预设传输策略为各组数据单元安排对应的目标线程。
    根据预设数据格式对各组数据单元进行格式处理,将格式处理后的各组数据单元以对应的目标线程缓存至所述目标存储层。
  6. 如权利要求5所述的方法,其特征在于,所述在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输的步骤,包括:
    在接收到数据消费指令时,根据所述数据消费指令在所述目标存储层中找到对应的数据索引,作为目标数据索引;
    根据所述目标数据索引查找到对应的目标数据,通过所述目标存储层的输入输出接口将所述目标数据进行传输。
  7. 如权利要求1所述的方法,其特征在于,所述在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输的步骤之后,所述方法还包括:
    获取所述目标数据的当前调用状态;
    根据所述当前调用状态获取所述目标数据的缓存时间;
    将所述缓存时间与预设缓存时间比较,确定所述目标数据对应的缓存是否为超时缓存;
    在所述目标数据对应的缓存为超时缓存时,将所述目标数据对应的缓存在所述目标存储层中删除。
  8. 一种数据传输装置,其特征在于,所述装置包括:设置模块、缓存模块和传输模块;
    其中,所述设置模块,用于根据键值存储数据库LevelDB在消费者端设置目标存储层;
    缓存模块,用于在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;
    传输模块,用于在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
  9. 如权利要求8所述的数据传输装置,其特征在于,所述设置模块包括:
    封装模块,用于在键值存储数据库LevelDB 的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层。
  10. 如权利要求9所述的数据传输装置,其特征在于,所述封装模块包括:
    空间分配模块,用于在键值存储数据库LevelDB 的内存中分配出预设数量的目标内存空间;
    接口建立模块,用于根据预设排序函数和预设封装格式将序列化功能API与所述目标内存空间的操作代码结合,建立所述目标内存空间对应的操作接口;
    存储层建立模块,用于将建立了操作接口的预设数量的目标内存空间作为目标存储层。
  11. 如权利要求10所述的数据传输装置,其特征在于,所述缓存模块20包括:
    格式缓存模块,用于在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
  12. 如权利要求11 所述的数据传输装置,其特征在于,所述格式缓存模块包括:
    队列接收模块,用于在所述目标存储层中建立预设队列模式,根据所述预设队列模式持续接收生产者端发送的待处理数据;
    线程池创建模块,用于在接收完所述生产者端发送的待处理数据时,在LevelDB中创建线程池,所述线程池中包括多个线程;
    数据分析模块,用于对所述待处理数据进行分析,获得所述待处理数据中各数据单元对应的数据类型;
    线程安排模块,用于将所述数据类型相同的数据单元分为一组,以组为单位根据预设传输策略为各组数据单元安排对应的目标线程;
    格式处理模块,用于根据预设数据格式对各组数据单元进行格式处理,将格式处理后的各组数据单元以对应的目标线程缓存至所述目标存储层。
  13. 如权利要求12所述的数据传输装置,其特征在于,所述传输模块包括:
    索引模块,用于在接收到数据消费指令时,根据所述数据消费指令在所述目标存储层中找到对应的数据索引,作为目标数据索引;
    查找模块,用于根据所述目标数据索引查找到对应的目标数据,通过所述目标存储层的输入输出接口将所述目标数据进行传输。
  14. 如权利要求13所述的数据传输装置,其特征在于,所述传输模块还包括:
    调用状态获取模块,用于获取所述目标数据的当前调用状态;
    缓存时间确定模块,用于根据所述当前调用状态获取所述目标数据的缓存时间;
    缓存比较模块,用于将所述缓存时间与预设缓存时间比较,确定所述目标数据对应的缓存是否为超时缓存;
    删除模块,用于在所述目标数据对应的缓存为超时缓存时,将所述目标数据对应的缓存在所述目标存储层中删除。
  15. 一种数据传输设备,其特征在于,所述数据传输设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述计算机可读指令配置为实现如下步骤:
    根据键值存储数据库LevelDB在消费者端设置目标存储层;
    在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;
    在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
  16. 如权利要求15所述的数据传输设备,其特征在于,所述根据键值存储数据库LevelDB在消费者端设置目标存储层的步骤包括:
    在键值存储数据库LevelDB的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层。
  17. 如权利要求16所述的数据传输设备,其特征在于,所述在键值存储数据库LevelDB的基础上封装序列化功能API,根据所述序列化功能API设置虚拟存储层的步骤包括:
    在键值存储数据库LevelDB的内存中分配出预设数量的目标内存空间;
    根据预设排序函数和预设封装格式将序列化功能API与所述目标内存空间的操作代码结合,建立所述目标内存空间对应的操作接口;
    将建立了操作接口的预设数量的目标内存空间作为目标存储层。
  18. 如权利要求17所述的数据传输设备,其特征在于,所述在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层的步骤,包括:
    在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层。
  19. 如权利要求18所述的数据传输设备,其特征在于,所述在接收完生产者端发送的待处理数据时,通过LevelDB将所述待处理数据以预设数据格式缓存至所述目标存储层的步骤,包括:
    在所述目标存储层中建立预设队列模式,根据所述预设队列模式持续接收生产者端发送的待处理数据;
    在接收完所述生产者端发送的待处理数据时,在LevelDB中创建线程池,所述线程池中包括多个线程;
    对所述待处理数据进行分析,获得所述待处理数据中各数据单元对应的数据类型;
    将所述数据类型相同的数据单元分为一组,以组为单位根据预设传输策略为各组数据单元安排对应的目标线程。
    根据预设数据格式对各组数据单元进行格式处理,将格式处理后的各组数据单元以对应的目标线程缓存至所述目标存储层。
  20. 一种存储介质,其特征在于,所述存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下步骤:
    根据键值存储数据库LevelDB在消费者端设置目标存储层;
    在接收完生产者端发送的待处理数据时,将所述待处理数据缓存至所述目标存储层;
    在接收到数据消费指令时,通过所述目标存储层的输入输出接口将对应的目标数据进行传输。
PCT/CN2019/118537 2019-03-16 2019-11-14 数据传输方法、装置、设备及存储介质 WO2020186791A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910202064.2 2019-03-16
CN201910202064.2A CN110069557B (zh) 2019-03-16 2019-03-16 数据传输方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020186791A1 true WO2020186791A1 (zh) 2020-09-24

Family

ID=67365276

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118537 WO2020186791A1 (zh) 2019-03-16 2019-11-14 数据传输方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN110069557B (zh)
WO (1) WO2020186791A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181686A (zh) * 2020-09-28 2021-01-05 北京金山云网络技术有限公司 一种数据处理方法、装置、系统、电子设备及存储介质
CN112486421A (zh) * 2020-12-16 2021-03-12 上海达梦数据库有限公司 一种数据存储方法、装置、电子设备及存储介质
CN113885802A (zh) * 2021-09-30 2022-01-04 杭州贝嘟科技有限公司 数据传输方法、装置、电子装置和存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767281A (zh) * 2020-05-15 2020-10-13 北京奇艺世纪科技有限公司 一种数据处理方法、装置、电子设备及存储介质
CN112422243B (zh) * 2020-11-22 2021-08-13 广州技象科技有限公司 基于进程优化的数据传输方法和装置
CN115378941A (zh) * 2022-08-30 2022-11-22 新疆联海创智信息科技有限公司 数据跨网传输方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195738A1 (en) * 2013-01-04 2014-07-10 International Business Machines Corporation I/O Write Request Handling in a Storage System
CN108021688A (zh) * 2017-12-15 2018-05-11 北京明朝万达科技股份有限公司 一种数据处理方法及装置
CN108595121A (zh) * 2018-04-17 2018-09-28 湖北文理学院 数据存储方法和装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239252A (zh) * 2013-06-21 2014-12-24 华为技术有限公司 数据存储系统的数据传输方法、装置及系统
US10025943B1 (en) * 2014-10-13 2018-07-17 Amazon Technologies, Inc. Commit and rollback of data streams provided by partially trusted entities
US9870168B1 (en) * 2014-12-22 2018-01-16 Emc Corporation Key-value store with internal key-value storage interface
CN106254489A (zh) * 2016-08-16 2016-12-21 王淼 一种无文件传输的云渲染系统及其方法
CN108965355B (zh) * 2017-05-18 2021-05-25 北京京东尚科信息技术有限公司 用于数据传输的方法、装置及计算机可读存储介质
CN108897613A (zh) * 2018-05-07 2018-11-27 广西英腾教育科技股份有限公司 数据处理方法、系统及计算机设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195738A1 (en) * 2013-01-04 2014-07-10 International Business Machines Corporation I/O Write Request Handling in a Storage System
CN108021688A (zh) * 2017-12-15 2018-05-11 北京明朝万达科技股份有限公司 一种数据处理方法及装置
CN108595121A (zh) * 2018-04-17 2018-09-28 湖北文理学院 数据存储方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ANONYMOUS: "Non-official translation: Improving Working Performance of ActiveMQ (Ⅱ)", HTTPS://BLOG.51CTO.COM/4925054/2103702, 15 April 2018 (2018-04-15), DOI: 20200115195006X *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181686A (zh) * 2020-09-28 2021-01-05 北京金山云网络技术有限公司 一种数据处理方法、装置、系统、电子设备及存储介质
CN112486421A (zh) * 2020-12-16 2021-03-12 上海达梦数据库有限公司 一种数据存储方法、装置、电子设备及存储介质
CN112486421B (zh) * 2020-12-16 2024-05-28 上海达梦数据库有限公司 一种数据存储方法、装置、电子设备及存储介质
CN113885802A (zh) * 2021-09-30 2022-01-04 杭州贝嘟科技有限公司 数据传输方法、装置、电子装置和存储介质

Also Published As

Publication number Publication date
CN110069557A (zh) 2019-07-30
CN110069557B (zh) 2023-10-20

Similar Documents

Publication Publication Date Title
WO2020186791A1 (zh) 数据传输方法、装置、设备及存储介质
WO2018036167A1 (zh) 测试任务执行机分配方法、装置、服务器和存储介质
WO2018093094A1 (ko) 데이터베이스 관리 시스템에서의 데이터 복제 기법
WO2018161478A1 (zh) 多区块链的分片处理方法、装置、服务器和存储介质
WO2012111905A2 (ko) 맵 리듀스를 이용한 분산 메모리 클러스터 제어 장치 및 방법
WO2021072881A1 (zh) 基于对象存储的请求处理方法、装置、设备及存储介质
WO2018014582A1 (zh) 保单数据处理方法、装置、服务器和存储介质
WO2016190476A1 (ko) 클라우드 서비스를 위한 암호화 키 관리 방법 및 그 장치
WO2020186787A1 (zh) 智能任务调度方法、装置、设备及存储介质
WO2011147324A1 (zh) 多接口固态硬盘及其处理方法和系统
WO2020186773A1 (zh) 调用请求监控方法、装置、设备及存储介质
WO2018103320A1 (zh) 灰度发布方法、系统、服务器及存储介质
WO2020119115A1 (zh) 数据审核方法、装置、设备及存储介质
TWI286425B (en) A method and apparatus for reassembly of data blocks within a network processor
WO2020237859A1 (zh) 基于nbd设备的数据迁移方法、装置、设备及存储介质
WO2015062220A1 (zh) 一种多类型无线链路并行传输的方法和系统
WO2020253135A1 (zh) 自动化分析方法、用户设备、存储介质及装置
WO2020098075A1 (zh) 金融数据处理方法、装置、设备和存储介质
WO2020101343A1 (ko) 데이터베이스 관리 시스템에서의 변경 데이터 캡쳐 구현 기법
WO2021141294A1 (ko) 데이터의 하이브리드 저장을 이용한 데이터 아카이빙 방법 및 시스템
WO2021027134A1 (zh) 数据存储方法、装置、设备和计算机存储介质
WO2014029354A1 (zh) 图片上传方法和系统、客户端
WO2012155709A1 (zh) 一种动态推送用户个人标签的方法和系统、存储介质
WO2019221377A1 (ko) 블록체인 기반 트랜잭션 관리 시스템 및 그 동작 방법
WO2018036168A1 (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: 19919881

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: 19919881

Country of ref document: EP

Kind code of ref document: A1