Announcement Announcement Module
Collapse
No announcement yet.
Tips Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tips

    Hey!

    We are using Spring for a fat client. And now we reached the edge when the startup time is not acceptable for users. Basically startup is a process of joining/loading different spring contexts. For the moment I counted 543 beans in total. I profiled the loading using CPU sampling and took "slow" initialization out to separate threads. That kind of helped, but still performance isn't perfect. It still takes more than 30 secs just to init the context. 30 secs may sounds okay for a server startup, however it's a fat client and believe me users complain about the slow startup a lot. I found out that the time of the internal context initialization (see below lines: 2,3) comparable to the time of classes initialization of the application (see below lines: 6,5,7). In other words the startup time is doubled due to the framework. Lazy loading is enabled, but frankly lazy-loading doesn't help that much in my case. It passes the problem to a later stage.

    Profiling scenario is pretty basic: new ClassPathXmlApplicationContext(locations);
    Time in ms

    Results for Spring 3.0.5
    1. Total 34187
    2. java.beans.Introspector.getBeanInfo(Class) called by (CachedIntrospectionResults) 11156
    3. org.springframework.aop.support AopUtils.getMostSpecificMethod(Method, Class) 4218
    4. java.lang.ClassLoader.loadClass(String) 2203
    5. java.lang.ClassLoader.loadClassInternal(String) 2125
    6. java.lang.reflect.Constructor.newInstance(Object[]) 3968
    7. java.lang.reflect.Method.invoke(Object, Object[]) 2765
    8. SUM of org.fatclient.beans.**.init> 9037

    Results for Spring 2.5.6
    1. Total 31140
    2. java.beans.Introspector.getBeanInfo(Class) called by (CachedIntrospectionResults) 11593
    3. org.springframework.aop.support AopUtils.getMostSpecificMethod(Method, Class) 1953
    4. java.lang.ClassLoader.loadClassInternal(String) 2171
    5. java.lang.ClassLoader.loadClass(String) 1968
    6. java.lang.reflect.Constructor.newInstance(Object[]) called by BeanUtils 4000
    7. java.lang.reflect.Method.invoke(Object, Object[]) 2937
    8. SUM of org.fatclient.beans.**.init> 8860

    As you see java.beans.Introspector.getBeanInfo(Class) spends ages exploring bean info. Is there any way to boost the loading up? Is there any easy and safe way to serialize the context (bean info) right after the first loading to avoid parsing and exploring for a next run? Is there any common guides, tips & tricks, container performance tuning guides?

    Thanks in advance for your help,
    Anton
    Last edited by ahtokca; Mar 30th, 2011, 10:13 AM. Reason: Title isn't good

  • #2
    Any ideas?

    Are there any ideas?

    Comment


    • #3
      same problem

      Hello, I'm sorry I cannot come with a solution, I'm having the same problem, my app starts in about 1 min 30 sec, from which 50-55 seconds is taken by
      Introspector.getBeanInfo(beanClass) from org.springframework.beans.CachedIntrospectionResul ts. If you found a way to fix or improve your startup time please feel free to share.

      Comment

      Working...
      X