CN107633087A - A kind of date storage method based on database - Google Patents

A kind of date storage method based on database Download PDF

Info

Publication number
CN107633087A
CN107633087A CN201710905318.8A CN201710905318A CN107633087A CN 107633087 A CN107633087 A CN 107633087A CN 201710905318 A CN201710905318 A CN 201710905318A CN 107633087 A CN107633087 A CN 107633087A
Authority
CN
China
Prior art keywords
thread
data
queue
application program
safe
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.)
Pending
Application number
CN201710905318.8A
Other languages
Chinese (zh)
Inventor
刘福年
卢鑫
邱聪勇
张杰阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Linewell Software Co Ltd
Original Assignee
Linewell Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Linewell Software Co Ltd filed Critical Linewell Software Co Ltd
Priority to CN201710905318.8A priority Critical patent/CN107633087A/en
Publication of CN107633087A publication Critical patent/CN107633087A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of date storage method based on database, for improving the data updating efficiency of target database.The present invention provides a kind of date storage method based on database, including:Thread-safe data queue is pre-defined in the application, and determines that the thread-safe data queue is the data source for needing to monitor;In the application program launching, start the oracle listener pre-defined in the application program and monitoring processing is carried out to the thread-safe data queue;When the oracle listener, which listens to the thread-safe data queue, to be changed, the data for being stored in queue are taken out from the thread-safe data queue, and the data of taking-up are updated into target database.

Description

A kind of date storage method based on database
Technical field
The present invention relates to field of computer technology, and in particular to a kind of date storage method based on database.
Background technology
Basic software and hardware in the market is not mature enough, causes overall performance poor, and application system is in complete machine environment When occurring frequently accessing, exist loading slow, interim card, it is unstable phenomena such as, processing especially in terms of data storage renewal be present The problem of slow.With the development of big data, memory data output is increasing, and this problem will be further serious.
Therefore, the present situation based on operating system and hardware performance bottleneck, it is necessary to lift the support of foundational development running environment Ability, and the storage renewal of data is the important content of application system.Directly deposited when application program produces data in the prior art Store up in target database, due to directly being operated in the prior art to target database, cause database pressure bigger, Response time is long, and especially under high concurrent scene, target database pressure is bigger, when extending the response of application system Between, therefore, there is data storage with updating the problem of slow in prior art.
The content of the invention
It is an object of the invention to provide a kind of date storage method based on database, for improving target database Data updating efficiency.
In order to achieve the above object, following technical scheme as present invention use:
The present invention provides a kind of date storage method based on database, including:
Thread-safe data queue is pre-defined in the application, and determines that the thread-safe data queue is desirable The data source of monitoring;
In the application program launching, start the oracle listener pre-defined in the application program and the thread is pacified Full data queue carries out monitoring processing;
When the oracle listener, which listens to the thread-safe data queue, to be changed, from the thread-safe data team The data for being stored in queue are taken out in row, and the data of taking-up are updated into target database.
After adopting the above technical scheme, technical scheme provided by the invention will have the following advantages:
Thread-safe data queue can be monitored using oracle listener in the embodiment of the present invention, by defining thread Security data queue, it is determined that the data source monitored, oracle listener in definition application, the oracle listener can be followed using journey The real-time startup optimization of sequence, realizes the monitoring to thread-safe data queue.The present invention utilizes thread-safe data queue, it is ensured that number According to correctness so that data load according to required order, using data enqueue, and by oracle listener check queue whether Change, treatment effeciency is applied in raising, is improved and is quoted performance, improves the data updating efficiency of target database.In high concurrent In the case of, in the embodiment of the present invention not directly operate target database, but by thread-safe data queue enter heap with Pop, loss of data can be avoided.
Brief description of the drawings
Fig. 1 provides a kind of process blocks schematic diagram of the date storage method based on database for the embodiment of the present invention;
Fig. 2 is the design of monitored data queue provided in an embodiment of the present invention and the realization principle schematic diagram of method.
Embodiment
The embodiments of the invention provide a kind of date storage method based on database, for improving the number of target database According to renewal efficiency.
To enable goal of the invention, feature, the advantage of the present invention more obvious and understandable, below in conjunction with the present invention Accompanying drawing in embodiment, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that disclosed below Embodiment be only part of the embodiment of the present invention, and not all embodiments.Based on the embodiment in the present invention, this area The every other embodiment that technical staff is obtained, belongs to the scope of protection of the invention.
Term " comprising " and " having " in description and claims of this specification and above-mentioned accompanying drawing and they Any deformation, it is intended that cover it is non-exclusive include, so as to a series of process comprising units, method, system, product or set It is standby to be not necessarily limited to those units, but may include not list clearly or consolidate for these processes, method, product or equipment The other units having.
It is described in detail individually below.
One embodiment of date storage method of the invention based on database, the data that can be applied to target database are deposited In storage and more new scene, monitored data queue technology is based on data queue, by being first stored in queue, then by monitoring journey Sequence, which monitors the form whether queue changes, to be handled data, and further storage enters target database, so as to improve application The efficiency of system processing, mitigates database burden, improves application system performance.In addition, the data team that the embodiment of the present invention uses Row are thread safe queues, are not in data contamination or the inconsistent situation of data.Refer to shown in Fig. 1 and Fig. 2, this hair The date storage method based on database of bright offer, may include steps of:
101st, thread-safe data queue is pre-defined in the application, and determines that thread-safe data queue is desirable The data source of monitoring.
In embodiments of the present invention, by defining thread security data queue, it is determined that the data source monitored, thread-safe refer to Be data queue carried out by the way of thread-safe queue disengaging management, for example with the class of thread-safe, refer to class The access of interior shared global variable must assure that not to be influenceed by multithreading form.Based on multithreading access (such as Change, travel through, check) when, by thread-safe these variant structurals can be made not destroyed or be operated for these variables Atomicity be not destroyed, so as to realize thread-safe data queue.
In embodiments of the present invention, when thread-safe is exactly multi-thread access, locking mechanisms are employed, when a thread is visited When asking such some data, protected, other threads can not be conducted interviews until the thread has been read, and other threads just may be used Use.Be not in that data are inconsistent or data contamination.Dangerous thread is exactly not provide data access protection, it is possible to is gone out It is dirty data that existing multiple threads, which successively change data and cause resulting data,.
In some embodiments of the invention, application program includes:Operating system application program, or for controlling hardware The program of operation.Wherein, foregoing application program can have a variety of implementations, such as operating system application program refers to using In the application program of support operating system, and for example the application program can provide the program supported for hardware operation.
102nd, in application program launching, the oracle listener pre-defined in application program is started to thread-safe data team Row carry out monitoring processing.
In embodiments of the present invention, being pre-defined in application program has thread security data queue, in addition, the application program In it is also pre-defined have oracle listener, the oracle listener can start in real time with the startup of application program, after oracle listener starts Monitoring processing can be carried out to thread safe queues.
In some embodiments of the invention, step 102 starts in application program and pre-defined in application program launching Oracle listener monitoring processing is carried out to thread-safe data queue, including:
Pre-define in the application and apply thread for monitoring, have endless loop using definition in thread;
In application program launching, start and thread-safe data queue is carried out in fact using the endless loop defined inside thread When monitor.
Wherein, have monitoring defined in application program applies thread, and this has endless loop using definition in thread, actually should In, programming process is frequently necessary to use endless loop.For example, the window in window writing routine under the Windows operating system used Mouth is all to make the endless loop of message loop realize by one.Also often to use in single-chip microcomputer, embedded programming and extremely follow Ring.In all kinds of programming languages, method that endless loop has a variety of realizations by taking C language as an example, can use while.for respectively, Goto is realized.Endless loop is very more in systematic difference, also extremely important, and all application systems are required for setting one extremely to follow Ring ensures the normal operation of system, can be monitored in real time using endless loop in the embodiment of the present invention.
In embodiments of the present invention, thread-safe data queue can be monitored using the mode of endless loop, Endless loop can be realized by taking the resource of some application systems, while in the case of high concurrent, possible data first stores Into thread-safe data queue, then when listening to queue by the endless loop and changing, real-time storage is into target database.
The endless loop used in the embodiment of the present invention is to be one to control the program that can not be terminated, example by itself in programming Endless loop is such as realized by the while (true) of JAVA compiler languages.For the real-time monitoring of realization in the embodiment of the present invention Thread-data queue, this require a program come monitor in real time, such as in the embodiment of the present invention can also using much into Ripe timed task program can realize real-time monitoring, but need to introduce corresponding installation kit support, be appointed in addition using timing Business is more uncontrollable, so by the way of endless loop, avoids the need for introducing installation kit, it is only necessary to pre- in application thread First endless loop can is completed to monitor in real time.
103rd, when oracle listener, which listens to thread-safe data queue, to be changed, taken out from thread-safe data queue The data of queue have been stored in, and the data of taking-up have been updated into target database.
In embodiments of the present invention, thread security data queue is defined in the application, defines number in the application According to queue oracle listener, and in application program launching, start and monitor.Oracle listener checks the change of data queue in real time, and Corresponding program processing is performed in oracle listener.For example, in oracle listener, it is real that processing is carried out to specific service logic It is existing.What thread-safe data queue changed finger can be that the new data for having application program in thread-safe data queue writes, The data for being stored in queue can be now taken out from thread-safe data queue, and target data is arrived into the data renewal of taking-up In storehouse.
In some embodiments of the invention, step 103 takes out the number for being stored in queue from thread-safe data queue According to, and the data of taking-up are updated into target database, including:
Multiple packets are taken out from thread-safe data queue according to FIFO order;
Multiple packets batch of taking-up is inserted into target database simultaneously.
In the embodiment of the present invention, by defining data queue, it is determined that the data source monitored, define monitoring applies thread, Using the real-time monitored data queue of the endless loop defined inside thread, the real-time monitoring to data queue is realized, so as to reduce Database pressure, greatly promotes overall performance.Solve the problems, such as that application system data storage is slow with updating in application environment. Under high concurrent, if directly operated to database, database pressure is bigger, and the response time is long, and passes through elder generation Data queue is stored in, then inserts or update the data storehouse in batches, can be reduced the response time, mass simultaneous operating database also may be used Improving performance.The technology of the present invention advantage be even more be define thread safe queues, take thread safe queues, it is ensured that data according to Sequencing is handled, and ensures the validity of data.Data are first stored in queue, in Statistical monitoring thread to data queue Handled, without immediate operand according to storehouse, improve application system treatment effeciency, mitigate database pressure.
In some embodiments of the invention, it is provided in an embodiment of the present invention based on number in addition to performing preceding method Also include according to the date storage method in storehouse:
In application program launching, whether detection application program has exported data;
When application program output there are data, the data of output are added in thread-safe data queue.
Thread-safe data queue defined in the embodiment of the present invention, take thread-safe data queue, it can be ensured that data Handled according to sequencing, ensure the validity of data.Data are first stored in queue, in Statistical monitoring thread to data Queue is handled, and without immediate operand according to storehouse, is improved application system treatment effeciency, is mitigated database pressure.
It should be noted that, device embodiment described above is only schematical in addition, wherein described as separation The unit of part description can be or may not be it is physically separate, can be as the part that unit is shown or It can not be physical location, you can with positioned at a place, or can also be distributed on multiple NEs.Can be according to reality Border needs to select some or all of module therein to realize the purpose of this embodiment scheme.It is in addition, provided by the invention In device embodiment accompanying drawing, the annexation between module represents there is communication connection between them, specifically can be implemented as one Bar or a plurality of communication bus or signal wire.Those of ordinary skill in the art are without creative efforts, you can with Understand and implement.
Through the above description of the embodiments, it is apparent to those skilled in the art that the present invention can borrow Software is helped to add the mode of required common hardware to realize, naturally it is also possible to include application specific integrated circuit, specially by specialized hardware Realized with CPU, private memory, special components and parts etc..Generally, all functions of being completed by computer program can Easily realized with corresponding hardware, moreover, for realizing that the particular hardware structure of same function can also be a variety of more Sample, such as analog circuit, digital circuit or special circuit etc..But it is more for the purpose of the present invention in the case of software program it is real It is now more preferably embodiment.Based on such understanding, technical scheme is substantially made to prior art in other words The part of contribution can be embodied in the form of software product, and the computer software product is stored in the storage medium that can be read In, such as the floppy disk of computer, USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), random access memory Device (RAM, Random Access Memory), magnetic disc or CD etc., including some instructions are causing a computer to set Standby (can be personal computer, server, or network equipment etc.) performs the method described in each embodiment of the present invention.
In summary, the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although with reference to upper Embodiment is stated the present invention is described in detail, it will be understood by those within the art that:It still can be to upper State the technical scheme described in each embodiment to modify, or equivalent substitution is carried out to which part technical characteristic;And these Modification is replaced, and the essence of appropriate technical solution is departed from the spirit and scope of various embodiments of the present invention technical scheme.

Claims (5)

  1. A kind of 1. date storage method based on database, it is characterised in that including:
    Thread-safe data queue is pre-defined in the application, and determines that the thread-safe data queue is to need to monitor Data source;
    In the application program launching, start the oracle listener pre-defined in the application program to the thread-safe number Monitoring processing is carried out according to queue;
    When the oracle listener, which listens to the thread-safe data queue, to be changed, from the thread-safe data queue The data for being stored in queue are taken out, and the data of taking-up are updated into target database.
  2. 2. a kind of date storage method based on database according to claim 1, it is characterised in that described to be answered described When being started with program, start the oracle listener pre-defined in the application program and the thread-safe data queue is supervised Processing is listened, including:
    The thread of applying for monitoring is pre-defined in the application program, being defined in the application thread has endless loop;
    In the application program launching, start it is described using the endless loop defined inside thread to the thread-safe data team Row are monitored in real time.
  3. 3. a kind of date storage method based on database according to claim 1, it is characterised in that described from the line The data for being stored in queue are taken out in journey security data queue, and the data of taking-up are updated into target database, including:
    According to FIFO order multiple packets are taken out from the thread-safe data queue;
    Multiple packets batch of taking-up is inserted into the target database simultaneously.
  4. 4. a kind of date storage method based on database according to claim 1, it is characterised in that methods described is also wrapped Include:
    In the application program launching, detect whether the application program has exported data;
    When application program output there are data, the data of output are added in the thread-safe data queue.
  5. A kind of 5. date storage method based on database according to claim 1, it is characterised in that the application program Including:Operating system application program, or the program for controlling hardware to run.
CN201710905318.8A 2017-09-29 2017-09-29 A kind of date storage method based on database Pending CN107633087A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710905318.8A CN107633087A (en) 2017-09-29 2017-09-29 A kind of date storage method based on database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710905318.8A CN107633087A (en) 2017-09-29 2017-09-29 A kind of date storage method based on database

Publications (1)

Publication Number Publication Date
CN107633087A true CN107633087A (en) 2018-01-26

Family

ID=61104292

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710905318.8A Pending CN107633087A (en) 2017-09-29 2017-09-29 A kind of date storage method based on database

Country Status (1)

Country Link
CN (1) CN107633087A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022267837A1 (en) * 2021-06-23 2022-12-29 比亚迪股份有限公司 Data archiving method, electronic device, and readable storage medium
CN115905268A (en) * 2023-01-03 2023-04-04 北京力控元通科技有限公司 Queue-based ammeter data processing method and system and electronic equipment
CN116431688A (en) * 2022-11-14 2023-07-14 北京远舢智能科技有限公司 Data processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140075030A1 (en) * 2012-09-12 2014-03-13 salesforce.com,inc. Managing allocation of thread resources for message queues in an on-demand services environment
CN104778182A (en) * 2014-01-14 2015-07-15 博雅网络游戏开发(深圳)有限公司 Data import method and system based on HBase (Hadoop Database)
CN105187519A (en) * 2015-08-26 2015-12-23 福建星网锐捷通讯股份有限公司 Socket transmission system based on AIO
CN107122457A (en) * 2017-04-26 2017-09-01 努比亚技术有限公司 Record the method and its device, computer-readable medium of networks congestion control data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140075030A1 (en) * 2012-09-12 2014-03-13 salesforce.com,inc. Managing allocation of thread resources for message queues in an on-demand services environment
CN104778182A (en) * 2014-01-14 2015-07-15 博雅网络游戏开发(深圳)有限公司 Data import method and system based on HBase (Hadoop Database)
CN105187519A (en) * 2015-08-26 2015-12-23 福建星网锐捷通讯股份有限公司 Socket transmission system based on AIO
CN107122457A (en) * 2017-04-26 2017-09-01 努比亚技术有限公司 Record the method and its device, computer-readable medium of networks congestion control data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
传智播客高教产品研发部: "《Android项目实战-手机安全卫士》", 31 August 2015 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022267837A1 (en) * 2021-06-23 2022-12-29 比亚迪股份有限公司 Data archiving method, electronic device, and readable storage medium
CN116431688A (en) * 2022-11-14 2023-07-14 北京远舢智能科技有限公司 Data processing method and device, electronic equipment and storage medium
CN116431688B (en) * 2022-11-14 2024-05-03 北京远舢智能科技有限公司 Data processing method and device, electronic equipment and storage medium
CN115905268A (en) * 2023-01-03 2023-04-04 北京力控元通科技有限公司 Queue-based ammeter data processing method and system and electronic equipment
CN115905268B (en) * 2023-01-03 2023-09-29 北京力控元通科技有限公司 Ammeter data processing method and system based on queue and electronic equipment

Similar Documents

Publication Publication Date Title
CN109284217A (en) Application exception processing method, device, electronic equipment and storage medium
CN109918141B (en) Thread execution method, thread execution device, terminal and storage medium
CN107633087A (en) A kind of date storage method based on database
CN106775699B (en) Method and system for updating UI in asynchronous thread
US20220036241A1 (en) Method, device and storage medium for training a deep learning framework
CN111800462A (en) Micro-service instance processing method and device, computer equipment and storage medium
US9207978B2 (en) Method and system for efficient execution of ordered and unordered tasks in multi-threaded and networked computing
US8635682B2 (en) Propagating security identity information to components of a composite application
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
EP2979182B1 (en) On-demand scalable timer wheel
EP3241116A1 (en) Memory access protection using processor transactional memory support
CN111694677A (en) Message queue management method, device, terminal and computer-readable storage medium
US9582340B2 (en) File lock
EP4242842A1 (en) Thread priority adjusting method, terminal, and computer readable storage medium
US7761460B1 (en) Systems and methods that utilize a standard database interface to access data within an industrial device
WO2024022424A1 (en) System and methods for metadata services
CN110955427B (en) Self-adaptive fusion interface implementation method for desktop end software
US8949859B2 (en) Event-driven application systems and methods
CN108062224A (en) Data read-write method, device and computing device based on file handle
CN109739868B (en) Data processing method and related equipment thereof
US20240111579A1 (en) Termination of sidecar containers
US20140149781A1 (en) Method for Batch Execution of System Calls in an Operating System
US8365206B1 (en) Methods and systems for handling component-object-model communications
CN116266126A (en) Control method, device, equipment and storage medium of modal window
CN112463616A (en) Chaos testing method and device for Kubernetes container platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180126

RJ01 Rejection of invention patent application after publication