[农林牧渔]分布式存储及应用系统架构分析

[农林牧渔]分布式存储及应用系统架构分析

ID:33159610

大小:1.29 MB

页数:83页

时间:2019-02-21

[农林牧渔]分布式存储及应用系统架构分析_第1页
[农林牧渔]分布式存储及应用系统架构分析_第2页
[农林牧渔]分布式存储及应用系统架构分析_第3页
[农林牧渔]分布式存储及应用系统架构分析_第4页
[农林牧渔]分布式存储及应用系统架构分析_第5页
资源描述:

《[农林牧渔]分布式存储及应用系统架构分析》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、分布式存储及应用系统架构分析文件更改摘要:日期修订说明修订人批准人2010-4-4创建龙兴平修订记录龙兴平(MSN:lxp8@sina.com)第83页共83页2021-8-6目录1Memcached1.1Memcached架构memcached是高性能的分布式内存缓存服务器。一般的使用目的是,通过缓存数据库查询结果,减少数据库访问次数,以提高动态Web应用的速度、提高可扩展性。龙兴平(MSN:lxp8@sina.com)第83页共83页2021-8-61.1Memcache实现分析理解1.1.1实现结构SpeedOfcourse,thepr

2、imarymotivationforcachingisspeed,soMemcachedisdesignedtobeasfastaspossible.TheinitialprototypeofMemcachedwaswritteninPerl.AlthoughIlovePerl,theprototypewaslaughablyslowandbloated.Perltradesoffmemoryusageforeverything,soalotofpreciousmemorywaswasted,andPerlcan'thandletonsofn

3、etworkconnectionsatonce.ThecurrentversioniswritteninCasasingle-process,single-threaded,asynchronousI/O,event-basedd?mon.Forportabilityandspeed,weuselibevent(seetheon-lineResourcessection)foreventnotification.Theadvantageoflibeventisthatitpicksthebestavailablestrategyfordeal

4、ingwithfiledescriptorsatruntime.Forexample,itchooseskqueueonBSDandepollonLinux2.6,whichareefficientwhendealingwiththousandsofconcurrentconnections.Onothersystems,libeventfallsbacktothetraditionalpollandselectmethods.InsideMemcached,allalgorithmsareO(1).Thatis,theruntimeofth

5、ealgorithmsandCPUusednevervarieswiththenumberofconcurrentclients,atleastwhenusingkqueueorepoll,orwiththesizeofthedataoranyotherfactor.Ofnote,Memcachedusesaslaballocatorformemoryallocation.EarlyversionsofMemcachedusedthemallocfromglibcandendedupfallingontheirfacesafterabouta

6、week,eatingupalotofCPUspaceduetoaddressspacefragmentation.Aslaballocatorallocatesonlylargechunksofmemory,slicingthemupintolittlechunksforparticularclassesofitems,thenmaintaining龙兴平(MSN:lxp8@sina.com)第83页共83页2021-8-6freelistsforeachclasswheneveranobjectisfreed.SeetheBonwickp

7、aperinResourcesformoredetails.Memcachedcurrentlygeneratesslabclassesforallpower-of-twosizesfrom64bytesto1MB,anditallocatesanobjectofthesmallestsizethatcanholdasubmitteditem.Asaresultofusingaslaballocator,wecanguaranteeperformanceoveranylengthoftime.Indeed,we'vehadproduction

8、Memcachedserversupfor4–5monthsatatime,averaging7,000queries/second,withoutproblems

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。