You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Rajini Sivaram <ra...@googlemail.com> on 2008/09/01 11:26:13 UTC
Re: Performance of extensibility-osgi
Raymond,
I would expect iterating through BundleContext.getBundles() every time to
be quite expensive compared to maintaining a set of bundles, updated using a
listener (we already do this in modules/osgi-runtime to maintain a thread
context classloader, and this used to be the way we did service discovery
for OSGi).
On 8/29/08, Raymond Feng <en...@gmail.com> wrote:
>
> Hi,
>
> Can you help a bit on the poor-man's profiling? In the class of
> org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer and
> org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer.ClassLoaderImpl,
> there are API calls such as:
>
> BundleContext.getBundles()
> Bundle.getEntry(...)
> Bundle.findEntries(...)
>
> It would be really helpful if you can give us some rough ideas around these
> potential bottlenecks.
>
> Thanks,
> Raymond
>
> From: Rajini Sivaram
> Sent: Friday, August 29, 2008 7:50 AM
> To: dev@tuscany.apache.org
> Subject: Performance of extensibility-osgi
>
>
>
> I think there is a very big classloading performance issue with
> extensibility-osgi. Running itest/osgi-tuscany/osgi-tuscany-test takes three
> times as much time using the ServiceDiscoverer in extensibility-osgi
> compared to using the standard Classloader based ServiceDiscoverer using the
> BundleClassloader as we used to.
>
> With the current build of Tuscany on my thinkpad:
>
> Using extensibility-osgi
> [INFO] Apache Tuscany OSGi-Based Tuscany Runtime Tests ....... SUCCESS
> [14:09.609s]
> The same build without extensibility-osgi (with BundleClassloader as TCCL)
> [INFO] Apache Tuscany OSGi-Based Tuscany Runtime Tests ....... SUCCESS
> [3:54.796s]
>
>
> These figures show around 10 minutes extra execution time, attributed
> purely to classloading differences. Even though these tests show a
> worst-case scenario since there is an awful lot of classloading going on
> here with Tuscany being loaded many times, I think we should address this
> because the impact is significant.
>
>
> Thank you...
>
> Regards,
>
> Rajini
>
--
Thank you...
Regards,
Rajini
Re: Performance of extensibility-osgi
Posted by Raymond Feng <en...@gmail.com>.
I did a bit debugging with Felix. Bundle.findEntries() try to iterate
through all the entries and do a name matching. That's probably why it's
more expensive. I assume there will be at most one entry for the same
service name per bundle, so we can use the Bundle.getEntry(name) which is a
fast indexed lookup.
Thanks,
Raymond
From: Rajini Sivaram
Sent: Monday, September 01, 2008 2:56 AM
To: dev@tuscany.apache.org
Subject: Re: Performance of extensibility-osgi
On 9/1/08, Rajini Sivaram <ra...@googlemail.com> wrote:
Raymond,
I would expect iterating through BundleContext.getBundles() every time to
be quite expensive compared to maintaining a set of bundles, updated using a
listener (we already do this in modules/osgi-runtime to maintain a thread
context classloader, and this used to be the way we did service discovery
for OSGi).
Sorry, looking at the implementation of getBundles(), it doesn't look
particularly expensive. So I tried using
bundle.getResource()/bundle.getResources() instead of bundle.findEntries().
That does speed things up quite a lot. For META-INF/services, you should be
able to use getResource() since it is a package that is not
exported/imported.
On 8/29/08, Raymond Feng <en...@gmail.com> wrote:
Hi,
Can you help a bit on the poor-man's profiling? In the class of
org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer and
org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer.ClassLoaderImpl,
there are API calls such as:
BundleContext.getBundles()
Bundle.getEntry(...)
Bundle.findEntries(...)
It would be really helpful if you can give us some rough ideas around these
potential bottlenecks.
Thanks,
Raymond
From: Rajini Sivaram
Sent: Friday, August 29, 2008 7:50 AM
To: dev@tuscany.apache.org
Subject: Performance of extensibility-osgi
I think there is a very big classloading performance issue with
extensibility-osgi. Running itest/osgi-tuscany/osgi-tuscany-test takes three
times as much time using the ServiceDiscoverer in extensibility-osgi
compared to using the standard Classloader based ServiceDiscoverer using the
BundleClassloader as we used to.
With the current build of Tuscany on my thinkpad:
Using extensibility-osgi
[INFO] Apache Tuscany OSGi-Based Tuscany Runtime Tests ....... SUCCESS
[14:09.609s]
The same build without extensibility-osgi (with BundleClassloader as TCCL)
[INFO] Apache Tuscany OSGi-Based Tuscany Runtime Tests ....... SUCCESS
[3:54.796s]
These figures show around 10 minutes extra execution time, attributed purely
to classloading differences. Even though these tests show a worst-case
scenario since there is an awful lot of classloading going on here with
Tuscany being loaded many times, I think we should address this because the
impact is significant.
Thank you...
Regards,
Rajini
--
Thank you...
Regards,
Rajini
--
Thank you...
Regards,
Rajini
Re: Performance of extensibility-osgi
Posted by Rajini Sivaram <ra...@googlemail.com>.
On 9/1/08, Rajini Sivaram <ra...@googlemail.com> wrote:
>
> Raymond,
>
> I would expect iterating through BundleContext.getBundles() every time to
> be quite expensive compared to maintaining a set of bundles, updated using a
> listener (we already do this in modules/osgi-runtime to maintain a thread
> context classloader, and this used to be the way we did service discovery
> for OSGi).
>
Sorry, looking at the implementation of getBundles(), it doesn't look
particularly expensive. So I tried using
bundle.getResource()/bundle.getResources() instead of bundle.findEntries().
That does speed things up quite a lot. For META-INF/services, you should be
able to use getResource() since it is a package that is not
exported/imported.
>
> On 8/29/08, Raymond Feng <en...@gmail.com> wrote:
>>
>> Hi,
>>
>> Can you help a bit on the poor-man's profiling? In the class of
>> org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer and
>> org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer.ClassLoaderImpl,
>> there are API calls such as:
>>
>> BundleContext.getBundles()
>> Bundle.getEntry(...)
>> Bundle.findEntries(...)
>>
>> It would be really helpful if you can give us some rough ideas around
>> these potential bottlenecks.
>>
>> Thanks,
>> Raymond
>>
>> From: Rajini Sivaram
>> Sent: Friday, August 29, 2008 7:50 AM
>> To: dev@tuscany.apache.org
>> Subject: Performance of extensibility-osgi
>>
>>
>>
>> I think there is a very big classloading performance issue with
>> extensibility-osgi. Running itest/osgi-tuscany/osgi-tuscany-test takes three
>> times as much time using the ServiceDiscoverer in extensibility-osgi
>> compared to using the standard Classloader based ServiceDiscoverer using the
>> BundleClassloader as we used to.
>>
>> With the current build of Tuscany on my thinkpad:
>>
>> Using extensibility-osgi
>> [INFO] Apache Tuscany OSGi-Based Tuscany Runtime Tests ....... SUCCESS
>> [14:09.609s]
>> The same build without extensibility-osgi (with BundleClassloader as TCCL)
>> [INFO] Apache Tuscany OSGi-Based Tuscany Runtime Tests ....... SUCCESS
>> [3:54.796s]
>>
>>
>> These figures show around 10 minutes extra execution time, attributed
>> purely to classloading differences. Even though these tests show a
>> worst-case scenario since there is an awful lot of classloading going on
>> here with Tuscany being loaded many times, I think we should address this
>> because the impact is significant.
>>
>>
>> Thank you...
>>
>> Regards,
>>
>> Rajini
>>
>
>
>
> --
> Thank you...
>
> Regards,
>
> Rajini
--
Thank you...
Regards,
Rajini