John Ross created ARIES-1392:
--------------------------------
Summary: Provide a more efficient implementation of a system
repository.
Key: ARIES-1392
URL: https://issues.apache.org/jira/browse/ARIES-1392
Project: Aries
Issue Type: Improvement
Components: Subsystem
Affects Versions: subsystem-2.0.2
Reporter: John Ross
Assignee: John Ross
While running the same test case developed as part of ARIES-1357, profiling
continually showed a bottleneck surrounding the system repository. A more
efficient implementation has been provided using code copied over from the
Apache Felix (http://felix.apache.org/) project.
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java?view=log
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java?view=log
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java?view=log
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringComparator.java?view=log
These classes were copied to the org.apache.aries.subsystem.core.capabilityset
package with some modifications. A new repository implementation called
CapabilitySetRepository was created using these classes from the Felix project.
This repository will index the standard namespaces along with their associated
namespace attributes. It will also create additional capability sets as
necessary when encountering custom namespaces.
The system repository now delegates to CapabilitySetRepository. In addition,
the system repository now tracks both bundles and subsystem services.
Capabilities are added to the repository as they appear and removed when they
go away. Bundle revisions are wrapped with BundleRevisionResource in order to
account for service capabilities.
Other changes resulting from this optimization are listed below. They were
necessary and appropriate because either (a) BundleRevisionResource became part
of the normal flow when delivered from the system repository, or (b) computing
service capabilities for the system repository requires searching for
blueprint.xml files in the bundle which causes the framework to attempt a
resolution.
(1) BundleResourceInstaller must now check for BundleRevisionResource in
addition to BundleRevision when installing a bundle.
(2) BundleRevisionResource now provides access to the wrapped BundleRevision.
(3) ResolveContext must now check for BundleRevisionResource in addition to
BundleResource when identifying the region of an already installed resource.
(4) SubsystemResolverHook will now prevent bundles not referenced by any
subsystems from resolving. A non-referenced bundle is one that is being
installed as part of a subsystem installation before it has been added as a
reference.
(5) Utils now includes BundleRevisionResource, in addition to BasicSubsystem
and BundleRevision, as a shared resource, which is essentially any resource
that has already been installed and being referenced by a new subsystem.
(6) RootSubsystemTest was modified to allow for the RESOLVED state when
ensuring the bundle has not been started. Frameworks are allowed to attempt to
resolve bundles as needed, and subsystems no longer prevent resolution after
entering the installed state, which is the case in this test.
As part of future work, some of the other internal repository implementations,
such as ContentRepository, LocalRepository, and PreferredProviderRepository,
should be modified to use CapabilitySetRepository as well.
The measurements used the same test scenario being developed as part of
ARIES-1357. The time it took to install 50 features was measured. Each feature
consists of 10 bundles plus one application. All features share the same 10
bundles. Each bundle exports 5 unique packages. Each application consists of 10
unique bundles. The bundles import packages offered by the containing feature.
Baseline
Average time across 1 trials: 25843.0 ms
Average time across 1 trials: 25824.0 ms
Average time across 1 trials: 25767.0 ms
Average time across 1 trials: 26043.0 ms
Average time across 1 trials: 25819.0 ms
25859.2
New System Repository
Average time across 1 trials: 12260.0 ms
Average time across 1 trials: 11658.0 ms
Average time across 1 trials: 11602.0 ms
Average time across 1 trials: 11485.0 ms
Average time across 1 trials: 11629.0 ms
11726.8
A 54.7% improvement.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)