用户名: 密码: 验证码:
基于Memcached的高速缓存功能扩展研究
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着计算机技术的不断发展,缓存技术已经得到了广泛应用。近年来,互联网的普及,导致了互联网用户剧增,高速缓存技术更是成为了研究的热点。高速缓存技术的应用,可以有效提高系统的响应速度,降低网络带宽消耗,减少网络阻塞,从而解决数据量大、信息更新频繁所导致的问题。良好的缓存架构方案是大型互联网应用系统实现海量数据处理、多用户并发访问以及提供良好用户体验的关键。
     本文分析了当前常用的缓存技术及其产品的特点,深入分析了高速缓存系统Memcached的架构方案、工作原理以及内部实现机制,并在此基础上,针对Memcached存在的缺陷和不足,对其功能进行了扩展和改进。通过Memcaced源码分析,进一步扩展了缓存数据遍历、数据持久化以及系统日志等功能。在扩展功能实现的过程中,使用了工厂设计模式,降低了持久化模块接口之间的耦合度;同时,通过引入批量数据保存策略,有效地减少了磁盘I/O开销,并采用多种数据保存接口触发机制来增加系统数据的可靠性、安全性。在缓存数据遍历设计中,采用了数据分批发送的方式来降低内存开销。最后,本文采用黑盒测试技术,以人工测试和自动化测试相结合的方式对系统扩展的相关功能进行了验证性测试,并分析了其性能。测试结果表明,扩展功能不仅有效的弥补了Memcached在功能设计方面的的不足,丰富了其应用,同时,新增功能并不会增加太多额外的开销,完全能够和以前的功能融合在一起协同工作。
Cache technology has been widely applied with the continuous development of computer science. In recent years, with the popularity of Internet, there is a dramatic increase of Internet users which also makes the high-speed cache technology a hot topic in the research field. High-speed cache technology can effectively improve the system response speed, reduce the network bandwidth consumption and network congestion, and thus solve the problems caused by the large amount of data and frequently updated information. Hence, excellent cache architecture becomes a key factor for large-scale Internet applications to achieve massive data processing, concurrent access of a huge number of users and to provide great user experience.
     In this paper, some currently used cache technologies and features of their products are presented firstly, which is followed by a profound analysis of high-speed cache system called Memcached and its architecture, principle and mechanism; secondly some work which has been done to improve the functionality of Memcached model due to its existing defects and deficiencies is presented. Then through an analysis of Memcaced'source code, features such as cache traversal, data persistence and system log are introduced as expanded functions in the improved model. During the achievement of these functions, the coupling degree between the persistent modules'interfaces is lowered by using the factory method; in the meantime, the disk I/O overhead is effectively reduced by applying bulk data storage strategy; the reliability and security of system data is augemented with the use of data storage interface trigger strategy. And in the design of cache data traversal, data is transmitted in packages in order to reduce the memory consumption. In the last part of this paper, by adopting the black box testing technique combined with the manual and automatic testing method, a verification test is worked out to evaluate the performance of the improved system. Observed result shows that, expanded functions can perfectly integrate with the former system and what's more, outperform the original Memcached model without incurring additional overhead.
引文
[1]http://www.beareyes.com.cn/2/lib/201101/27/20110127146.htm.
    [2]http://www.cnnic.cn/dtygg/dtgg/201201/t20120116_23667.html.
    [3]http://news.163.com/12/0304/08/7RO4PDL300014JB5.html.
    [4]乐德广,郭东辉,吴伯僖.网络缓存技术及应用的研究[J].应用技术.2003,第五期:33-35.
    [5]符青云,刘心松.基于分布式协同缓存机制的Web Proxy研究[J].计算机工程.2007,Vol.33 No.11.
    [6]Chen G,Wang C L,Lau F C M.Building a Scalable Web Server with Global Object Space Support on Heterogeneous Clusters[C].Proceedings of IEEE International Conference on Cluster Computing,Newport Beach,California.2001.
    [7]Xiao Li,Chen Xin,Zhang Xiaodong.On Scalable and Locality-aware Web Document Sharing[J].Journal of Parallel and Distributed Computing.2003.63(10).
    [8]M.Rezvan,K.Pawlikowski and H.Sirisena.A Distributed Cache Architecture for Routing in Hierarchical QoS-Capable Networks[J]. IEEE International Conference on Communications.2003.v3:1749-1753.
    [9]Sinisa Srbljic,Andro Milanovic and Nikola Hadjina,Performance Tuning of Large-Scale Distributed WWW Caches[J].10th Mediterranean Electro-technical Conference. MEleCon 2000,Vol I.
    [10]杜秉一.基于关联规则缓存策略的分布式视频点播系统的研究和设计[J].华中科技大学.2008.
    [11]涂小朋,汪林林.分布式空间数据库中基于事务的客户端高速缓存技术研究[J].计算机科学.2004,31(6).
    [12]Iqbal Khan通过分布式缓存来解决可伸缩性瓶颈[OL]. MSDN 2010(6).
    [13]曹丽娟,谢强,丁秋林.基于分布式数据缓存技术的Web-OLAP系统研究[J].2008(2).
    [14]蒲胤.分布式缓存安全验证组件的设计与实现[D].重庆大学硕士学位论文.2010:3.
    [15]王世克,吴集,金士尧.Web缓存技术概述[J].小型微型计算机系统.2004.25(5):836-842.
    [16]蒋本珊.计算机组成原理[M].第2版.清华大学出版社.2008:178-179.
    [17]Brian L.Stuart操作系统原理、设计与应用[M].葛秀慧,田浩,刘展威等译.清华大学出版社.2010:170一173.
    [18]王会霞.Web流量特征模型的研究和应用[D].郑州大学硕士学位论文.2007:17-18.
    [19]D.L.Willick,D.L.Eager,R.B.Bunt.Disk Cache Replacement Policies for Network Fileservers[C].Proceeding of the 13th International Conference on Distributed Computing Systems,Pittsburgh,PA,1993:2-11.
    [20]狄刚HTTP实现代理服务器及缓存替换算法的研究[D].吉林大学硕士学位论文.2010:21-22.
    [21]孟彩霞,叶海琴.Web缓存替换策略综述[J].福建电脑.2009年,第9期.
    [22]S.Williams,M.Abrams,C.Standridge,G.Abdulla,E.Fox.Removal Policies in Network Caches for World-Wide Web DocumentsC. Proceedings of ACM SIGCOMM, Stanford, CA,1996:293-305.
    [23]M.Abrams,C.R.Standridge,G.Abdulla,S.Williams,and E.A.Fox,Caching proxies: limitations and potentials, Proceedings of the 4th International WWW Conference, Boston,MA,Dec.1995.
    [24]杨春贵,吴产乐,彭鸿雁.一种有效的Web代理缓存替换算法[J].计算机工程,2007,33(3):43-44,47.
    [25]R.P.Wooster and M.Abrams,Proxy caching that estimates page load delays, Proceedings of the 6th International WWW Conference, April 1997 (http://www.cs.vt.edu/ chitra/docs/www6r/).
    [26]P. Lorenzetti, L. Rizzo, and L. Vicisano, Replacement policies for a proxy cache.
    [27]P. Scheuermann, J. Shim, and R. Vingralek, A case for delay-conscious caching of Web documents, Proceedings of the 6th International WWW Conference, Santa Clara, Apr. 1997.
    [28]J.C.Bolot and P.Hoschka,Performance engineering of the World-Wide Web:Application to dimensioning and cache design, Proceedings of the 5th International WWW Conference, Paris, France, May 1996.
    [29]C.Aggarwal,J.L.Wolf,and P.S.Yu, Caching on theWorld Wide Web, IEEE Transactions on Knowledge and data Engineering, Vol.11, No.1, January/February 1999.
    [30]Memcached官网:http://memcached.org/about.
    [31]陈先在,张丽萍Linux C函数实例速查手册[M].人民邮电出版社.2009.1.
    [32]Jeff Bonwick. An Object-Caching Kernel Memory Allocator.1994.
    [33]赵鲲鹏,苏葆光linux内存管理中的Slab分配机制.现代计算机[J].2006.5第235期.
    [34]郭玉东Linux操作系统结构分析[M].西安电子科技大学出版社.2002:143-156.
    [35]E.Heymann, M. A.Senar, E.Luque, and M.Livny. "Adaptive scheduling for master-worker applications on the computational grid". In Proc. Of the 1st IEEE/ACM International Workshop on Grid Computing (Grid2000), 2000.
    [36]J.-P.Goux and J.Linderoth, and M.Yoder, "Metacomputing and the master-worker paradigm" Preprint ANL/MCS-P792-0200, Mathematics and Computer Science Division, Argonne National Laboratory, 2000.
    [37]J.P. Goux et al. An Enabling Framework for master-worker Applicaions on The Computational Grid. In the 9th IEEE International Symposium on High Performance Distributed Computing, 2000.
    [38]http://burtleburtle.net/bob/hash/doobs.html.
    [39]王嘉佳,张前进.基于SASL的LDAP认证机制研究[J].电子科技.2006年第11期.
    [40]沈千里.基于SASL的SMTP认证的分析与实现[J].计算机应用.2004年3月.Vol.24No.3.
    [41]马路遥OpenLDAP使用SASL认证.开放系统世界.2006年第6期:70-71.
    [42]BinaryProtocolRevamped:http://code.google.com/p/memcached/wiki/ BinaryProtocolRevamped.
    [43]https://github.com/memcached/memcached/blob/master/doc/protocol.txt.
    [44]David Karger,Eric Lehman,Tom Leighton,Matthew Levine,Daniel Lewin,Rina Panigrahy.Consistent hashing and random trees:distributed caching protocols for relieving hot spots on the world wide web. In Proceedings of the twenty-ninth annual ACM symposium on Theory of computing (1997),ACM Press, pp.654-663.
    [45]David Karger,Alex Sherman,Andy Berkheimer,Bill Bogstad,Rizwan Dhanidina Ken Iwamoto,Brian Kim,Luke Matkins,Yoav Yerushalmi.Web Caching with Consistent Hashing.Computer Networks 31 (11):1203-1213.
    [46]Erich Gamma,Richard Helm,Ralph Johnson,John Vlissides设计模式:可复用面向对象软件的基础[M].李英军,马晓星,蔡敏,刘建中.机械工业出版社.2007:70-77.
    [47]Lv Min.An Establishment and Management System of Production Planning and Scheduling for Large-piece OKP Enterprise. IEEE.2009.978-1-4244-3672-9/09/2009.
    [48]阎宏Java与模式[M].电子工业出版社.2007:151-157.
    [49]Robert C.Martin敏捷软件开发——原则、模式与实践[M].邓辉,孙鸣.人民邮电出版社.2008.
    [50]赵宏宇.精通C程序设计教程[M].西南交通大学出版社.2004:236-239.
    [51]佟伟光.软件测试[M].人民邮电出版社.2008.5.

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700