CN109344157A - Read and write abruption method, apparatus, computer equipment and storage medium - Google Patents

Read and write abruption method, apparatus, computer equipment and storage medium Download PDF

Info

Publication number
CN109344157A
CN109344157A CN201811099085.8A CN201811099085A CN109344157A CN 109344157 A CN109344157 A CN 109344157A CN 201811099085 A CN201811099085 A CN 201811099085A CN 109344157 A CN109344157 A CN 109344157A
Authority
CN
China
Prior art keywords
data
request
read
database
rule
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.)
Withdrawn
Application number
CN201811099085.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.)
Shenzhen Dingfeng Cattle Technology Co Ltd
Original Assignee
Shenzhen Dingfeng Cattle 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 Shenzhen Dingfeng Cattle Technology Co Ltd filed Critical Shenzhen Dingfeng Cattle Technology Co Ltd
Priority to CN201811099085.8A priority Critical patent/CN109344157A/en
Publication of CN109344157A publication Critical patent/CN109344157A/en
Withdrawn legal-status Critical Current

Links

Landscapes

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

Abstract

The embodiment of the invention discloses a kind of read and write abruption method, apparatus, computer equipment and storage mediums.The described method includes: receiving the request of data of application program by middleware;According to the default database for dividing rule selection in library to execute the request of data;If the request of data is write-in request of data, table rule is divided to write data into the table of primary database according to default;And if the request of data is to read request of data, divides table rule to read data in the table from database read data are back to the application program according to default.Method by implementing the embodiment of the present invention can realize read and write abruption, improve the high concurrent read-write efficiency of database.

Description

Read and write abruption method, apparatus, computer equipment and storage medium
Technical field
The present invention relates to technical field of data processing more particularly to a kind of read and write abruption method, apparatus, computer equipment and Storage medium.
Background technique
With the development of information and science and technology, technology progress with rapid changepl. never-ending changes and improvements, the growth of information explosion type can all generate daily The data of flood tide require the data of processing flood tide daily.For new online system, early period portfolio and user volume all In the case where less, most of companies can all select single list inventory to put corresponding data information, can mention to the greatest extent in this way High development rate reduces the dispersion of exploitation attention, but with the rising of the continuous development of system and user volume, single library list table Structure will become system bottleneck.Especially in Internet era, the read-write of high concurrent allows database can't bear the heavy load, low efficiency Under.
Summary of the invention
The embodiment of the invention provides a kind of read and write abruption method, apparatus, computer equipment and storage mediums, it is intended to solve The low problem of database high concurrent read-write efficiency.
In a first aspect, the embodiment of the invention provides a kind of read and write abruption methods comprising: it is received and is applied by middleware The request of data of program;According to the default database for dividing rule selection in library to execute the request of data;If the request of data is Request of data is written, divides table rule to write data into the table of primary database according to default;And if the request of data is Request of data is read, divides table rule to read data in the table from database read data are back to institute according to default State application program.
Second aspect, the embodiment of the invention also provides a kind of read and write abruption devices comprising: receiving unit, for leading to Cross the request of data that middleware receives application program;Selecting unit, for dividing rule selection in library to execute the data according to default The database of request;Writing unit divides table rule by data if being write-in request of data for the request of data according to default It is written in the table of primary database;Reading unit divides table to advise if being to read request of data for the request of data according to default Data are read in the table from database then read data are back to the application program.
The third aspect, the embodiment of the invention also provides a kind of computer equipments comprising memory and processor, it is described Computer program is stored on memory, the processor realizes the above method when executing the computer program.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage medium, the storage medium storage There is computer program, the computer program can realize the above method when being executed by a processor.
The embodiment of the invention provides a kind of read and write abruption method, apparatus, computer equipment and storage mediums.Wherein, institute The method of stating includes: that the request of data of application program is received by middleware;Rule selection in library is divided to execute the data according to default The database of request;If the request of data is write-in request of data, table rule is divided to write data into master data according to default In the table in library;And if the request of data is to read request of data, divides table rule to read in the table from database according to default Read data are back to the application program accordingly by access.The embodiment of the present invention due to application program by middleware with Database interacts, it can be achieved that read and write abruption, improves the high concurrent read-write efficiency of database.
Detailed description of the invention
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, general for this field For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the application scenarios schematic diagram of read and write abruption method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of read and write abruption method provided in an embodiment of the present invention;
Fig. 3 is the sub-process schematic diagram of read and write abruption method provided in an embodiment of the present invention;
Fig. 4 is the sub-process schematic diagram of read and write abruption method provided in an embodiment of the present invention;
Fig. 5 be another embodiment of the present invention provides read and write abruption method flow diagram;
Fig. 6 is the schematic block diagram of read and write abruption device provided in an embodiment of the present invention;
Fig. 7 is the schematic block diagram of the specific unit of read and write abruption device provided in an embodiment of the present invention;
Fig. 8 be another embodiment of the present invention provides read and write abruption device schematic block diagram;And
Fig. 9 is the schematic block diagram of computer equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts Example, shall fall within the protection scope of the present invention.
It should be appreciated that ought use in this specification and in the appended claims, term " includes " and "comprising" instruction Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded Body, step, operation, the presence or addition of element, component and/or its set.
It is also understood that mesh of the term used in this description of the invention merely for the sake of description specific embodiment And be not intended to limit the present invention.As description of the invention and it is used in the attached claims, unless on Other situations are hereafter clearly indicated, otherwise " one " of singular, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in description of the invention and the appended claims is Refer to any combination and all possible combinations of one or more of associated item listed, and including these combinations.
Fig. 1 and Fig. 2 are please referred to, Fig. 1 is the application scenarios schematic diagram of read and write abruption method provided in an embodiment of the present invention.Figure 2 be the schematic flow chart of read and write abruption method provided in an embodiment of the present invention.The present invention applies in server 20, passes through clothes Realization is interacted between business device 20 and terminal 10.
The present invention is realized based on ORM frame, and ORM frame refers to that Object Relational Database maps, and effect is Establish the mapping relations between the relational data in object and database in program.
Fig. 2 is the flow diagram of read and write abruption method provided in an embodiment of the present invention.As shown, this method include with Lower step S110-140.
S110, the request of data that application program is received by middleware.
In one embodiment, middleware refers to Sharding-JDBC, is the database middleware of lightweight, with Jar Packet form provides service, divides table access for realizing database point library.In the present embodiment, middleware and application deployment exist Together, in this way it is possible to prevente effectively from Single Point of Faliure and performance bottleneck, get bigger performance with shorter calling link, no It is also just lower with probability interactional between business.Wherein, JDBC is a kind of for executing the Java interface of SQL statement, can To provide unified access for a variety of relational databases.Since middleware encapsulates JDBC interface, allow middleware and data The sentence and processing result that library establishes connection, sends operating database.ORM frame is also to be interacted using JDBC with database , based on ORM frame by call JDBC interface more library multilists can be regarded single library list table come using.In the present embodiment, Application program is run in the terminal, and application program establishes the connection with database by calling middleware to access database, Request of data is sent to server by middleware by application program, executes the request of data in the server.Specifically, when answering When initiating request of data with program, the data access layer between the operation layer and data Layer of middleware is solved by Druid first Analyse request of data, resolver of the Druid as middleware, for carrying out SQL parsing to request of data;Then after having parsed again into Request of data is navigated to data source by row SQL routing, is finally executed SQL again and is executed the request of data.
The default database for dividing rule selection in library to execute the request of data of S120, basis.
In one embodiment, different operation systems has different request of data, and the write-in of some system datas is much more In reading data, for example, Message Entry System;And some system datas are read more than data write-in for example, Flight Information is shown System, different operation systems are also not quite similar for the requirement of real-time of data.Therefore, in order to meet for different business It is required that dividing library rule by the request of data cutting of database to be primary database and from database, primary database conduct according to default The write-in node of data is synchronized to by the active and standby function of database from database.Middleware road is passed through for data write operation By to primary database, the business scenario of less demanding for real-time property is routed to by middleware from database, such industry Business pressure will share in multiple databases, to reduce, delay machine occurs for Database Systems and causes the risk that business is paralysed. In the present embodiment, divide on library in specific database, it is right using weight random algorithm since the performance of database is inconsistent The amount of access of each database distribution distributes weight according to performance.Such as: there are A, B, C, D database, performance is successively successively decreased.When When request of data comes, need therefrom to extract one, but the probability extracted is different, wherein the probability for being extracted into A is 40%, B's It is the probability of 20%, D is 10% that probability, which is the probability of 30%, C,.It, can be with of course, it should be understood that in other embodiments It is other default point of library rule.
If S130, the request of data are write-in request of data, table rule is divided to write data into master data according to default In the table in library.
In one embodiment, as the continuous accumulation of data precipitates, since database performance limits, single table is reaching certain Database performance bottleneck will be become when the data of amount.In order to solve this performance issue, needs to be split into single table and patrol Collect identical multiple sublists.Such as: it is split according to the date, every month is in a tables of data or every 10 days at one In tables of data;In another example being split according to User ID, by User ID according to 1024 modulus, user's table t_user can be split as T_user_0001, t_user_0002...t_user_1024 have 1024 tables altogether, and the data of such user can be distributed in In 1024 tables of data, reduce the data volume of database manipulation.Of course, it should be understood that can also be that others divide table to advise Then.Specifically, if default divide table rule to be to split by date, current date is August part, then receiving write-in request of data Afterwards, it writes data into the tables of data of August part.
In one embodiment, as shown in figure 3, the step S130 may include step: S131-S132.
S131, the corresponding unique major key of data is generated according to default extension set major key rule.
In one embodiment, major key is a field in table, its value is used to uniquely identify a certain item note in table Record.After dividing table point library due to database execution, originally sequence used in single library list table from increase ID can not be further continued for using, because This needs default extension set major key rule to generate major key.In the present embodiment, using be based on the unique major key generating mode of database, Principle that is specific that Snowflake algorithm is relied on to realize, realizing are as follows: Snowflake is that the distributed ID of Twitter open source is generated Algorithm generates the ID the result is that a long type.Its core concept is: using 41bit as millisecond number, 10bit is as machine ID (wherein 5 bit are data center, the machine ID of 5 bit), 12bit (means each as the serial number in millisecond Node can produce 4096 ID at every millisecond), it is 0 forever that last there are one sign bits.
S132, table rule is divided to be written in corresponding table according to default the data and its major key in primary database.
In one embodiment, after the major key for generating data, divide table rule that the major key of data and data is written according to default Into corresponding table.It is default that table rule is divided to be to split by date and current for example, request of data is the purchase order that user is written Date is August part, first according to extension set major key rule generation order number is preset, is then written to order number and the purchase order In the tables of data of August part.
If S140, the request of data are to read request of data, table rule is divided to read in the table from database according to default Read data are back to the application program accordingly by access.
In one embodiment, as shown in figure 4, the step S140 is comprising steps of S141-S143.
If S141, the request of data are to read request of data, the type for reading request of data is judged.
In one embodiment, after the reading request of data for receiving application program, it is necessary first to judge that the reading data are asked The type asked determines that the reading request of data reads request of data for single table if the reading request of data is single table inquiry;If The read requests are multi-table query, then determine that the reading request of data reads request of data for multilist.
If S142, the reading request of data are that single table reads request of data, divide table rule from database according to default The middle table to be inquired of positioning, which is inquired, is back to application program with the query result that will be obtained.
In one embodiment, single table, which reads request of data directly basis and presets, divides table rule query data to return to using journey Sequence.For example, default divide table rule to be to split by date, it is to read the purchase order of Zhang San's August part that single table, which reads request of data, first It is first inquired according in the default tables of data for dividing table rule to be located in August part, is then according to the major key that purchase order generates Order number searches the purchase order of Zhang San's August part in the tables of data of August part, and query result is finally returned to application program.
If S143, the reading request of data are that multilist reads request of data, according to preset data merger rule from number Merger is carried out according to inquiry data in multiple tables in library and by data obtained query result is back to application program.
In one embodiment, since tables of data is split into multiple points of tables, data distribution is divided in table in different.Work as data When request needs to read data from multiple points of tables, it is necessary to inquire multiple points of tables and carry out aggregation of data later.It is opened for example, reading 38 arrive September part purchase order, first according to preset data merger rule be located in the tables of data of August part and September part into Row inquiry, the major key, that is, order number then generated according to purchase order is respectively in the tables of data of August part and the tables of data of September part The purchase order for searching Zhang San, finally returns to application program for the query result merger of August part and September part again.
In one embodiment, as shown in figure 5, after the S140, further includes: S150
S150, according to preset cache rule by the middleware by data buffer storage into key value database.
In one embodiment, for having the hot spot data of frequent query requirement, such as the function of items list and online number Can request volume index to rise as user volume rises.Frequent query actions can make Database Systems response drop It is low, become traffic bottleneck.In the present embodiment, the mode of caching is sampled to solve the problems, such as the frequent inquiry of hot spot data.In Between part combination key value database realize data buffer storage function, data are cached in key value database by middleware.Wherein key Value Data library refers to redis, is key-value pair storing data library, for storing the data for the reading that needs to take place frequently, has read-write It is high-efficient, the characteristics of persistence.Application program is when reading data, if the data to be read have been stored in key value database In be then directly returned to application program;It can be looked into the database if there is no the data to be read in key value database It askes, by this way much lower data base querying number.In the present embodiment, preset cache rule is LFU (Least Frequently Used) algorithm, data are eliminated according to the history access frequency of data.Specifically, all data have one Reference count, all data blocks sort according to reference count, and the data with same reference counting are then according to time-sequencing, first New data is inserted into chained list head, then whenever cache hit, that is, data cached is accessed, then moves the data to chained list head, Finally when chained list is full, the data of chained list tail portion are abandoned.Of course, it should be understood that can also be LRU-K algorithm, again Either other preset cache rules.
A kind of read and write abruption method that the embodiment of the present invention is shown receives the request of data of application program by middleware;Root According to the default database for dividing rule selection in library to execute the request of data;If the request of data is write-in request of data, according to It is default that table rule is divided to write data into the table of primary database;If the request of data is to read request of data, according to default Divide table rule to read data in the table from database read data are back to the application program, may be implemented to read Separation is write, the high concurrent read-write efficiency of database is improved.
Fig. 6 is a kind of schematic block diagram of read and write abruption device 200 provided in an embodiment of the present invention.As shown in fig. 6, corresponding In the above read and write abruption method, the present invention also provides a kind of read and write abruption devices 200.The read and write abruption device 200 includes being used for Execute the unit of above-mentioned read and write abruption method, the device can be configured in desktop computer, tablet computer, laptop computer, etc. eventually In end.Specifically, referring to Fig. 6, the read and write abruption device 200 includes receiving unit 210, selecting unit 220, writing unit 230 and reading unit 240.
Receiving unit 210, for receiving the request of data of application program by middleware.
In one embodiment, middleware refers to Sharding-JDBC, is the database middleware of lightweight, with Jar Packet form provides service, divides table access for realizing database point library.In the present embodiment, middleware and application deployment exist Together, in this way it is possible to prevente effectively from Single Point of Faliure and performance bottleneck, get bigger performance with shorter calling link, no It is also just lower with probability interactional between business.Wherein, JDBC is a kind of for executing the Java interface of SQL statement, can To provide unified access for a variety of relational databases.Since middleware encapsulates JDBC interface, allow middleware and data The sentence and processing result that library establishes connection, sends operating database.ORM frame is also to be interacted using JDBC with database , based on ORM frame by call JDBC interface more library multilists can be regarded single library list table come using.In the present embodiment, Application program is run in the terminal, and application program establishes the connection with database by calling middleware to access database, Request of data is sent to server by middleware by application program, executes the request of data in the server.Specifically, when answering When initiating request of data with program, the data access layer between the operation layer and data Layer of middleware is solved by Druid first Analyse request of data, resolver of the Druid as middleware, for carrying out SQL parsing to request of data;Then after having parsed again into Request of data is navigated to data source by row SQL routing, is finally executed SQL again and is executed the request of data.
Selecting unit 220, for according to the default database for dividing rule selection in library to execute the request of data.
In one embodiment, different operation systems has different request of data, and the write-in of some system datas is much more In reading data, for example, Message Entry System;And some system datas are read more than data write-in for example, Flight Information is shown System, different operation systems are also not quite similar for the requirement of real-time of data.Therefore, in order to meet for different business It is required that dividing library rule by the request of data cutting of database to be primary database and from database, primary database conduct according to default The write-in node of data is synchronized to by the active and standby function of database from database.Middleware road is passed through for data write operation By to primary database, the business scenario of less demanding for real-time property is routed to by middleware from database, such industry Business pressure will share in multiple databases, to reduce, delay machine occurs for Database Systems and causes the risk that business is paralysed. In the present embodiment, divide on library in specific database, it is right using weight random algorithm since the performance of database is inconsistent The amount of access of each database distribution distributes weight according to performance.Such as: there are A, B, C, D database, performance is successively successively decreased.When When request of data comes, need therefrom to extract one, but the probability extracted is different, wherein the probability for being extracted into A is 40%, B's It is the probability of 20%, D is 10% that probability, which is the probability of 30%, C,.It, can be with of course, it should be understood that in other embodiments It is other default point of library rule.
Writing unit 230 divides table rule to write data if being write-in request of data for the request of data according to default Enter into the table of primary database.
In one embodiment, as the continuous accumulation of data precipitates, since database performance limits, single table is reaching certain Database performance bottleneck will be become when the data of amount.In order to solve this performance issue, needs to be split into single table and patrol Collect identical multiple sublists.Such as: it is split according to the date, every month is in a tables of data or every 10 days at one In tables of data;In another example being split according to User ID, by User ID according to 1024 modulus, user's table t_user can be split as T_user_0001, t_user_0002...t_user_1024 have 1024 tables altogether, and the data of such user can be distributed in In 1024 tables of data, reduce the data volume of database manipulation.Of course, it should be understood that can also be that others divide table to advise Then.Specifically, if default divide table rule to be to split by date, current date is August part, then receiving write-in request of data Afterwards, it writes data into the tables of data of August part.
In one embodiment, as shown in fig. 7, said write unit may include subelement: generation unit 231 and write-in Unit 232.
Generation unit 231, for generating the corresponding unique major key of data according to default extension set major key rule.
In one embodiment, major key is a field in table, its value is used to uniquely identify a certain item note in table Record.After dividing table point library due to database execution, originally sequence used in single library list table from increase ID can not be further continued for using, because This needs default extension set major key rule to generate major key.In the present embodiment, using be based on the unique major key generating mode of database, Principle that is specific that Snowflake algorithm is relied on to realize, realizing are as follows: Snowflake is that the distributed ID of Twitter open source is generated Algorithm generates the ID the result is that a long type.Its core concept is: using 41bit as millisecond number, 10bit is as machine ID (wherein 5 bit are data center, the machine ID of 5 bit), 12bit (means each as the serial number in millisecond Node can produce 4096 ID at every millisecond), it is 0 forever that last there are one sign bits.
Subelement 232 is written, for dividing table rule to be written according to default the data and its major key in primary database Into corresponding table.
In one embodiment, after the major key for generating data, divide table rule that the major key of data and data is written according to default Into corresponding table.It is default that table rule is divided to be to split by date and current for example, request of data is the purchase order that user is written Date is August part, first according to extension set major key rule generation order number is preset, is then written to order number and the purchase order In the tables of data of August part.
Reading unit 240 divides table rule from data if being to read request of data for the request of data according to default Data are read in the table in library so that read data are back to the application program.
In one embodiment, as shown in fig. 7, the reading unit 240 includes subelement: judging unit 241, query unit 242 and Merging unit 243.
Judging unit 241 judges the class for reading request of data if being to read request of data for the request of data Type.
In one embodiment, after the reading request of data for receiving application program, it is necessary first to judge that the reading data are asked The type asked determines that the reading request of data reads request of data for single table if the reading request of data is single table inquiry;If The read requests are multi-table query, then determine that the reading request of data reads request of data for multilist.
Query unit 242 divides table regular if being that single table reads request of data for the reading request of data according to default It is inquired positioning the table to be inquired from database obtained query result is back to application program.
In one embodiment, single table, which reads request of data directly basis and presets, divides table rule query data to return to using journey Sequence.For example, default divide table rule to be to split by date, it is to read the purchase order of Zhang San's August part that single table, which reads request of data, first It is first inquired according in the default tables of data for dividing table rule to be located in August part, is then according to the major key that purchase order generates Order number searches the purchase order of Zhang San's August part in the tables of data of August part, and query result is finally returned to application program.
Merging unit 243, if being that multilist reads request of data for the reading request of data, according to preset data merger Rule inquires data in multiple tables from database and data is carried out merger so that obtained query result is back to application Program.
In one embodiment, since tables of data is split into multiple points of tables, data distribution is divided in table in different.Work as data When request needs to read data from multiple points of tables, it is necessary to inquire multiple points of tables and carry out aggregation of data later.It is opened for example, reading 38 arrive September part purchase order, first according to preset data merger rule be located in the tables of data of August part and September part into Row inquiry, the major key, that is, order number then generated according to purchase order is respectively in the tables of data of August part and the tables of data of September part The purchase order for searching Zhang San, finally returns to application program for the query result merger of August part and September part again.
In one embodiment, as shown in figure 8, the read and write abruption device further include: cache unit 250.
Cache unit 250, for according to preset cache rule by the middleware by data buffer storage to key value database In.
In one embodiment, for having the hot spot data of frequent query requirement, such as the function of items list and online number Can request volume index to rise as user volume rises.Frequent query actions can make Database Systems response drop It is low, become traffic bottleneck.In the present embodiment, the mode of caching is sampled to solve the problems, such as the frequent inquiry of hot spot data.In Between part combination key value database realize data buffer storage function, data are cached in key value database by middleware.Wherein key Value Data library refers to redis, is key-value pair storing data library, for storing the data for the reading that needs to take place frequently, has read-write It is high-efficient, the characteristics of persistence.Application program is when reading data, if the data to be read have been stored in key value database In be then directly returned to application program;It can be looked into the database if there is no the data to be read in key value database It askes, by this way much lower data base querying number.In the present embodiment, preset cache rule is LFU (Least Frequently Used) algorithm, data are eliminated according to the history access frequency of data.Specifically, all data have one Reference count, all data blocks sort according to reference count, and the data with same reference counting are then according to time-sequencing, first New data is inserted into chained list head, then whenever cache hit, that is, data cached is accessed, then moves the data to chained list head, Finally when chained list is full, the data of chained list tail portion are abandoned.Of course, it should be understood that can also be LRU-K algorithm, again Either other preset cache rules.
A kind of read and write abruption device that the embodiment of the present invention is shown receives the request of data of application program by middleware;Root According to the default database for dividing rule selection in library to execute the request of data;If the request of data is write-in request of data, according to It is default that table rule is divided to write data into the table of primary database;If the request of data is to read request of data, according to default Divide table rule to read data in the table from database read data are back to the application program, may be implemented to read Separation is write, the high concurrent read-write efficiency of database is improved.
Above-mentioned reading separator can be implemented as a kind of form of computer program, which can such as scheme It is run in computer equipment shown in 9.
Referring to Fig. 9, Fig. 9 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.The computer Equipment 500 can be server, wherein server can be independent server, be also possible to the clothes of multiple server compositions Business device cluster.
Refering to Fig. 9, which includes processor 502, memory and the net connected by system bus 501 Network interface 505, wherein memory may include non-volatile memory medium 503 and built-in storage 504.
The non-volatile memory medium 503 can storage program area 5031 and computer program 5032.The computer program 5032 include program instruction, which is performed, and processor 502 may make to execute a kind of read and write abruption method.
The processor 502 is for providing calculating and control ability, to support the operation of entire computer equipment 500.
The built-in storage 504 provides environment for the operation of the computer program 5032 in non-volatile memory medium 503, should When computer program 5032 is executed by processor 502, processor 502 may make to execute a kind of read and write abruption method.
The network interface 505 is used to carry out network communication with other equipment.It will be understood by those skilled in the art that in Fig. 9 The structure shown, only the block diagram of part-structure relevant to application scheme, does not constitute and is applied to application scheme The restriction of computer equipment 500 thereon, specific computer equipment 500 may include more more or fewer than as shown in the figure Component perhaps combines certain components or with different component layouts.
Wherein, the processor 502 is for running computer program 5032 stored in memory, to realize following step It is rapid: the request of data of application program is received by middleware;According to the default number for dividing rule selection in library to execute the request of data According to library;If the request of data is write-in request of data, table rule is divided to write data into the table of primary database according to default; If the request of data is to read request of data, table rule is divided to read data in the table from database will be read according to default The data taken are back to the application program.
In one embodiment, processor 502 is preset in the realization basis divides table rule to write data into primary database Table in step when, be implemented as follows step: the corresponding unique major key of data generated according to default extension set major key rule;In master Table rule is divided to be written in corresponding table according to default the data and its major key in database
In one embodiment, if processor 502 is realizing that the request of data is to read request of data, according to default When table rule being divided to read data step in the table from database, it is implemented as follows step: if the request of data is to read Request of data judges the type for reading request of data;If the reading request of data is that single table reads request of data, according to It is default that table rule is divided to be inquired so that obtained query result is back to application positioning the table to be inquired from database Program.
In one embodiment, processor 502 is after realizing the judgement type step for reading request of data, also Realize following steps: if the readings request of data is multilist reading request of data, according to preset data merger rule from number Merger is carried out according to inquiry data in multiple tables in library and by data obtained query result is back to application program.
In one embodiment, if processor 502 is realizing that the request of data is to read request of data, according to default After dividing table rule to read data in the table from database read data are back to the application program step, also Realize following steps: according to preset cache rule by the middleware by data buffer storage into key value database.
It should be appreciated that in the embodiment of the present application, processor 502 can be central processing unit (Central Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic Device, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor can be microprocessor or Person's processor is also possible to any conventional processor etc..
Those of ordinary skill in the art will appreciate that be realize above-described embodiment method in all or part of the process, It is that relevant hardware can be instructed to complete by computer program.The computer program includes program instruction, computer journey Sequence can be stored in a storage medium, which is computer readable storage medium.The program instruction is by the department of computer science At least one processor in system executes, to realize the process step of the embodiment of the above method.
Therefore, the present invention also provides a kind of storage mediums.The storage medium can be computer readable storage medium.This is deposited Storage media is stored with computer program, and wherein computer program includes program instruction.The program instruction makes when being executed by processor Processor executes following steps: the request of data of application program is received by middleware;Rule selection in library is divided to execute according to default The database of the request of data;If the request of data is write-in request of data, table rule is divided to write data into according to default Into the table of primary database;If the request of data is to read request of data, divide table rule in the table from database according to default Middle reading data are to be back to the application program for read data.
In one embodiment, the processor instructs in execution described program and realizes that the basis is default and divide table rule will When data are written to step in the table of primary database, it is implemented as follows step: data are generated according to default extension set major key rule Corresponding unique major key;Table rule is divided to be written to corresponding table according to default the data and its major key in primary database In.
In one embodiment, if the processor realizes the request of data for reading executing described program instruction Take request of data, according to it is default divide table rule to read data step in the table from database when, be implemented as follows step: if The request of data is to read request of data, judges the type for reading request of data;If the reading request of data is single Table reads request of data, divides table rule to be inquired will obtain positioning from database the table to be inquired according to default Query result is back to application program.
In one embodiment, the processor realizes that the judgement reading data are asked in the instruction of execution described program After the type step asked, following steps are also realized: if the reading request of data is that multilist reads request of data, according to default Aggregation of data rule inquires data in multiple tables from database and data is carried out merger to return obtained query result It is back to application program.
In one embodiment, if the processor realizes the request of data for reading executing described program instruction Request of data is taken, divides table rule to read data in the table from database with described in being back to read data according to default After application program step, following steps are also realized: the middleware is passed through for data buffer storage to key according to preset cache rule In Value Data library.
The storage medium can be USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), magnetic disk Or the various computer readable storage mediums that can store program code such as CD.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure Member and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware With the interchangeability of software, each exemplary composition and step are generally described according to function in the above description.This A little functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Specially Industry technical staff can use different methods to achieve the described function each specific application, but this realization is not It is considered as beyond the scope of this invention.
In several embodiments provided by the present invention, it should be understood that disclosed device and method can pass through it Its mode is realized.For example, the apparatus embodiments described above are merely exemplary.For example, the division of each unit, only Only a kind of logical function partition, there may be another division manner in actual implementation.Such as multiple units or components can be tied Another system is closed or is desirably integrated into, or some features can be ignored or not executed.
The steps in the embodiment of the present invention can be sequentially adjusted, merged and deleted according to actual needs.This hair Unit in bright embodiment device can be combined, divided and deleted according to actual needs.In addition, in each implementation of the present invention Each functional unit in example can integrate in one processing unit, is also possible to each unit and physically exists alone, can also be with It is that two or more units are integrated in one unit.
If the integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product, It can store in one storage medium.Based on this understanding, technical solution of the present invention is substantially in other words to existing skill The all or part of part or the technical solution that art contributes can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, terminal or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right It is required that protection scope subject to.

Claims (10)

1. a kind of read and write abruption method characterized by comprising
The request of data of application program is received by middleware;
According to the default database for dividing rule selection in library to execute the request of data;
If the request of data is write-in request of data, table rule is divided to write data into the table of primary database according to default; And
If the request of data is to read request of data, table rule is divided to read data in the table from database to incite somebody to action according to default Read data are back to the application program.
2. read and write abruption method according to claim 1, which is characterized in that the basis is default to divide table rule to write data Enter into the table of primary database, comprising:
The corresponding unique major key of data is generated according to default extension set major key rule;
Table rule is divided to be written in corresponding table according to default the data and its major key in primary database.
3. read and write abruption method according to claim 1, which is characterized in that if the request of data is to read data Request divides table rule to read data in the table from database according to default, comprising:
If the request of data is to read request of data, the type for reading request of data is judged;
If the reading request of data is that single table reads request of data, table rule is divided to be wanted positioning from database according to default The table of inquiry is inquired so that obtained query result is back to application program.
4. read and write abruption method according to claim 3, which is characterized in that the judgement class for reading request of data After type, further includes:
If the reading request of data is that multilist reads request of data, according to preset data merger rule from the multiple of database Data are inquired in table and data are subjected to merger so that obtained query result is back to application program.
5. read and write abruption method according to claim 1, which is characterized in that further include:
According to preset cache rule by the middleware by data buffer storage into key value database.
6. a kind of read and write abruption device characterized by comprising
Receiving unit, for receiving the request of data of application program by middleware;
Selecting unit, for according to the default database for dividing rule selection in library to execute the request of data;
Writing unit divides table rule to write data into master if being write-in request of data for the request of data according to default In the table of database;
Reading unit divides table rule in the table from database if being to read request of data for the request of data according to default Middle reading data are to be back to the application program for read data.
7. read and write abruption device according to claim 6 characterized by comprising
Generation unit, for generating the corresponding unique major key of data according to default extension set major key rule;
Subelement is written, for divide table rule to be written to corresponding according to default by the data and its major key in primary database In table.
8. read and write abruption device according to claim 6 characterized by comprising
Judging unit judges the type for reading request of data if being to read request of data for the request of data;
Query unit divides table rule from number if being that single table reads request of data for the readings request of data according to presetting It is inquired according to the table to be inquired is positioned in library obtained query result is back to application program;
Merging unit exists if being that multilist reads request of data for the reading request of data according to preset data merger rule Data are inquired from multiple tables of database and data are subjected to merger so that obtained query result is back to application program.
9. a kind of computer equipment, which is characterized in that the computer equipment includes memory and processor, on the memory It is stored with computer program, the processor is realized as described in any one of claim 1-5 when executing the computer program Method.
10. a kind of storage medium, which is characterized in that the storage medium is stored with computer program, and the computer program is worked as Method according to any one of claims 1 to 5 can be realized when being executed by processor.
CN201811099085.8A 2018-09-20 2018-09-20 Read and write abruption method, apparatus, computer equipment and storage medium Withdrawn CN109344157A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811099085.8A CN109344157A (en) 2018-09-20 2018-09-20 Read and write abruption method, apparatus, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811099085.8A CN109344157A (en) 2018-09-20 2018-09-20 Read and write abruption method, apparatus, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109344157A true CN109344157A (en) 2019-02-15

Family

ID=65306138

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811099085.8A Withdrawn CN109344157A (en) 2018-09-20 2018-09-20 Read and write abruption method, apparatus, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109344157A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124555A (en) * 2019-12-26 2020-05-08 深圳前海环融联易信息科技服务有限公司 Method and device for calling big data interface, computer equipment and storage medium
CN111177161A (en) * 2019-11-07 2020-05-19 腾讯科技(深圳)有限公司 Data processing method and device, computing equipment and storage medium
CN111400285A (en) * 2020-03-25 2020-07-10 杭州浮云网络科技有限公司 MySQ L data fragment processing method, apparatus, computer device and readable storage medium
CN111522870A (en) * 2020-04-09 2020-08-11 咪咕文化科技有限公司 Database access method, middleware and readable storage medium
CN112100208A (en) * 2020-09-08 2020-12-18 北京金山云网络技术有限公司 Operation request forwarding method and device
CN112235332A (en) * 2019-07-15 2021-01-15 北京京东尚科信息技术有限公司 Read-write switching method and device for cluster
CN112633839A (en) * 2020-12-25 2021-04-09 山东浪潮通软信息科技有限公司 Automatic tax declaration method and device based on NoSql and storage medium
CN112699115A (en) * 2019-10-23 2021-04-23 拉扎斯网络科技(上海)有限公司 Data storage and query method and device, electronic equipment and storage medium
CN113835690A (en) * 2021-09-23 2021-12-24 中邮科通信技术股份有限公司 Read-write separation multi-data source component and working method thereof
CN114637744A (en) * 2022-02-18 2022-06-17 深圳联想懂的通信有限公司 Database processing method and device, electronic equipment and storage medium

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235332A (en) * 2019-07-15 2021-01-15 北京京东尚科信息技术有限公司 Read-write switching method and device for cluster
CN112235332B (en) * 2019-07-15 2024-01-16 北京京东尚科信息技术有限公司 Method and device for switching reading and writing of clusters
CN112699115A (en) * 2019-10-23 2021-04-23 拉扎斯网络科技(上海)有限公司 Data storage and query method and device, electronic equipment and storage medium
CN111177161A (en) * 2019-11-07 2020-05-19 腾讯科技(深圳)有限公司 Data processing method and device, computing equipment and storage medium
CN111177161B (en) * 2019-11-07 2023-08-15 腾讯科技(深圳)有限公司 Data processing method, device, computing equipment and storage medium
CN111124555A (en) * 2019-12-26 2020-05-08 深圳前海环融联易信息科技服务有限公司 Method and device for calling big data interface, computer equipment and storage medium
CN111400285A (en) * 2020-03-25 2020-07-10 杭州浮云网络科技有限公司 MySQ L data fragment processing method, apparatus, computer device and readable storage medium
CN111400285B (en) * 2020-03-25 2023-06-20 杭州浮云网络科技有限公司 mySQL data fragment processing method, device, computer equipment and readable storage medium
CN111522870B (en) * 2020-04-09 2023-12-08 咪咕文化科技有限公司 Database access method, middleware and readable storage medium
CN111522870A (en) * 2020-04-09 2020-08-11 咪咕文化科技有限公司 Database access method, middleware and readable storage medium
CN112100208A (en) * 2020-09-08 2020-12-18 北京金山云网络技术有限公司 Operation request forwarding method and device
CN112100208B (en) * 2020-09-08 2024-09-13 北京金山云网络技术有限公司 Method and device for forwarding operation request
CN112633839A (en) * 2020-12-25 2021-04-09 山东浪潮通软信息科技有限公司 Automatic tax declaration method and device based on NoSql and storage medium
CN113835690A (en) * 2021-09-23 2021-12-24 中邮科通信技术股份有限公司 Read-write separation multi-data source component and working method thereof
CN114637744A (en) * 2022-02-18 2022-06-17 深圳联想懂的通信有限公司 Database processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109344157A (en) Read and write abruption method, apparatus, computer equipment and storage medium
US10642840B1 (en) Filtered hash table generation for performing hash joins
JP6356675B2 (en) Aggregation / grouping operation: Hardware implementation of hash table method
KR102564170B1 (en) Method and device for storing data object, and computer readable storage medium having a computer program using the same
CN102638584B (en) Data distributing and caching method and data distributing and caching system
US20130191523A1 (en) Real-time analytics for large data sets
US20070143248A1 (en) Method using query processing servers for query processing of column chunks in a distributed column chunk data store
CN109614404B (en) Data caching system and method
CN108664516A (en) Enquiring and optimizing method and relevant apparatus
US20220027349A1 (en) Efficient indexed data structures for persistent memory
US9135572B2 (en) Method and arrangement for processing data
CN106570113B (en) Mass vector slice data cloud storage method and system
CN102819586A (en) Uniform Resource Locator (URL) classifying method and equipment based on cache
CN109767274B (en) Method and system for carrying out associated storage on massive invoice data
US20220188340A1 (en) Tracking granularity levels for accessing a spatial index
CN110147345A (en) A kind of key assignments storage system and its working method based on RDMA
CN100394404C (en) System and method for management of metadata
US20080168071A1 (en) Storing Data in Predicted Formats
CN114443680A (en) Database management system, related apparatus, method and medium
CN112970011B (en) Pedigree in record query optimization
CN111666344A (en) Heterogeneous data synchronization method and device
CN114443615A (en) Database management system, related apparatus, method and medium
US11256695B1 (en) Hybrid query execution engine using transaction and analytical engines
CN113806466A (en) Path time query method and device, electronic equipment and readable storage medium
KR20170129540A (en) System and method for managing rule

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20190215