Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Pointers on debugging bundle startup times
Pointers on debugging bundle startup times [message #725718] Thu, 15 September 2011 15:26 Go to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Hi.

I am running a Virgo server with my application bundles. A couple of bundles seem to take an excessive amount of time starting up, i.e. going from the "Starting" stage to the "Started" stage.

What are the recommended ways to go about trying to figure out what the (not at all apparent) bottlenecks are?

Apologies if this is a trivial question.

TIA,
B.
Re: Pointers on debugging bundle startup times [message #725731 is a reply to message #725718] Thu, 15 September 2011 15:57 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Are those bundles spring based? Are you importing a lot of required services?

If you are using spring osgi namespace to import services - try to set those up as optional and see if boot time decreases.

There could also be a lot of import expansion going on and you are spending a lot of time in a resolver. How large is your package import set?
Re: Pointers on debugging bundle startup times [message #725741 is a reply to message #725731] Thu, 15 September 2011 16:19 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Thanks Dmitry. Please see my comments below.

Quote:
Are those bundles spring based?


Yes, they are.

Quote:
Are you importing a lot of required services?


No, we are still at the beginning of development, so the bundles are quite tiny and simple. For instance, one of the bundles in question registers a service and consumes three other services (all via Spring DM)

Quote:
If you are using spring osgi namespace to import services - try to set those up as optional and see if boot time decreases.


I can try doing that as an exercise, but those services are really required.

Quote:
There could also be a lot of import expansion going on and you are spending a lot of time in a resolver. How large is your package import set?


Again, the import set is small; here's the Import-Package snippet from the same bundle:
Import-Package: com.iggroup.wb.core.common.exceptions,
 com.iggroup.wb.core.common.utils.bundlemanagement.repository,
 com.iggroup.wb.core.common.utils.bundlemanagement.repository.codec,
 com.iggroup.wb.core.logger.api,
 com.iggroup.wb.overseer.api.business,
 com.iggroup.wb.overseer.api.domain,
 com.iggroup.wb.overseer.api.ui,
 com.iggroup.wb.overseer.authenticator.api,
 com.iggroup.wb.overseer.domain,
 org.apache.commons.lang,
 org.junit,
 org.osgi.framework,
 org.springframework.core.io


The com.iggroup.* packages are exported by other very small bundles and only contain a few classes each.

Re: Pointers on debugging bundle startup times [message #725761 is a reply to message #725741] Thu, 15 September 2011 17:41 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
If this is a CPU bottleneck, you might get some useful data by profiling.
Re: Pointers on debugging bundle startup times [message #725771 is a reply to message #725761] Thu, 15 September 2011 18:08 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
As Glyn mentioned - without profiling there isn't much that I can think of.

Are all of the dependencies faulted in by the resolver, i.e. deployed to repository/usr and started on demand?
Can you try taking all of the small bundles that provide your imported packages and deploy them manually before deploying your main application bundle?
Drop them into pickup or create a plan and deploy that. Deploy your application into hot server.

[Updated on: Thu, 15 September 2011 18:08]

Report message to a moderator

Re: Pointers on debugging bundle startup times [message #725912 is a reply to message #725771] Fri, 16 September 2011 07:31 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Dmitry and Glyn, thanks for the pointers, I will experiment with those.

Just a final question: which tool do you suggest for profiling OSGi apps? So far I have only used profilers for Java applications with a main() method.

Thanks!
Re: Pointers on debugging bundle startup times [message #726048 is a reply to message #725912] Fri, 16 September 2011 13:21 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
You can use yourkit, jprofiler, netbeans profiler, etc...

Whichever profiler you choose - it will try to instrument your running code to get metrics. You will need to modify lib/java6-server.profile to include profiler specific packages as described here: http://wiki.eclipse.org/Virgo/Diagnostics#Profiling
Re: Pointers on debugging bundle startup times [message #726246 is a reply to message #726048] Fri, 16 September 2011 21:59 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I recommend YourKit as it has worked really well with Virgo in the past.
Re: Pointers on debugging bundle startup times [message #727044 is a reply to message #726246] Tue, 20 September 2011 09:37 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Thanks, will give YourKit a try.
Re: Pointers on debugging bundle startup times [message #727974 is a reply to message #727044] Thu, 22 September 2011 10:19 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
As Dmitri mentioned in one of the previous reply, the whole delay seems to be simply caused by bundles being deployed out of their implicit order and, as a consequence, wait times for service startup.

Interestingly, this delay is considerable in my dev sandbox server (where I can clearly see "Waiting for service xxx" type messages) but it all but disappears in my final installed app. Why is that? Surely services startup time has to be accounted for in both cases.

Also, in order to deploy bundles in the correct order in my sandbox server, do I really have to deploy them one by one (which is getting tedious with number of bundles increasing) or can I deploy a plan that specifies the correct order end rely on this order to be respected?

Thanks,
B.

[Updated on: Thu, 22 September 2011 11:15]

Report message to a moderator

Re: Pointers on debugging bundle startup times [message #728002 is a reply to message #727974] Thu, 22 September 2011 11:14 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Yes, the order bundles are specified in a plan is the order in which they are installed and then the order in which they are started.
Re: Pointers on debugging bundle startup times [message #728003 is a reply to message #728002] Thu, 22 September 2011 11:17 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Thanks Glyn.

I just amended the message you responded to. You replied to my last question, but I still have a lingering question regarding the reason why this delay is considerable in my dev sandbox server (where I can clearly see "Waiting for service xxx" type messages) but it all but disappears in my final installed app. Why is that? Surely services startup time has to be accounted for in both cases.

BTW, I am very happy about performance in my final app, kudos to you all, Virgo guys!!!
Re: Pointers on debugging bundle startup times [message #728010 is a reply to message #728003] Thu, 22 September 2011 11:26 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I would expect this behaviour to be due to some subtle, or not to subtle, difference in performance between the dev and production servers.

Are there differences between your dev and your production servers which could make them perform differently, e.g. machine, OS, JVM configuration such as heap size, etc.? Are there any other differences in terms of Virgo configuration or artifacts deployed?
Re: Pointers on debugging bundle startup times [message #728033 is a reply to message #728010] Thu, 22 September 2011 12:34 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
At this stage I am packaging up and deploying an instance of the same Virgo kernel that I use for my dev sandbox to my own machine, so same Virgo kernel and exactly same execution environment.
Re: Pointers on debugging bundle startup times [message #728035 is a reply to message #728033] Thu, 22 September 2011 12:37 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Then I can't easily explain the difference in behaviour you are seeing. There must be some significant difference...
Re: Pointers on debugging bundle startup times [message #728252 is a reply to message #728035] Thu, 22 September 2011 19:37 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Are you deploying through STS during development?
Re: Pointers on debugging bundle startup times [message #728395 is a reply to message #728252] Fri, 23 September 2011 07:53 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Yes.
Re: Pointers on debugging bundle startup times [message #728655 is a reply to message #728395] Fri, 23 September 2011 15:37 Go to previous message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Can you check on the development system if the deployment time is consistent with production when you deploy without using STS. Just drop the plan/bundles in required locations and start the server.

I would expect deployment to be much more laborious through tooling.
Previous Topic:Vanilla virgo-tomcat-server-3.0.1.RELEASE fails to start on ubuntu
Next Topic:NoClassDefFound: javax.persistence.criteria.CriteriaQuery
Goto Forum:
  


Current Time: Thu Oct 23 15:15:34 GMT 2014

Powered by FUDForum. Page generated in 0.04886 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software