[
https://issues.apache.org/jira/browse/FELIX-4692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14265944#comment-14265944
]
Felix Meschberger commented on FELIX-4692:
------------------------------------------
For illustration purposes some measurments of the
{{ServiceRegistry.getServiceReferences(String className, SimpleFilter filter)}}
method.
|| Period || #1 || #2 || #3 || #4 || #5 ||
#6 || ||
| Startup | 8720 | 8720 | 8720 | 8720 | 8722 | 8720 | calls
to getServiceReferences method |
| | 4074 | 3983 | 3740 | 1397 | 1086 | 1017 |
Total ms spent in method |
| Startup + Shutdown | 15093 | 15105 | 15075 | 15091 | 15199 | 15197 | calls to
getServiceReferences method |
| | 12951 | 13039 | 12012 | 4336 | 3144 | 3101
| Total ms spent in method |
# Unmodified framework at Rev. 1649764
# Guard {{matches.retainAll(caps)}} call only -- not that much of an influence,
interestingly; probably not doing much work most of the time due to small set
of entries in the matches set.
# Guard {{matches.retainAll(caps)}} call and not wrapping set in ArrayList --
some more improvement, nothing drammatic yet
# Guard {{matches.retainAll(caps)}} call, not wrapping set in ArrayList,
special case code (not in the patch) to specially handle
{{SimpleFilter.PRESENT}} filters - starts to go into the right direction
# [^FELIX-4692-2.patch] applied -- since the presence check derives from access
to services with a {{null}} service interface, changing the filter to
{{MATCH_ALL}} instead looks even better and makes for simpler code in the
{{CapabilitySet}} not requiring special handling of the presence check.
# [^FELIX-4692.diff] applied -- best numbers but most complex and thus not used.
All tests are run on an mid-2013 MacBook Air 13 with 1.7 GHz Intel Core i7, 8GB
RAM, and SSD. The absolute values vary but relative values across the options
are interesting.
> Improve Service access time
> ---------------------------
>
> Key: FELIX-4692
> URL: https://issues.apache.org/jira/browse/FELIX-4692
> Project: Felix
> Issue Type: Improvement
> Components: Framework
> Affects Versions: framework-4.4.1
> Reporter: Felix Meschberger
> Assignee: Felix Meschberger
> Fix For: framework-4.6.0
>
> Attachments: FELIX-4692-2.patch, FELIX-4692.diff
>
>
> Currently the ServiceRegistry takes roughly 1ms to access a single service.
> In a reasonably large system, this may over time consume considerable time.
> For example in our inhouse system sporting roughly 5000 services with 15'000
> service accesses during startup, these accesses acount for almost 15 seconds
> or roughly 25-30% of the total startup time.
> Internally all accesses to services are handled with a Filter even if the
> service is simply retrieved with the service name without a filter. This
> causes a considerable overhead.
> A simple improvement is to keep services not only in a global Capabitliy Set
> accessible through generic filters but also keep such a set for each
> registered service name.
> The measured improvement of this change is substantial: accessing these
> 15'000 services now only takes roughly 3 seconds or 0.2 ms per service or 5
> times faster.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)