blob: 8138cd7c4481526f634f0082024d539b053b444f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
<title>Apache Felix - Dependency Manager - Performance Tuning</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css" media="all">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
<div class="title">
<div class="logo">
<a href="https://felix.apache.org/">
<img border="0" alt="Apache Felix" src="/res/logo.png">
</a>
</div>
<div class="header">
<a href="https://www.apache.org/">
<img border="0" alt="Apache" src="/res/apache.png">
</a>
</div>
</div>
<div class="menu">
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p><a href="/news.html">News</a> <br />
<a href="/license.html">License</a> <br />
<a href="/downloads.cgi">Downloads</a> <br />
<a href="/documentation.html">Documentation</a> <br />
<a href="/documentation/community/project-info.html">Project Info</a> <br />
<a href="/documentation/community/contributing.html">Contributing</a> <br />
<a href="/sitemap.html">Site Map</a> <br />
<a href="https://www.apache.org/">ASF</a> <br />
<a href="https://www.apache.org/security/">Security</a> <br />
<a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> <br />
<a href="https://www.apache.org/foundation/thanks.html">Sponsors</a> </p>
<iframe
src="https://www.apache.org/ads/button.html"
style="border-width:0; float: left"
frameborder="0"
scrolling="no"
width="135"
height="135">
</iframe>
</div>
<div class="main">
<div class="breadcrump" style="font-size: 80%;">
<a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>&nbsp;&raquo&nbsp;<a href="/documentation/subprojects/apache-felix-dependency-manager.html">Apache Felix Dependency Manager</a>
</div>
<h1>Dependency Manager - Performance Tuning</h1>
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p>To further tune the performance of an application using Dependency Manager and a lot of services, we created the concept of filter indices. They work similarly to the way indices speed up relational database queries and are explained below.</p>
<h2 id="filter-indices">Filter Indices<a class="headerlink" href="#filter-indices" title="Permanent link">&para;</a></h2>
<p>Filter indices allow you to speed up the service resolution process by skipping the services registry, in favor of a fast index on given service properties.</p>
<p>The Dependency Manager will look for a set of filter indices in the <code>org.apache.felix.dependencymanager.filterindex</code> system property. This system property uses the following syntax,</p>
<div class="codehilite"><pre><span class="n">property</span><span class="o">-</span><span class="n">index</span> <span class="p">::=</span> <span class="n">service</span><span class="o">-</span><span class="n">property</span> <span class="o">|</span> <span class="n">service</span><span class="o">-</span><span class="n">property</span> <span class="s">&#39;,&#39;</span> <span class="n">property</span><span class="o">-</span><span class="n">index</span>
<span class="n">index</span> <span class="p">::=</span> <span class="s">&#39;*aspect*&#39;</span> <span class="o">|</span> <span class="s">&#39;*adapter*&#39;</span> <span class="o">|</span> <span class="n">property</span><span class="o">-</span><span class="n">index</span>
<span class="n">indices</span> <span class="p">::=</span> <span class="n">index</span> <span class="o">|</span> <span class="n">indices</span> <span class="s">&#39;;&#39;</span> <span class="n">index</span>
</pre></div>
<p>The implementation ships with three kinds of index implementations.</p>
<ul>
<li><em>Service property indices</em> are based on a set of service properties, like a multi-column index in a database. </li>
<li><em>Aspect indices</em> work with Dependency Manager Aspect services, and will provide indexing for the specific filters that they use.</li>
<li><em>Adapter indices</em> work like Aspect indices, but for Adapter services.</li>
</ul>
<h3 id="performance">Performance<a class="headerlink" href="#performance" title="Permanent link">&para;</a></h3>
<p>The index isn't free, but reduces the linear (and wasteful) filter-based lookup to an indexed log(n) lookup. You can expect noticeable speedup if you have at least several hundred services.</p>
<h3 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span class="o">-</span><span class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">felix</span><span class="p">.</span><span class="n">dependencymanager</span><span class="p">.</span><span class="n">filterindex</span><span class="p">=</span><span class="n">objectClass</span>
</pre></div>
<p>Sets an index on <code>objectClass</code>, speeding up lookups for any filter that contains an <code>objectClass</code> in its filter (all regular services do).</p>
<div class="codehilite"><pre><span class="o">-</span><span class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">felix</span><span class="p">.</span><span class="n">dependencymanager</span><span class="p">.</span><span class="n">filterindex</span><span class="p">=</span><span class="n">objectClass</span><span class="p">,</span><span class="n">id</span>
</pre></div>
<p>This filter helps if you have a lot of similar services, identified by some <code>id</code>.</p>
<div class="codehilite"><pre><span class="o">-</span><span class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">felix</span><span class="p">.</span><span class="n">dependencymanager</span><span class="p">.</span><span class="n">filterindex</span><span class="p">=</span><span class="n">objectClass</span><span class="p">,</span><span class="n">id</span><span class="p">;</span><span class="n">objectClass</span><span class="p">,</span><span class="n">ipAddress</span>
</pre></div>
<p>This is a set of two filter indices, helping when you have one set of services that has an <code>id</code>, and another set that uses an <code>ipAddress</code> for identification.</p>
<div class="codehilite"><pre><span class="o">-</span><span class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">felix</span><span class="p">.</span><span class="n">dependencymanager</span><span class="p">.</span><span class="n">filterindex</span><span class="p">=</span><span class="o">*</span><span class="n">aspect</span><span class="o">*</span>
</pre></div>
<p>Provides indexing for all Aspect services.</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
Rev. 1665812 by marrs on Wed, 11 Mar 2015 09:02:04 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project
logo are trademarks of The Apache Software Foundation. All other marks mentioned
may be trademarks or registered trademarks of their respective owners.
</div>
</div>
</body>
</html>