components.html
来自「基于mondrian 开源框架进行OLAP多维分析」· HTML 代码 · 共 185 行
HTML
185 行
<html><!-- == $Id: //open/mondrian-release/3.0/doc/components.html#2 $ == This software is subject to the terms of the Common Public License == Agreement, available at the following URL: == http://www.opensource.org/licenses/cpl.html. == Copyright (C) 2002-2006 Julian Hyde == All Rights Reserved. == You must accept the terms of that agreement to use this software. --><head> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <title>Pentaho Analysis Services: Mondrian Components</title></head><body><!-- doc2web start --><!-- page title --><div class="contentheading">Mondrian Components</div><!-- end page title --><!-- ########################## Introduction ############################# --><h3>Introduction</h3><p>See <a href="olap.html">OLAP</a> and <ahref="architecture.html">architecture</a>.</p><!-- ########################## overview start ############################# --><h3>Components</h3><i>to be written...</i><!-- ########################## Caching ############################# --><h3>Caching<a name="caching"> </a></h3><p>The various subsystems of mondrian have different memory requirements. Someof them require a fixed amount of memory to do their work, whereas others canexploit extra memory to increase their performance. This is an overview of howthe various subsystems use memory.</p><p><dfn>Caching</dfn> is a scheme whereby acomponent uses extra memory when it is available in order to boost itsperformance, and when times are hard, it releases memory with loss ofperformance but with no loss of correctness. A cache is the use of extramemory when times are good, use varying amounts of memory.</p><p><dfn>Garbage collection</dfn> is carried out bythe Java VM to reclaim objects which are unreachable from 'live' objects. Aspecial construct called a <i>soft reference</i> allows objects to begarbage-collected in hard times.</p><p>The garbage collector is not very discriminating in what it chooses to throwout, so mondrian has its own caching strategy. There are several caches in thesystem (described below), but they all of the objects in these caches areregistered in the singleton instance of<a href="api/mondrian/rolap/CachePool.html">class mondrian.rolap.CachePool</a> (currently there is just a single instance).The cache pool doesn't actually store the objects, but handles all of the eventsrelated to their life cycle in a cache. It weighs objects' cost (some functioninvolving their size in bytes and their usefulness, which is based upon howrecently they were used) and their benefit (the effort it would take tore-compute them).</p><p>The cache pool is not infallible — in particular, it can not adapt to conditions where memory is in short supply — so usessoft references, so thatthe garbage collector can overrule its wisdom.</p><p>Cached objects must obey the following contract:</p><ol> <li> <p>They must implement <a href="api/mondrian/rolap/CachePool.Cacheable.html"> interface mondrian.rolap.CachePool.Cacheable</a>, which includes methods to measure objects' cost, benefit, record each time they are used, and tell them to remove themselves from their cache.</li> <li>They must call <a href="api/mondrian/rolap/CachePool.html#register(Cacheable)">CachePool.register(Cacheable)</a> either in their constructor or, in any case, before they are made visible in their cache.</li> <li>They they must call <a href="api/mondrian/rolap/CachePool.html#registerDeath"> CachePool.unregister(Cacheable)</a> when they are removed from their cache and in their <code>finalize()</code> method.</li> <li>They must be despensable: if they disappear, their subsystem will continue to work correctly, albeit slower. A subsystem can declare an object to be temporarily indispensable by calling <a href="api/mondrian/rolap/CachePool.html#pin(Cacheable,Collection)">CachePool.pin(Cacheable, Collection)</a> and then unpin it a short time later.</li> <li dir="ltr"> <p dir="ltr">Their cache must reference them via soft references, so that they are available for garbage collection. </li> <li>Thread safety. Their cache must be thread-safe.</li></ol><p>If a cached object takes a significant time to initialize, it may not bepossible to construct it, register it, and initialize it within the samesynchronized section without unnacceptably reducing concurrency. If this is thecase, you should use phased construction. First construct and register theobject, but mark it 'under construction'. Then release the lock on the CachePooland the object's cache, and continue initializing the object. Other threads willbe able to see the object, and should be able to wait until the object isconstructed. The method<a href="api/mondrian/rolap/agg/Segment.html#waitUntilLoaded()">Segment.waitUntilLoaded()</a> is an example of this.</p><p>The following objects are cached.</p><!-- ########################## 1. Segment ############################# --><h1>1. Segment<a name="#segment"> </a></h1><p>A Segment (<a href="api/mondrian/rolap/agg/Segment.html">classmondrian.rolap.agg.Segment</a>) is a collection of cell values parameterized bya measure, and a set of (column, value) pairs. An example of a segment is</p><blockquote> <p>(Unit sales, Gender = 'F', State in {'CA','OR'}, Marital Status = <i> anything</i>)</p></blockquote><p>All segments over the same set of columns belong to an Aggregation, in thiscase</p><blockquote> <p>('Sales' Star, Gender, State, Marital Status)</p></blockquote><p>Note that different measures (in the same Star) occupy the same Aggregation.Aggregations belong to the AggregationManager, a singleton.</p><p>Segments are pinned during the evaluation of a single MDX query. The queryevaluates the expressions twice. The first pass, it finds which cell values itneeds, pins the segments containing the ones which are already present (onepin-count for each cell value used), and builds a cell request (<a href="api/mondrian/rolap/CachePool.Cacheable.html">classmondrian.rolap.agg.CellRequest</a>) for those which are not present. It executesthe cell request to bring the required cell values into the cache, again,pinned. Then it evalutes the query a second time, knowing that all cell valuesare available. Finally, it releases the pins.</p><!-- ########################## 2. Member set ############################# --><h1>2. Member set<a name="memberset"> </a></h1><p>A member set (<a href="api/mondrian/rolap/SmartMemberReaderChildrenList.html">classmondrian.rolap.SmartMemberReader.ChildrenList</a>) is a set of children of aparticular member. It belongs to a member reader (<a href="api/mondrian/rolap/SmartMemberReader.html">classmondrian.rolap.SmartMemberReader</a>).</p><!-- ########################## 3. Schema ############################# --><h1>3. Schema<a name="schema"> </a></h1><p>Schemas (<a href="api/mondrian/rolap/RolapSchema.html">classmondrian.rolap.RolapSchema</a>) are cached in<a href="api/mondrian/rolap/RolapStar.Pool.html">classmondrian.rolap.RolapSchema.Pool</a>, which is a singleton (todo: use softreferences). The cache key is the URL which the schema was loaded from.</p><!-- ########################### 4. Star schemas ############################## --><h1>4. Star schemas<a name="starSchemas"> </a></h1><p>Star schemas (<a href="api/mondrian/rolap/RolapStar.html">classmondrian.rolap.RolapStar</a>) are stored in the static member <code>RolapStar.stars</code> (todo: use soft references), and accessed via <code>RolapStar.getOrCreateStar(RolapSchema, MondrianDef.Relation)</code>.</p><br /><br /><hr noshade size="1"/><p> Author: Julian Hyde; last modified August 2006.<br/> Version: $Id: //open/mondrian-release/3.0/doc/components.html#2 $ (<a href="http://p4web.eigenbase.org/open/mondrian/doc/components.html?ac=22">log</a>)<br/> Copyright (C) 2002-2006 Julian Hyde</p><br /><!-- doc2web end --></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?