CN106873910B - 一种基于openstack平台的SSD缓存方法 - Google Patents

一种基于openstack平台的SSD缓存方法 Download PDF

Info

Publication number
CN106873910B
CN106873910B CN201710062792.9A CN201710062792A CN106873910B CN 106873910 B CN106873910 B CN 106873910B CN 201710062792 A CN201710062792 A CN 201710062792A CN 106873910 B CN106873910 B CN 106873910B
Authority
CN
China
Prior art keywords
page
inode
cache
size
pages
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
CN201710062792.9A
Other languages
English (en)
Other versions
CN106873910A (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.)
Southeast University
Original Assignee
Southeast University
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 Southeast University filed Critical Southeast University
Priority to CN201710062792.9A priority Critical patent/CN106873910B/zh
Publication of CN106873910A publication Critical patent/CN106873910A/zh
Application granted granted Critical
Publication of CN106873910B publication Critical patent/CN106873910B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

本发明公开了一种基于openstack平台的SSD缓存方法,其特征在于:SSD缓存放置于VFS和Distribute/Stripe之间;SSD缓存模块三种结构体,其中page结构体包括所有与缓存页相关的属性,inode结构体用于存放与文件相关的属性,table结构体用于存放全局信息。基于SSD的缓存方法能很好解决openstack平台的网络和磁盘读写瓶颈问题。

Description

一种基于openstack平台的SSD缓存方法
技术领域
本发明提出一种基于openstack平台的SSD缓存方法,涉及云计算、计算机技术领域。
技术背景
OpenStack已经被越来越多的厂家和云计算服务提供商采纳并应用至生产环境中。Rackspace已经采用OpenStack提供虚拟机和云存储服务,其中云存储Swift已经达到100PB。HP新推出的公有云服务也是基于OpenStack的。新浪已经推出基于OpenStack的虚拟机和云存储服务。
GlusterFS是Openstack采用的集群的文件系统,支持PB级的数据量。GlusterFS通过RDMA和TCP/IP方式将分布到不同服务器上的存储空间汇集成一个大的网络并行文件系统。该系统现在正式支持OpenStack的三种主要模式存储,包括:文件、块和对象。GlusterFS用户空间采用的堆栈式架构。该架构在GlusterFS的客户端和服务端(均在用户空间)可以在服务初始化的过程中插入链状的自定义模块。但它带来的问题是网络I/O和磁盘I/O的性能瓶颈。加入缓存能够很好的解决此类问题,GlusterFS本身也包含I/O缓存模块,但他提供的缓存是只读的,而且缓存大小受限制。
现存的缓存架构也很多,比如最近很火热的memcached架构以及其变种。Memcached是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态、数据库驱动网站的速度。为了提高性能,memcached中保存的数据都存储在memcached内置的内存存储空间中。由于数据仅存在于内存中,因此重启memcached、重启操作系统会导致全部数据消失。另外,内容容量达到指定值之后,就基于LRU(Least Recently Used)算法自动删除不使用的缓存,因此很多缓存替换算法都未能使用。该系统正在被广泛应用,但是它并不适合GlusterFS,应用场景也有所不同,它无法根据我们的需求很好的调整参数。
故本发明将提出一个适合GlusterFS,并且可读可写的SSD缓存方法。
发明内容
发明目的:本发明的目的在于提供一种基于openstack平台的SSD缓存方法,解决网络I/O和磁盘I/O瓶颈。
实现本发明目的技术方案:在GlusterFS上添加了SSD缓存模块,SSD缓存模块包括三种结构体:page结构体包括所有与缓存页相关的属性,inode结构体用于存放与文件相关的属性,table结构体用于存放全局信息。基于这三种结构体,可以在服务初始化的过程中插入链状的自定义模块,实现SSD缓存方案。
SSD缓存模块中的page结构体包括所有与缓存页相关的属性:包含缓存页本身字段,缓存页的替换算法和当前页的等待队列。
(1)页自身相关字段:包含inode指针,ready字段,offset字段,size字段。通过inode指针可以访问该页所属的inode。ready字段表示该页的内容是否准备就绪以供读写。offset表示该页的起始在inode中的偏移量。size字段表示该页的实际大小。
(2)缓存页的替换算法:包括inode_lru与table_lru:前者通过list_head与inode形成双向链表结构,以inode为head,可以遍历与该inode相关联的所有页;后者与table形成双向链表结构,这个链表包含了所有的页,是全局的LRU链表,在缓存页用满需要替换时,从链表尾取出page,并将其释放。
(3)当前页的等待队列。等待队列用来对读写请求进行排队。
SSD缓存模块中的inode结构体用于存放与文件相关的属性:包括与table结构体相关的属性,与page结构体相关的属性和自身属性。
(1)与table相关的属性。inode_list是所有inode形成的双向链表。table指向的是inode关联的table。
(2)与page相关的属性。page_lru是inode下page组成的链表。dirty_list是inode下所有脏页组成的链表。dirty_cnt表示脏页的数量。
(3)inode自身的属性。inode指针指向原始的inode。size字段表示inode关联的文件的大小,如果当前写入的数据块超过了文件大小,则需要更新该字段,同时需要对后端存储的该文件执行truncate操作。
SSD缓存模块中的table结构体用于存放全局信息:包含页大小、缓存大小、缓存的使用情况、与替换算法相关的信息等。
其中page_size表示页大小,cache_size表示缓存文件的大小,即缓存容量,该值为page_size的整数倍,cache_used表示已使用的缓存大小,该值等于已分配的dc_page数量乘以page_size,list_head inodes表示所有inode组成的双向链表,inode_count表示inode的数量,page_lru表示page LRU的链表头,访问页时将页插入到链表头之后,替换页时替换链表尾的页,page_lru_cnt表示pageLRU链表中的page数量,dirty_list表示所有的脏页链表,在回写线程中进行遍历,dirty_cnt表示所有脏页的数量
本发明具有的有益效果:
本发明在openstack本身采用的GlusterFS上添加了SSD Cache模块,比原有提供的可配置Cache多了以下好处:缓存策略可配置、页大小可配置、缓存容量不受限制、读写均可缓存。
附图说明
图1是本发明的openstack架构图。
图2是本发明的GlusterFS架构图。
图3是本发明的具体实施方式的详细流程图。
具体实施方式
下面结合附图对本发明的技术方案进行详细说明:
图1显示了本发明在openstack平台中添加SSD Cache位置,它在计算结点端的分布式文件系统的客户端。因为该缓存直接存在于客户端,若缓存命中率较高,缓存的数据也无需经常通过网络读取服务器硬盘上的数据,故在该位置可以在该位置可以明显改善网络I/O和磁盘I/O。
图2显示了本发明在GlusterFS分布式文件系统中的详细位置。因为GlusterFS用户空间的堆栈式架构指的是在GlusterFS的客户端和服务端(均在用户空间)通过配置可以在服务初始化的过程中插入链状的自定义模块,故本发明在VFS和Distribute之间加入SSDCache模块,以起到缓存的目的。
为了便于公众理解本发明的技术方案,以读请求为例(采用LRU替换策略)。图3为该例子的详细流程图,具体步骤如下:
步骤S101、读页请求。
步骤S102、判断缓存中是否有该页,即是否命中(table中是否有该页)。若没有跳转至步骤S103,否则跳转至步骤S110。
步骤S103、根据LRU替换算法,替换链表链尾的page。
步骤S104、根据请求和page结构体的结构,根据步骤101读取的请求和page结构体的结构,申请空间,创建新页,构造page。
步骤S105、添加当前读请求至page waitq中。
步骤S106、通过异步的方式请求页内容。即暂时搁置当前请求的响应,处理下一个请求,当通过轮询或其他方式得到回调通知后,开始运行;
步骤S107、通过异步的方式更新页内容,成功后,将该页置于链表链头。
步骤S108、设置该page的ready为1。
步骤S109、处理page waitq中的请求,跳转至结束。
步骤S110、添加当前读请求到page waitq中。
步骤S111、检查page是否ready,若是,则跳转至步骤S112,否则结束。
步骤S112、处理page waitq中的请求,将访问的新页放置于链头。

Claims (1)

1.一种基于openstack平台的SSD缓存方法,其特征在于:采用GlusterFS作为openstack平台的分布式文件系统,在GlusterFS的VFS和Distribute/Stripe之间加入SSD缓存模块;所述SSD缓存模块包括三种结构体:
page结构体包括所有与缓存页相关的属性:包含缓存页本身字段,缓存页的替换算法和当前页的等待队列;
其中,(1)页自身相关字段:包含inode指针,ready字段,offset字段,size字段;通过inode指针访问该页所属的inode;ready字段表示该页的内容是否准备就绪以供读写;offset表示该页的起始在inode中的偏移量;size字段表示该页的实际大小;
(2)缓存页的替换算法:包括inode_lru与table_lru,前者通过list_head与inode形成双向链表结构,以inode为head,遍历与该inode相关联的所有页;后者与table形成双向链表结构,包含所有的页,是全局的LRU链表,在缓存页用满需要替换时,从链表尾取出page,并将其释放;
(3)当前页的等待队列:等待队列用来对读写请求进行排队;
inode结构体用于存放与文件相关的属性:包括与table结构体相关的属性,与page结构体相关的属性和自身属性;
其中,(1)与table相关的属性:inode_list是所有inode形成的双向链表,table指向的是inode关联的table;
(2)与page相关的属性:page_lru是inode下page组成的链表,dirty_list是inode下所有脏页组成的链表,dirty_cnt表示脏页的数量;
(3)inode自身的属性:inode指针指向原始的inode;size字段表示inode关联的文件的大小,如果当前写入的数据块超过文件大小,则需要更新该字段,同时需要对后端存储的该文件执行truncate操作;
table结构体用于存放全局信息:包含页大小、缓存大小、缓存的使用情况、与替换算法相关的信息;
其中page_size表示页大小,cache_size表示缓存文件的大小,即缓存容量,该值为page_size的整数倍,cache_used表示已使用的缓存大小,该值等于已分配的dc_page数量乘以page_size,list_head inodes表示所有inode组成的双向链表,inode_count表示inode的数量,page_lru表示page LRU的链表头,访问页时将页插入到链表头之后,替换页时替换链表尾的页,page_lru_cnt表示page LRU链表中的page数量,dirty_list表示所有的脏页链表,在回写线程中进行遍历,dirty_cnt表示所有脏页的数量;
通过所述SSD缓存模块的三种结构体在服务初始化的过程中插入链状的自定义模块。
CN201710062792.9A 2017-01-25 2017-01-25 一种基于openstack平台的SSD缓存方法 Active CN106873910B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710062792.9A CN106873910B (zh) 2017-01-25 2017-01-25 一种基于openstack平台的SSD缓存方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710062792.9A CN106873910B (zh) 2017-01-25 2017-01-25 一种基于openstack平台的SSD缓存方法

Publications (2)

Publication Number Publication Date
CN106873910A CN106873910A (zh) 2017-06-20
CN106873910B true CN106873910B (zh) 2020-06-05

Family

ID=59165961

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710062792.9A Active CN106873910B (zh) 2017-01-25 2017-01-25 一种基于openstack平台的SSD缓存方法

Country Status (1)

Country Link
CN (1) CN106873910B (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189339B (zh) * 2018-08-28 2021-08-20 郑州云海信息技术有限公司 一种存储系统下自动配置缓存加速方法

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103605630A (zh) * 2013-11-28 2014-02-26 中标软件有限公司 一种虚拟服务器系统及其数据读写方法
CN104536988A (zh) * 2014-12-10 2015-04-22 杭州斯凯网络科技有限公司 MonetDB分布式计算存储方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201315435D0 (en) * 2013-08-30 2013-10-16 Ibm Cache management in a computerized system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103605630A (zh) * 2013-11-28 2014-02-26 中标软件有限公司 一种虚拟服务器系统及其数据读写方法
CN104536988A (zh) * 2014-12-10 2015-04-22 杭州斯凯网络科技有限公司 MonetDB分布式计算存储方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GlusterFS 缓存机制研究;周凡夫;《计算机应用与软件》;20120731;第29卷(第7期);第76-80页 *
面向桌面云的I_O访存模式及缓存管理策略_严峥;严峥;《中国优秀硕士学位论文全文数据库 信息科技辑》;20170315(第3期);正文第1-8页 *

Also Published As

Publication number Publication date
CN106873910A (zh) 2017-06-20

Similar Documents

Publication Publication Date Title
US7058763B2 (en) File system for caching web proxies
US8819074B2 (en) Replacement policy for resource container
US9552294B2 (en) Dynamically configuring regions of a main memory in a write-back mode or a write-through mode
US9015131B2 (en) Information management method, and computer for providing information
US20170344575A1 (en) Methods for facilitating external cache in a cloud storage environment and devices thereof
CN107179878B (zh) 基于应用优化的数据存储的方法和装置
US8868863B2 (en) Method and apparatus for a frugal cloud file system
CN110555001B (zh) 数据处理方法、装置、终端及介质
US9940023B2 (en) System and method for an accelerator cache and physical storage tier
US9727479B1 (en) Compressing portions of a buffer cache using an LRU queue
CN103530387A (zh) 一种hdfs针对小文件的改进方法
US20130290636A1 (en) Managing memory
US10061523B2 (en) Versioning storage devices and methods
WO2011064742A1 (en) Super-records
WO2020199760A1 (zh) 数据存储方法、存储器和服务器
US9483523B2 (en) Information processing apparatus, distributed processing system, and distributed processing method
US9178931B2 (en) Method and system for accessing data by a client from a server
CN114817195A (zh) 一种分布式存储缓存管理的方法、系统、存储介质及设备
CN112148736A (zh) 缓存数据的方法、设备及存储介质
CN106873910B (zh) 一种基于openstack平台的SSD缓存方法
CN110737397B (zh) 用于管理存储系统的方法、设备和计算机程序产品
US10686906B2 (en) Methods for managing multi-level flash storage and devices thereof
US11586353B2 (en) Optimized access to high-speed storage device
CN112650694B (zh) 一种数据读取方法、装置、缓存代理服务器及存储介质
CN110209343B (zh) 数据存储方法、装置、服务器及存储介质

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
GR01 Patent grant
GR01 Patent grant