CN110879818B - Method, device, medium and electronic equipment for acquiring data - Google Patents

Method, device, medium and electronic equipment for acquiring data Download PDF

Info

Publication number
CN110879818B
CN110879818B CN201910967021.3A CN201910967021A CN110879818B CN 110879818 B CN110879818 B CN 110879818B CN 201910967021 A CN201910967021 A CN 201910967021A CN 110879818 B CN110879818 B CN 110879818B
Authority
CN
China
Prior art keywords
access
information
acquiring
access instruction
time interval
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.)
Active
Application number
CN201910967021.3A
Other languages
Chinese (zh)
Other versions
CN110879818A (en
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201910967021.3A priority Critical patent/CN110879818B/en
Publication of CN110879818A publication Critical patent/CN110879818A/en
Application granted granted Critical
Publication of CN110879818B publication Critical patent/CN110879818B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (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)

Abstract

The disclosure provides a method, an apparatus, a medium and an electronic device for acquiring data. The method applied to the coroutine comprises the following steps: acquiring an access instruction of a remote database; analyzing the access instruction based on a preset grading rule, and acquiring first grading information of the access instruction; acquiring a first access time interval parameter corresponding to the first grading information from a grading time data set; and acquiring access information from a remote database according to the access instruction based on the first access time interval parameter. The present disclosure provides a method for acquiring data to a memory at regular time by using a protocol, which solves the pressure of a database during access, reduces response delay, and improves operation efficiency.

Description

Method, device, medium and electronic equipment for acquiring data
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for acquiring data.
Background
A database is a collection of data stored together in a manner that can be shared by multiple users, has as little redundancy as possible, and is kept according to certain rules independent of the application. The user can add, inquire, update, delete and the like to the data in the file as an electronic file cabinet, namely a place for storing electronic files.
The data pulling operation on the database is actually a process of performing data query from a remote data warehouse and then storing queried data in a local for further processing. When the amount of data to be pulled is small and the number of times of pulling is large, the pressure for accessing the database is often large, so that the response is delayed, and the operation efficiency is reduced.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
An object of the present disclosure is to provide a method, an apparatus, a medium, and an electronic device for acquiring data, which can solve at least one of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for acquiring data, which is applied to coroutine processing, and includes:
acquiring an access instruction of a remote database;
analyzing the access instruction based on a preset grading rule, and acquiring first grading information of the access instruction;
acquiring a first access time interval parameter corresponding to the first grading information from a grading time data set;
and acquiring access information from a remote database according to the access instruction based on the first access time interval parameter.
According to a second aspect of the present disclosure, there is provided an apparatus for acquiring data, the apparatus including a coroutine module, the coroutine module including:
the access instruction acquisition unit is used for acquiring an access instruction of a remote database;
the analysis unit is used for analyzing the access instruction based on a preset grading rule and acquiring first grading information of the access instruction;
a first access time interval parameter acquiring unit, configured to acquire a first access time interval parameter corresponding to the first hierarchical information from a hierarchical time data set;
and the access information acquisition unit is used for acquiring access information from a remote database according to the access instruction based on the first access time interval parameter.
According to a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of acquiring data according to any of the first aspects.
According to a fourth aspect thereof, there is provided an electronic device comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out a method of acquiring data as claimed in any one of the first aspects.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects:
the disclosure provides a method, an apparatus, a medium and an electronic device for acquiring data. The method is applied to the coroutine process and comprises the following steps: acquiring an access instruction of a remote database; analyzing the access instruction based on a preset grading rule, and acquiring first grading information of the access instruction; acquiring a first access time interval parameter corresponding to the first grading information from a grading time data set; and acquiring access information from a remote database according to the access instruction based on the first access time interval parameter. The present disclosure provides a method for acquiring data to a memory at regular time by using a protocol, which solves the pressure of a database during access, reduces response delay, and improves operation efficiency.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 shows a flow diagram of a method of acquiring data according to an embodiment of the present disclosure;
FIG. 2 shows a block diagram of elements of an apparatus for acquiring data according to an embodiment of the present disclosure;
fig. 3 shows an electronic device connection structure schematic according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more complete and thorough understanding of the present disclosure. It should be understood that the drawings and the embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
A first embodiment provided for the present disclosure, namely, an embodiment of a method of acquiring data.
An embodiment of the present disclosure is described in detail below with reference to fig. 1, where fig. 1 is a flowchart of a method for acquiring data according to an embodiment of the present disclosure. The embodiment of the disclosure is applied to coroutine.
Coroutine (also called micro-thread) is also called fiber. Coroutines are similar to functions, but during execution, a function can be interrupted inside, and after the interruption, another function is executed instead, and the function is returned from the other function when appropriate and continues to be executed.
The greatest advantage of coroutines over threads is the extremely high execution efficiency of coroutines. Because the function switching is not thread switching but is controlled by the program, the performance advantage of coroutine is more obvious when the number of the function switching is larger than that of multithread without the overhead of thread switching. The second great advantage is that a lock mechanism of multiple threads is not needed, because only one thread exists, simultaneous write variable conflict does not exist, shared resources are controlled in the co-process without locking, and only the state needs to be judged, so the execution efficiency is much higher than that of multiple threads.
Because coroutine is a thread to execute, multiple processes and coroutines work cooperatively, so that multiple cores can be fully utilized, the high efficiency of the coroutine is fully exerted, and extremely high performance can be obtained.
And step S101, acquiring an access instruction of a remote database.
A database is a collection of data stored together in a manner that can be shared by multiple users, has as little redundancy as possible, and is kept according to certain rules independent of the application. The user can add, inquire, update, delete and the like to the data in the file as an electronic file cabinet, namely a place for storing electronic files.
A remote database is a database that enables interconnection and interoperation in a network environment.
The access instruction is an instruction for operating the database generated according to a preset description rule. For example, access database instructions described by the SQL language.
Step S102, analyzing the access instruction based on a preset grading rule, and acquiring first grading information of the access instruction.
That is, the access instructions are ranked according to the preset ranking rules according to the complexity of the access instructions operating the database.
The first grading information is positively correlated with the reference information. That is, the larger the number of each piece of information in the reference information, the higher the ranking. The more complex the operations on the database by the access instructions ranked higher, the longer the response time per access.
The reference information includes at least one of the following information:
the number of servers accessed by the access instruction;
the number of databases accessed by the access instruction;
the number of data tables accessed by the access instruction;
the number of logical conditions in the access instruction;
the number of operators in the access instruction.
The preset grading rule is a rule for analyzing the reference information in the access instruction and grading the access instruction according to the analysis result.
Step S103, a first access time interval parameter corresponding to the first grading information is obtained from the grading time data set.
The data set includes a data table, a configuration file, a text file, or a spreadsheet. The embodiments of the present disclosure herein do not limit the data set. The application can be carried out by those skilled in the art according to the actual situation.
The hierarchical temporal data set may be a data set stored locally or a data set stored in a remote server. The hierarchical temporal data set includes hierarchical information and corresponding access time interval parameters. Also, in the same manner as above,
in the hierarchical time data set, the hierarchical information is in a one-to-one correspondence with the access time interval parameter. The rating information is positively correlated with the reference information, and similarly, the access time interval parameter is positively correlated with the reference information.
The first access-time interval parameter is positively correlated with the reference information.
Optionally, before the obtaining of the first access time interval parameter corresponding to the first classification information from the classification time dataset, the method further includes the following steps:
step S100-1, historical access instructions, historical access time and historical response time of a plurality of pieces of second grading information are acquired from a historical information data set.
A historical information data set comprising: rating information, historical access instructions, historical access times, and historical response times.
That is, historically, every access instruction is ranked and execution information is recorded for each access instruction to access the remote database. Such as historical access time and historical response time.
There are a plurality of records in the history information data set containing the second hierarchical information. By searching the history information data set using the second classification information as the search condition, all records having the second classification information can be obtained.
Alternatively, the historical access time may be a time within a preset time threshold. For example, access times within three months prior to the current time. So as to generate an access time interval parameter satisfying the current access environment using the historical execution information closest to the current access environment.
And S100-2, analyzing the historical access instruction, the historical access time and the historical response time to generate a second access time interval parameter corresponding to the second hierarchical information.
The access instruction needs to select proper access time to access the remote database, and usually the access instruction executes access to the remote database within the access time with short response time, so that better access efficiency can be achieved.
Step S100-3, updating the hierarchical temporal data set based on the second hierarchical information and the second access time interval parameter.
Said updating said hierarchical temporal data set based on said second hierarchical information and said second access time interval parameter comprises one of:
and S100-3-1, when the second grading information does not exist in the grading time data set, inserting the second grading information and the second access time interval parameter into the grading time data set.
And S100-3-2, when second grading information exists in the grading time data set, modifying the access time interval parameter corresponding to the second grading information into a second access time interval parameter.
And step S104, acquiring access information from a remote database according to the access instruction based on the first access time interval parameter.
If the remote database is a large database, the obtained access information is usually stored in a local cache or a local database in order to reduce the number of accesses to the remote database.
The embodiments of the present disclosure provide two application scenarios for the above steps.
Scene one
The method for acquiring the access information from the remote database according to the access instruction based on the first access time interval parameter timing comprises the following steps:
and step S104-11, the access instruction is put into an access queue based on the first access time interval parameter timing.
A queue is a special linear table that is special in that it only allows delete operations at the front of the table, and insert operations at the back of the table. A queue is a linear table with restricted operations. The end performing the insert operation is called the tail of the queue, and the end performing the delete operation is called the head of the queue. The queues follow a first-in-first-out principle of operation.
And S104-12, sequentially acquiring the access instructions according to the sequence of the access queue, and acquiring access information from the remote database based on the access instructions.
When an access instruction reaches the time of accessing the remote database, the access instruction is put into a queue, so as to ensure the orderliness of accessing the remote database, reduce the pressure of accessing the remote database, reduce the delay time of accessing and improve the access efficiency.
Scene two
The method for acquiring the access information from the remote database according to the access instruction based on the first access time interval parameter comprises the following steps:
and S104-21, acquiring server information corresponding to the remote database based on the access instruction.
Wherein the remote database is a distributed database distributed among a plurality of servers, and the sub-database in each server has the same database structure as the remote database.
In this scenario, the sub-database structures in each server are the same, and are also the same as the database structure of the integrated distributed database. When accessing the distributed database, access information is actually obtained from the sub-databases of each server. For example, three servers A, B and C respectively store three sub-databases with the same database structures of a, B and C, the three sub-databases respectively store enterprise tax payment information of three regions, and the stored information of the three sub-databases forms distributed database information; when the enterprise tax payment information of three regions needs to be obtained, the access to the distributed database information is actually to obtain the enterprise tax payment information from the three sub-databases.
And S104-22, sequentially accessing the sub-databases corresponding to the server based on the server information, and acquiring the state information of each sub-database.
The status information includes idle information and busy information. When the status information of the sub-database is idle information, it indicates that better response can be obtained by accessing the sub-database. When the status information of the sub-database is busy, it indicates that accessing the sub-database will cause a response delay. The state information is regularly issued in the sub-database of each server by the monitoring process of the sub-database so as to be inquired.
And S104-23, when the state information of the sub-database is idle information, acquiring access information from the sub-database according to the access instruction.
That is, the access information obtained in the past is changed into the access information obtained by respectively accessing the sub-databases according to the states of the sub-databases storing the access information. Therefore, the pressure of accessing the remote database can be reduced, the access delay time is reduced, and the access efficiency is improved.
To prevent data errors when accessing data tables in a remote database, embodiments of the present disclosure provide a dongle for protecting data tables. Such as a read-write lock for a data table of a database.
Optionally, the obtaining access information from the remote database according to the access instruction includes the following steps:
and step S104-1, obtaining the access data table information according to the access instruction.
And step S104-2, respectively opening the protection locks for the access data tables based on the access data table information.
And step S104-3, acquiring access information from an access data table of the remote database according to the access instruction.
And step S104-4, respectively closing the protection locks on the access data tables based on the access data table information.
The protection lock is used for preventing other access instructions from accessing the data table when the access instruction accesses the data table. Thereby avoiding data errors.
The embodiment of the disclosure provides a method for acquiring data to a memory at regular time by using a protocol, so that the pressure of a database during access is solved, the response delay is reduced, and the operation efficiency is improved.
Corresponding to the first embodiment provided by the present disclosure, the present disclosure also provides a second embodiment, that is, an apparatus for acquiring data. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 2 shows an embodiment of an apparatus for acquiring data provided by the present disclosure. Fig. 2 is a block diagram of units of an apparatus for acquiring data according to an embodiment of the present disclosure.
Referring to fig. 2, the present disclosure provides an apparatus for acquiring data, the apparatus including an coroutine module, the coroutine module including: an access instruction acquiring unit 201, an analyzing unit 202, an access time interval parameter acquiring unit 203, and an access information acquiring unit 204.
An access instruction acquisition unit 201, configured to acquire an access instruction of a remote database;
the analysis unit 202 is configured to analyze the access instruction based on a preset classification rule, and obtain first classification information of the access instruction;
a first access time interval parameter obtaining unit 203, configured to obtain a first access time interval parameter corresponding to the first classification information from the classification time dataset;
an obtaining access information unit 204, configured to obtain access information from a remote database according to the access instruction at regular time based on the first access time interval parameter.
Optionally, the first classification information or the corresponding first access time interval parameter is positively correlated with the reference information; the reference information includes at least one of the following information:
the number of servers accessed by the access instruction;
the number of databases accessed by the access instruction;
the number of data tables accessed by the access instruction;
the number of logical conditions in the access instruction;
the number of operators in the access instruction.
Optionally, in the apparatus, the apparatus further includes: updating the hierarchical temporal data set unit;
in the generating hierarchical temporal data set unit, comprising:
the obtaining historical information subunit is used for obtaining historical access instructions, historical access time and historical response time of a plurality of pieces of second hierarchical information from the historical information data set;
the historical information analysis subunit is used for analyzing the historical access instruction, the historical access time and the historical response time to generate a second access time interval parameter corresponding to the second grading information;
an update hierarchical time data set subunit operable to update the hierarchical time data set based on the second hierarchical information and the second access time interval parameter.
Optionally, the unit 204 for obtaining access information includes:
an access queue placing subunit, configured to place the access instruction into an access queue based on the first access time interval parameter at regular time;
and the first access information acquiring subunit is used for sequentially acquiring the access instructions according to the sequence of the access queue and acquiring access information from the remote database based on the access instructions.
Optionally, the unit 204 for obtaining access information includes:
the server information acquisition subunit is used for acquiring server information corresponding to the remote database based on the access instruction; wherein the remote database is a distributed database distributed among a plurality of servers, and the sub-database in each server has the same database structure as the remote database.
The state information obtaining subunit is used for sequentially accessing the sub-databases corresponding to the server based on the server information and obtaining the state information of each sub-database;
and the second access information acquiring subunit is configured to acquire, when the state information of the sub-database is idle information, access information from the sub-database according to the access instruction.
Optionally, the unit 204 for obtaining access information includes:
the access data table information acquiring subunit is used for acquiring access data table information according to the access instruction;
the protection lock opening subunit is used for respectively opening protection locks on the access data tables based on the access data table information;
the third access information obtaining subunit is used for obtaining access information from an access data table of the remote database according to the access instruction;
and the closing protection lock subunit is used for respectively closing the protection locks on the access data tables based on the access data table information.
The embodiment of the disclosure provides a method for acquiring data to a memory at regular time by using a protocol, so that the pressure of a database during access is solved, the response delay is reduced, and the operation efficiency is improved.
The third embodiment of the present disclosure provides an electronic device, where the electronic device is used for a method for acquiring data, and the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of acquiring data as described in the first embodiment.
The fourth embodiment of the present disclosure provides a computer storage medium for acquiring data, where the computer storage medium stores computer-executable instructions that can execute the method for acquiring data as described in the first embodiment.
Referring now to FIG. 3, shown is a block diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 3, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage device 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and the technical features disclosed in the present disclosure (but not limited to) having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (8)

1. A method for acquiring data is applied to coroutines, and is characterized by comprising the following steps:
acquiring an access instruction of a remote database;
analyzing the access instruction based on a preset grading rule, and acquiring first grading information of the access instruction;
acquiring a first access time interval parameter corresponding to the first grading information from a grading time data set;
acquiring access information from a remote database according to the access instruction based on the first access time interval parameter at regular time; the first grading information or the corresponding first access time interval parameter is positively correlated with the reference information in the access instruction;
the reference information includes at least one of the following information:
the number of servers accessed by the access instruction;
the number of databases accessed by the access instruction;
the number of data tables accessed by the access instruction;
the number of logical conditions in the access instruction;
the number of operators in the access instruction;
before the obtaining of the first access time interval parameter corresponding to the first classification information from the classification time data set, the method further includes:
acquiring historical access instructions, historical access time and historical response time of a plurality of pieces of second hierarchical information from a historical information data set;
analyzing the historical access instruction, the historical access time and the historical response time to generate a second access time interval parameter corresponding to the second grading information;
updating the hierarchical temporal data set based on the second hierarchical information and the second access time interval parameter.
2. The method of claim 1, wherein said timing the obtaining of access information from a remote database according to the access instruction based on the first access time interval parameter comprises:
periodically placing the access instruction in an access queue based on the first access time interval parameter;
and sequentially acquiring the access instructions according to the sequence of the access queue, and acquiring access information from the remote database based on the access instructions.
3. The method of claim 1, wherein said timing the obtaining of access information from a remote database according to the access instruction based on the first access time interval parameter comprises:
obtaining server information corresponding to a remote database based on the access instruction; the remote database is a distributed database distributed in a plurality of servers, and the sub-database in each server and the remote database have the same database structure;
sequentially accessing sub-databases corresponding to the server based on the server information to acquire the state information of each sub-database;
and when the state information of the sub-database is idle information, acquiring access information from the sub-database according to the access instruction.
4. The method according to any one of claims 1-3, further comprising, prior to said obtaining access information from a remote database according to said access instruction:
acquiring access data table information according to the access instruction;
and respectively opening the protection locks for the access data tables based on the access data table information.
5. The method of claim 4, further comprising, after said obtaining access information from a remote database according to said access instruction:
and respectively closing the protection locks for the access data tables based on the access data table information.
6. An apparatus for obtaining data, the apparatus comprising a coroutine module, the coroutine module comprising:
the access instruction acquisition unit is used for acquiring an access instruction of a remote database;
the analysis unit is used for analyzing the access instruction based on a preset grading rule and acquiring first grading information of the access instruction;
a first access time interval parameter acquiring unit, configured to acquire a first access time interval parameter corresponding to the first hierarchical information from a hierarchical time data set;
the access information acquisition unit is used for acquiring access information from a remote database according to the access instruction at regular time based on the first access time interval parameter; the first grading information or the corresponding first access time interval parameter is positively correlated with the reference information in the access instruction;
the reference information includes at least one of the following information:
the number of servers accessed by the access instruction;
the number of databases accessed by the access instruction;
the number of data tables accessed by the access instruction;
the number of logical conditions in the access instruction;
the number of operators in the access instruction;
the obtain first access time interval parameter unit is further configured to: before the first access time interval parameter corresponding to the first grading information is obtained from the grading time data set, obtaining historical access instructions, historical access time and historical response time of a plurality of pieces of second grading information from a historical information data set; analyzing the historical access instruction, the historical access time and the historical response time to generate a second access time interval parameter corresponding to the second grading information; updating the hierarchical temporal data set based on the second hierarchical information and the second access time interval parameter.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
8. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 5.
CN201910967021.3A 2019-10-12 2019-10-12 Method, device, medium and electronic equipment for acquiring data Active CN110879818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910967021.3A CN110879818B (en) 2019-10-12 2019-10-12 Method, device, medium and electronic equipment for acquiring data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910967021.3A CN110879818B (en) 2019-10-12 2019-10-12 Method, device, medium and electronic equipment for acquiring data

Publications (2)

Publication Number Publication Date
CN110879818A CN110879818A (en) 2020-03-13
CN110879818B true CN110879818B (en) 2022-11-18

Family

ID=69727732

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910967021.3A Active CN110879818B (en) 2019-10-12 2019-10-12 Method, device, medium and electronic equipment for acquiring data

Country Status (1)

Country Link
CN (1) CN110879818B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984645B (en) * 2020-07-29 2023-11-24 北京字节跳动网络技术有限公司 Data processing method, device, medium and electronic equipment

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030130899A1 (en) * 2002-01-08 2003-07-10 Bruce Ferguson System and method for historical database training of non-linear models for use in electronic commerce
JP5521716B2 (en) * 2010-04-06 2014-06-18 富士通株式会社 Storage control program, storage control method, and storage control apparatus
JP5589932B2 (en) * 2011-03-31 2014-09-17 富士通株式会社 Information providing program, information providing apparatus, and information providing method
CN103177035A (en) * 2011-12-26 2013-06-26 中国银联股份有限公司 Data query device and data query method in data base
CN105554544B (en) * 2015-12-07 2018-11-09 海信集团有限公司 A kind of data processing method and system
CN108345594A (en) * 2017-01-22 2018-07-31 中国移动通信集团安徽有限公司 Control method, control device and the control system of database access request
US11030195B2 (en) * 2018-01-18 2021-06-08 Fmr Llc Identifying and mitigating high-risk database queries through ranked variance analysis
CN109710615B (en) * 2018-12-29 2021-08-03 江苏满运软件科技有限公司 Database access management method, system, electronic device and storage medium
CN110008393B (en) * 2018-12-29 2023-03-07 义语智能科技(上海)有限公司 Method and equipment for acquiring website information
CN109871388A (en) * 2019-02-19 2019-06-11 北京字节跳动网络技术有限公司 Data cache method, device, whole electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110879818A (en) 2020-03-13

Similar Documents

Publication Publication Date Title
CN109189835B (en) Method and device for generating data wide table in real time
CN108629029B (en) Data processing method and device applied to data warehouse
CN112307037A (en) Data synchronization method and device
CN112948486B (en) Batch data synchronization method and system and electronic equipment
CN108363741B (en) Big data unified interface method, device, equipment and storage medium
CN111125107A (en) Data processing method, device, electronic equipment and medium
CN113704291A (en) Data query method and device, storage medium and electronic equipment
CN110909022A (en) Data query method and device
CN112035529A (en) Caching method and device, electronic equipment and computer readable storage medium
CN110019310A (en) Data processing method and system, computer system, computer readable storage medium
US10866960B2 (en) Dynamic execution of ETL jobs without metadata repository
CN111400625A (en) Page processing method and device, electronic equipment and computer readable storage medium
CN111881216A (en) Data acquisition method and device based on shared template
CN111241137A (en) Data processing method and device, electronic equipment and storage medium
CN110879818B (en) Method, device, medium and electronic equipment for acquiring data
CN114490050A (en) Data synchronization method and device
US20170277751A1 (en) Optimizing searches
CN113722007B (en) Configuration method, device and system of VPN branch equipment
CN113076067B (en) Method and device for eliminating cache data
CN112115154A (en) Data processing and data query method, device, equipment and computer readable medium
CN113760890A (en) Relational database management method and apparatus
CN113779048A (en) Data processing method and device
CN111143464A (en) Data acquisition method and device and electronic equipment
US11586604B2 (en) In-memory data structure for data access
CN111209042B (en) Method, device, medium and electronic equipment for establishing function stack

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant