资源描述:
《elasticsearch设计思路》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、elasticsearchTheRoadtoaDistributed,(Near)RealTime,SearchEngineShayBanon-@kimchyTuesday,June7,2011LuceneBasics-DirectoryAFileSystemAbstractionMainlyusedtoreadandwrite“files”UsedtoreadandwritedifferentindexfilesTuesday,June7,2011LuceneBasics-IndexWriterUsedtoadddocuments/
2、deletedocumentsfromtheindexChangesarestoredinmemory(possiblyflushingtomaintainmemorylimits)Requiresacommittomakechanges“persistent”,whichisexpensiveAsingleIndexWritercanwritetoanindex,expensivetocreate(reuseatallcost!)Tuesday,June7,2011LuceneBasics-IndexSegmentsAnindex
3、iscomposedofinternalsegmentsEachsegmentisalmostaselfsufficientindexbyitself,immutableuptodeletesCommits“officially”addssegmentstotheindex,thoughinternalflushingmightcreatenewsegmentsaswellSegmentsaremergedcontinuouslyAlotofcachingpersegment(terms,field)Tuesday,June7,2011L
4、uceneBasics-(Near)RealTimeIndexReaderisthebasisforsearchingIndexWriter#getReaderallowstogetarefreshedreaderthatseeschangesdonetoIWRequiresflushing(butnotcommitting)Can’tcallitoneachoperation,tooexpensiveSegmentbasedreadersandsearchTuesday,June7,2011DistributedDirectory
5、ImplementaDirectorythatworksontopofadistributed“system”Storefilechunks,readthemondemandImplementedformost(Java)datagridsCompass-GigaSpaces,Coherence,TerracottaInfinispanTuesday,June7,2011DistributedDirectoryNodeChunkChunkIndexWriterNodeDIRChunkChunkIndexReaderNodeChunkC
6、hunkTuesday,June7,2011DistributedDirectory“Chatty”-manynetworkroundtripstofetchdataBigindicesstillsufferfromanondistributedIndexReaderLuceneIndexReadercanbequite“heavy”SingleIndexWriterproblem,can’treallyscalewritesTuesday,June7,2011PartitioningDocumentPartitioningEac
7、hshardhasasubsetofthedocumentsAshardisafullyfunctional“index”TermPartitioningShardshassubsetoftermsforalldocsTuesday,June7,2011Partitioning-TermBasedpro:Ktermquery->handledatmostbyKshardspro:O(K)diskseeksforKtermquerycon:highnetworktrafficdataabouteachmatchingtermneeds
8、tobecollectedinoneplacecon:hardertohaveperdocinformation(facets/sorting/customscoring)Tuesday,June7,2011Partitioning-TermBas