A kind of date storage method and device based on data base read-write performance

文档序号:1741662 发布日期:2019-11-26 浏览:27次 中文

阅读说明:本技术 一种基于数据库读写性能的数据存储方法与装置 (A kind of date storage method and device based on data base read-write performance ) 是由 张一可 段利宁 于 2019-08-01 设计创作,主要内容包括:本发明公开了一种基于数据库读写性能的数据存储方法与装置,包括:构建多个Bcache块设备作为数据存储设备,其中每个Bcache块设备均包括一个用作Bcache缓存设备的固态硬盘和一个用作Bcache后端设备的机械硬盘;使用自动存储管理服务将待存储数据分配到多个Bcache块设备,将待存储数据写入Bcache块设备的固态硬盘,并进一步从固态硬盘写入Bcache块设备的机械硬盘;使用最近最少使用算法确定Bcache块设备的机械硬盘中存储的热点数据,并将热点数据写入Bcache块设备的固态硬盘。本发明能够以更低的成本提升数据库IO性能并避免性能浪费,同时解决磁盘的容错问题。(The invention discloses a kind of date storage method and device based on data base read-write performance, it include: the multiple Bcache block devices of building as data storage device, wherein each Bcache block device includes the mechanical hard disk that the solid state hard disk for being used as Bcache buffer memory device and one are used as Bcache rear end equipment;Data to be stored is assigned to multiple Bcache block devices using Automatic Storage Management service, by the solid state hard disk of data to be stored write-in Bcache block device, and further from the mechanical hard disk of solid state hard disk write-in Bcache block device;The hot spot data stored in the mechanical hard disk of Bcache block device is determined using least recently used algorithm, and hot spot data is written to the solid state hard disk of Bcache block device.The present invention with lower cost database IO performance and can avoid waist performance, while solve the Fault-Tolerant Problems of disk.)

1. a kind of date storage method based on data base read-write performance, which comprises the following steps:

Multiple Bcache block devices are constructed as data storage device, wherein each Bcache block device includes a use Make the solid state hard disk and a mechanical hard disk as Bcache rear end equipment of Bcache buffer memory device;

Data to be stored is assigned to multiple Bcache block devices using Automatic Storage Management service, by the number to be stored According to the solid state hard disk of the write-in Bcache block device, and the Bcache block device further is written from the solid state hard disk Mechanical hard disk;

The hot spot data stored in the mechanical hard disk of the Bcache block device is determined using least recently used algorithm, and The hot spot data is written to the solid state hard disk of the Bcache block device.

2. the method according to claim 1, wherein each Bcache block device extraly further includes at least One mechanical hard disk, the solid state hard disk are used as the Bcache buffer memory device of multiple mechanical hard disks simultaneously.

3. the method according to claim 1, wherein the Automatic Storage Management service configuration is to described wait deposit Storage data carry out striping processing and are evenly distributed on multiple Bcache block devices, so that each Bcache block Equipment stores an equal amount of data.

4. according to the method described in claim 3, it is characterized in that, the Automatic Storage Management service configuration is with more copy moulds The data to be stored fault tolerant is stored multiple Bcache block devices by formula, so that the data to be stored is every A part is all stored with the backup copies of identical content on at least two Bcache block devices.

5. the method according to claim 1, wherein the Bcache block further is written from the solid state hard disk The mechanical hard disk of equipment includes: the mechanical hard disk that the Bcache block device is further written in a manner of write-back, wherein The data volume of write-back is determined by preset write-back proportion threshold value.

6. the method according to claim 1, wherein the solid state hard disk is SATA solid state hard disk or SAS solid-state Hard disk;The mechanical hard disk is SATA mechanical hard disk or SAS mechanical hard disk.

7. according to the method described in claim 6, it is characterized in that, the solid state hard disk and the mechanical hard disk do not form independence Redundant arrays of inexpensive disks.

8. the method according to claim 1, wherein the database is oracle database.

9. a kind of data storage device based on data base read-write performance characterized by comprising

Initialization module, for constructing multiple Bcache block devices as data storage device, wherein each Bcache block Equipment includes the mechanical hard disk that the solid state hard disk for being used as Bcache buffer memory device and one are used as Bcache rear end equipment;

Writing module, for data to be stored to be assigned to multiple Bcache block devices using Automatic Storage Management service, The data to be stored is written to the solid state hard disk of the Bcache block device, and further from described in solid state hard disk write-in The mechanical hard disk of Bcache block device;

Pre-read module is deposited in the mechanical hard disk for being determined the Bcache block device using least recently used algorithm The hot spot data of storage, and the hot spot data is written to the solid state hard disk of the Bcache block device.

10. a kind of database server characterized by comprising

Processor;With

Memory, is stored with the program code that processor can be run, and said program code executes such as claim when being run Date storage method based on data base read-write performance described in any one of 1-8.

Technical field

The present invention relates to computer fields, deposit more specifically, particularly relating to a kind of data based on data base read-write performance Method for storing and device.

Background technique

Oracle is a relational database management system of Oracle, is constantly in leadingly in database field Position, system portability is good, easy to use, function is strong, is suitable for all kinds of large, medium and small microcomputer environment.Oracle is a kind of efficient Rate, good reliability, adaptation high-throughput database solution.System gulps down measurement (bearing capacity) and request to CPU Consumption, external interface, IO (input and output) etc. tight association.Single request is higher to CPU consumption, external system interface, IO response speed is slower, and system-through-up capability is lower.As cpu performance is promoted, the performance bottleneck of oracle database is IO Performance.In order to solve this problem, existing to dodge disk array (SAS SSD disk array or SATA SSD disk array) using complete It promotes oracle database and stores IO performance, but this results in cost is excessively high and performance overstock problem.

Make carrying cost excessively high and the problem of performance surplus for IO performance is promoted in the prior art, there has been no have at present The solution of effect.

Summary of the invention

In view of this, the purpose of the embodiment of the present invention is to propose a kind of data storage side based on data base read-write performance Method and device with lower cost database IO performance and can avoid waist performance, while solve the fault-tolerant of disk and asking Topic.

Based on above-mentioned purpose, the first aspect of the embodiment of the present invention provides a kind of data based on data base read-write performance Storage method, comprising:

Multiple Bcache block devices are constructed as data storage device, wherein each Bcache block device includes a use Make the solid state hard disk and a mechanical hard disk as Bcache rear end equipment of Bcache buffer memory device;

Data to be stored is assigned to multiple Bcache block devices using Automatic Storage Management service, data to be stored is write Enter the solid state hard disk of Bcache block device, and further from the mechanical hard disk of solid state hard disk write-in Bcache block device;

The hot spot data stored in the mechanical hard disk of Bcache block device is determined using least recently used algorithm, and will be hot The solid state hard disk of point data write-in Bcache block device.

In some embodiments, each Bcache block device extraly further includes at least one mechanical hard disk, and solid-state is hard Disk is used as the Bcache buffer memory device of multiple mechanical hard disks simultaneously.

In some embodiments, Automatic Storage Management service configuration is to carry out striping processing and equal to data to be stored It is even to be assigned on multiple Bcache block devices, so that each Bcache block device stores an equal amount of data.

In some embodiments, Automatic Storage Management service configuration is with more copy modes by data to be stored fault tolerant Ground is stored to multiple Bcache block devices, so that each section of data to be stored is all at least two Bcache block devices It is stored with the backup copies of identical content.

In some embodiments, the mechanical hard disk of Bcache block device further is written from solid state hard disk includes: into one The mechanical hard disk of Bcache block device is written in step in a manner of write-back, and wherein the data volume of write-back is by preset write-back ratio Threshold value determines.

In some embodiments, solid state hard disk is SATA solid state hard disk or SAS solid state hard disk;Mechanical hard disk is SATA machine Tool hard disk or SAS mechanical hard disk.

In some embodiments, solid state hard disk and mechanical hard disk do not form redundant array of independent disks.

In some embodiments, database is oracle database.

The second aspect of the embodiment of the present invention provides a kind of data storage device based on data base read-write performance, packet It includes:

Initialization module, for constructing multiple Bcache block devices as data storage device, wherein each Bcache block Equipment includes the mechanical hard disk that the solid state hard disk for being used as Bcache buffer memory device and one are used as Bcache rear end equipment;

Writing module, for data to be stored to be assigned to multiple Bcache block devices using Automatic Storage Management service, By the solid state hard disk of data to be stored write-in Bcache block device, and further from the machine of solid state hard disk write-in Bcache block device Tool hard disk;

Pre-read module is stored in the mechanical hard disk for being determined Bcache block device using least recently used algorithm Hot spot data, and by hot spot data write-in Bcache block device solid state hard disk.

The third aspect of the embodiment of the present invention provides a kind of database server, comprising:

Processor;With

Memory, is stored with the program code that processor can be run, program code executed when being run it is above-mentioned based on The date storage method of data base read-write performance.

The present invention has following advantageous effects: the data provided in an embodiment of the present invention based on data base read-write performance Storage method and device, by constructing multiple Bcache block devices as data storage device, wherein each Bcache block device It include the mechanical hard disk that the solid state hard disk for being used as Bcache buffer memory device and one are used as Bcache rear end equipment;It uses Data to be stored is assigned to multiple Bcache block devices by Automatic Storage Management service, and data to be stored write-in Bcache block is set Standby solid state hard disk, and further from the mechanical hard disk of solid state hard disk write-in Bcache block device;Use least recently used calculation Method determines the hot spot data stored in the mechanical hard disk of Bcache block device, and consolidating hot spot data write-in Bcache block device The technical solution of state hard disk with lower cost database IO performance and can avoid waist performance, while solve disk Fault-Tolerant Problems.

Detailed description of the invention

In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.

Fig. 1 is the flow diagram of the date storage method provided by the invention based on data base read-write performance;

Fig. 2 is the storage organization schematic diagram of the date storage method provided by the invention based on data base read-write performance.

Specific embodiment

To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with specific embodiment, and reference The embodiment of the present invention is further described in attached drawing.

It should be noted that all statements for using " first " and " second " are for differentiation two in the embodiment of the present invention The non-equal entity of a same names or non-equal parameter, it is seen that " first " " second " only for the convenience of statement, does not answer It is interpreted as the restriction to the embodiment of the present invention, subsequent embodiment no longer illustrates this one by one.

Based on above-mentioned purpose, the first aspect of the embodiment of the present invention, proposing one kind can be with lower cost Database IO performance and avoid waist performance date storage method one embodiment.Shown in fig. 1 is provided by the invention The flow diagram of date storage method based on data base read-write performance.

The date storage method based on data base read-write performance, as shown in Figure 1, comprising:

Step S101: multiple Bcache block devices are constructed as data storage device, wherein each Bcache block device is equal The solid state hard disk for being used as Bcache buffer memory device including one and a mechanical hard disk as Bcache rear end equipment;

Step S103: being assigned to multiple Bcache block devices for data to be stored using Automatic Storage Management service, will be to The solid state hard disk of Bcache block device is written in storing data, and further hard from the machinery of solid state hard disk write-in Bcache block device Disk;

Step S105: the hot spot number stored in the mechanical hard disk of Bcache block device is determined using least recently used algorithm According to, and by hot spot data write-in Bcache block device solid state hard disk.

As shown in Fig. 2, the embodiment of the present invention is configured using HDD (mechanical hard disk) and SSD (solid state hard disk) 1:1, utilize SSD and HDD is formed block device by Bcache, while will by striping using Oracle ASM (Automatic Storage Management) service Oracle data are evenly distributed on the block device of generation, solve the problems, such as disk tolerance using the more copy modes of ASM.In the party Oracle data can be write first on SSD disk in case, then be write back on HDD in a manner of write-back, and then improve database Write performance, and Oracle hot spot data can be cached on SSD by lru (least recently used) algorithm of Bcache, be improved Database reading performance.The embodiment of the present invention avoids thus reducing verification bring using RAID (redundant array of independent disks) It can be lost, and then greatly reduce server cost compared to the full disk array that dodges.

Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, Ke Yitong Computer program is crossed to instruct related hardware and complete, the program can be stored in a computer-readable storage medium, The program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can for magnetic disk, CD, read-only memory (ROM) or random access memory (RAM) etc..The embodiment of the computer program, Ke Yida The effect identical or similar to corresponding aforementioned any means embodiment.

In some embodiments, each Bcache block device extraly further includes at least one mechanical hard disk, and solid-state is hard Disk is used as the Bcache buffer memory device of multiple mechanical hard disks simultaneously.

In some embodiments, Automatic Storage Management service configuration is to carry out striping processing and equal to data to be stored It is even to be assigned on multiple Bcache block devices, so that each Bcache block device stores an equal amount of data.

In some embodiments, Automatic Storage Management service configuration is with more copy modes by data to be stored fault tolerant Ground is stored to multiple Bcache block devices, so that each section of data to be stored is all deposited at least two Bcache block devices Contain the backup copies of identical content.

In some embodiments, further from the mechanical hard disk of solid state hard disk write-in Bcache block device are as follows: further The mechanical hard disk of Bcache block device is written in a manner of write-back, wherein the data volume of write-back is by preset write-back ratio threshold Value determines.

In some embodiments, solid state hard disk is SATA solid state hard disk or SAS solid state hard disk;Mechanical hard disk is SATA machine Tool hard disk or SAS mechanical hard disk.

In some embodiments, solid state hard disk and mechanical hard disk do not form redundant array of independent disks.

In some embodiments, database is oracle database.

Disclosed method is also implemented as the computer program executed by CPU, the calculating according to embodiments of the present invention Machine program may be stored in a computer readable storage medium.When the computer program is executed by CPU, executes the present invention and implement The above-mentioned function of being limited in method disclosed in example.Above method step and system unit also can use controller and be used for Storage is so that controller realizes that the computer readable storage medium of the computer program of above-mentioned steps or Elementary Function is realized.

Below according to the specific embodiment specific embodiment that the present invention is further explained.

Referring first to Fig. 2, configuration bottom HDD is SAS (serial ATA) HDD or SATA (Serial Attached SCSI (SAS)) HDD, SSD be SATA SSD or SAS SSD or the higher NVMe of performance (nonvolatile memory extension) SSD, wherein HDD and SSD quantitative proportion is 1:1.Deployment installation bcache-tools tool on an operating system, makes bcache module loading to operation System kernel.

Then, SSD is created as bcache buffer memory device, HDD is bcache rear end equipment, is sequentially completed creation and generates Bcache0, bcache1 are to bcacheN equipment.Optimize bcache device parameter: setting sequence IO cache policy parameter simultaneously Sequential_cutoff=0;Setting caching writes back scale parameter writeback_percent=40;Congested_ is set Read_threshold_us=0 and congested_write_threshold_us=0 is to allow read and write IO to send To SSD.Oracle ASM management software is installed again, bcache0~N equipment is managed by ASM striping, and create one or Multiple copies are used for oracle database.

From above-described embodiment as can be seen that the data storage side provided in an embodiment of the present invention based on data base read-write performance Method, by constructing multiple Bcache block devices as data storage device, wherein each Bcache block device includes a use Make the solid state hard disk and a mechanical hard disk as Bcache rear end equipment of Bcache buffer memory device;Use Automatic Storage Management Data to be stored is assigned to multiple Bcache block devices by service, and the solid-state of data to be stored write-in Bcache block device is hard Disk, and further from the mechanical hard disk of solid state hard disk write-in Bcache block device;It is determined using least recently used algorithm The hot spot data stored in the mechanical hard disk of Bcache block device, and by hot spot data write-in Bcache block device solid state hard disk Technical solution, with lower cost database IO performance and waist performance can be avoided, while solving the fault-tolerant of disk Problem.

It is important to note that in each embodiment of the above-mentioned date storage method based on data base read-write performance Each step can be intersected, replaces, increases, be deleted, therefore, these reasonable permutation and combination transformation in be based on data The date storage method of library readwrite performance should also be as belonging to the scope of protection of the present invention, and should not be by protection scope of the present invention It is confined on the embodiment.

Based on above-mentioned purpose, the second aspect of the embodiment of the present invention, proposing one kind can be with lower cost Database IO performance and avoid waist performance data storage device one embodiment.Data based on data base read-write performance Storage device includes:

Initialization module, for constructing multiple Bcache block devices as data storage device, wherein each Bcache block Equipment includes the mechanical hard disk that the solid state hard disk for being used as Bcache buffer memory device and one are used as Bcache rear end equipment;

Writing module, for data to be stored to be assigned to multiple Bcache block devices using Automatic Storage Management service, By the solid state hard disk of data to be stored write-in Bcache block device, and further from the machine of solid state hard disk write-in Bcache block device Tool hard disk;

Pre-read module is stored in the mechanical hard disk for being determined Bcache block device using least recently used algorithm Hot spot data, and by hot spot data write-in Bcache block device solid state hard disk.

Various illustrative logical blocks, module, circuit and algorithm steps in conjunction with described in disclosure herein can be implemented For the combination of electronic hardware, computer software or both.In order to clearly demonstrate this interchangeability of hardware and software, General description has been carried out to it with regard to the function of various exemplary components, square, module, circuit and step.This function is Software is implemented as also to be implemented as hardware depending on concrete application and be applied to the design constraint of whole system.This field Technical staff can realize the function in various ways for every kind of concrete application, but determine should not be by for this realization It is construed to lead to be detached from range disclosed by the embodiments of the present invention.

Based on above-mentioned purpose, the third aspect of the embodiment of the present invention, proposing one kind can be with lower cost Database IO performance and the database server one embodiment for avoiding waist performance.Meta data server includes:

Processor;With

Memory, is stored with the program code that processor can be run, program code executed when being run it is above-mentioned based on The date storage method of data base read-write performance.

From above-described embodiment as can be seen that the data provided in an embodiment of the present invention based on data base read-write performance store dress It sets and database server, by constructing multiple Bcache block devices as data storage device, wherein each Bcache block is set Standby includes the mechanical hard disk that the solid state hard disk for being used as Bcache buffer memory device and one are used as Bcache rear end equipment;Make Data to be stored is assigned to multiple Bcache block devices with Automatic Storage Management service, Bcache block is written into data to be stored The solid state hard disk of equipment, and further from the mechanical hard disk of solid state hard disk write-in Bcache block device;Using least recently used Algorithm determines the hot spot data stored in the mechanical hard disk of Bcache block device, and by hot spot data write-in Bcache block device The technical solution of solid state hard disk with lower cost database IO performance and can avoid waist performance, while solve magnetic The Fault-Tolerant Problems of disk.

It is important to note that above-mentioned data storage device and database server based on data base read-write performance Embodiment uses the work that each module is illustrated based on the embodiment of the date storage method of data base read-write performance Make process, those skilled in the art can be it is readily conceivable that by these module applications to described based on data base read-write performance In the other embodiments of date storage method.Certainly, the date storage method due to described based on data base read-write performance is implemented Example in each step can intersect, replace, increase, delete, therefore, these reasonable permutation and combination transformation in institute Stating data storage device and database server based on data base read-write performance should also be as belonging to the scope of protection of the present invention, and And protection scope of the present invention should not be confined on the embodiment.

It is exemplary embodiment disclosed by the invention above, it should be noted that in the sheet limited without departing substantially from claim Under the premise of inventive embodiments scope of disclosure, it may be many modifications and modify.According to open embodiment described herein The function of claim to a method, step and/or movement be not required to the execution of any particular order.In addition, although the present invention is implemented Element disclosed in example can be described or be required in the form of individual, but be unless explicitly limited odd number, it is understood that be multiple.

It should be understood that it is used in the present context, unless the context clearly supports exceptions, singular " one It is a " it is intended to also include plural form.It is to be further understood that "and/or" used herein refers to including one or one Any and all possible combinations of a above project listed in association.The embodiments of the present invention disclose embodiment sequence number only Only for description, do not represent the advantages or disadvantages of the embodiments.

Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..

It should be understood by those ordinary skilled in the art that: the discussion of any of the above embodiment is exemplary only, not It is intended to imply that range disclosed by the embodiments of the present invention (including claim) is limited to these examples;In the think of of the embodiment of the present invention Under road, it can also be combined between the technical characteristic in above embodiments or different embodiments, and exist as described above Many other variations of the different aspect of the embodiment of the present invention, for simplicity, they are not provided in details.Therefore, all at this Within the spirit and principle of inventive embodiments, any omission, modification, equivalent replacement, improvement for being made etc. should be included in this hair Within the protection scope of bright embodiment.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:写入操作的控制方法、装置和设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类