On 9/1/08, Rajini Sivaram <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [email protected]
>> 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

Reply via email to