Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Spring DM performance problem
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tara  
View profile  
 More options Jun 27 2011, 4:24 pm
From: Tara <t...@instilsoft.com>
Date: Mon, 27 Jun 2011 13:24:13 -0700 (PDT)
Local: Mon, Jun 27 2011 4:24 pm
Subject: Spring DM performance problem
Folks,

A client of mine has uncovered a serious problem with the way that
Spring DM service proxies work.  On invocation of any service method,
the proxy always get's the service with a corresponding unget.  As
detailed below this causes a reproducible and consistent performance
problem with Equinox.

The description below has been sent to the Virgo user group, but is
more appropriate here I feel.  I do have a question, however - why
does Spring get the service on each invocation rather than use a
service tracker.  Is it to keep ServiceFactory semantics?   If not,
invocations against the proxy can still wait for the service to become
available even when using a tracker.  We were able to create a
replacement proxy that did just that, which works, but we'd really
prefer Spring DM to be fixed.

<client email>
I am using virgo 2.1.0 with org.eclipse.osgi-3.6.1.R36x_v20100806.jar.
I have encountered an issue with Virgo which results in a significant
performance degradation.

The problem first arose with a web services application but I have
recreated the problem using 2 simple services provided by bundle#1 and
referenced by bundle#2. In bundle#2 I have a client bean that creates
a pool of threads, each calling the 2 exposed services.

The services have no external dependencies and perform no I/O.

After running the test for some time I see the number of requests
handled per second drop significantly. The time at which this happens
is the same for every test. After another period of time the previous
performance level is restored. Again this period is predictable.

Checked this up to verion 3.7.0 of org.eclipse.osgi.

I have traced through the code and I think the error is being caused
by the service lookup.

Every time the service is used it causes a lookup by the
ServiceDynamicInterceptor:

 "pool-1-thread-39" prio=10 tid=0x00000000548e2000 nid=0x36a8 waiting
for monitor entry [0x0000000046003000]

   java.lang.Thread.State: BLOCKED (on object monitor)
       at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(Bundl eContextImpl.java:
661)
        - locked <0x00002aaab5983528> (a java.lang.Object)
        at
org.springframework.osgi.service.importer.support.internal.support.ServiceW rapper.getService(ServiceWrapper.java:
99)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceDynam icInterceptor
$ServiceLookUpCallback.doWithRetry(ServiceDynamicInterceptor.java:107)
        at
org.springframework.osgi.service.importer.support.internal.support.RetryTem plate.execute(RetryTemplate.java:
83)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceDynam icInterceptor.lookupService(ServiceDynamicInterceptor.java:
430)
        - locked <0x00002aaab5d16508> (a java.lang.Object)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceDynam icInterceptor.getTarget(ServiceDynamicInterceptor.java:
415)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvok er.invoke(ServiceInvoker.java:
62)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec tiveMethodInvocation.java:
172)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed (DelegatingIntroductionInterceptor.java:
131)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(De legatingIntroductionInterceptor.java:
119)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec tiveMethodInvocation.java:
172)
        at
org.springframework.osgi.service.importer.support.LocalBundleContextAdvice. invoke(LocalBundleContextAdvice.java:
59)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec tiveMethodInvocation.java:
172)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed (DelegatingIntroductionInterceptor.java:
131)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(De legatingIntroductionInterceptor.java:
119)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec tiveMethodInvocation.java:
172)
        at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr oxy.java:
202)
        at $Proxy124.requestHandler(Unknown Source)

org.eclipse.osgi.framework.internal.core.BundleContextImpl ends up in
ServiceUse.getService()

In here there is a counter, useCount, which is incremented on every
get. It is decremented in ungetService but this is not called by
Spring DM. In this case useCount eventually wraps round and becomes a
negative number. The following check in getService then fails:

         Object getService() {
              if ((useCount > 0) || (factory == null)) {
                       useCount++;
                       return cachedService;
               }

 This causes the service to be reloaded. The stack trace when the
performance degrades shows this happening:

        at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockCla ssLoader(ClasspathManager.java:
468)
        - waiting to lock <0x00002aaab59679f0> (a
org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoade r)
        at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(Classpa thManager.java:
449)
        at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(Def aultClassLoader.java:
216)
        at
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.j ava:
393)
        at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoade r.java:
469)
        at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:
422)
        at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:
410)
        at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultC lassLoader.java:
107)
        at
org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoade r.loadClass(KernelBundleClassLoader.java:
135)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.checkServiceClass (ServiceRegistry.java:
1015)
        at
org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(ServiceUse. java:
146)
        at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getServic e(ServiceRegistrationImpl.java:
447)
        - locked <0x00002aaab5983420> (a
org.eclipse.osgi.internal.serviceregistry.ServiceUse)
        at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(Servic eRegistry.java:
430)
        at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(Bundl eContextImpl.java:
667)
        at
org.springframework.osgi.service.importer.support.internal.support.ServiceW rapper.getService(ServiceWrapper.java:
99)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceDynam icInterceptor
$ServiceLookUpCallback.doWithRetry(ServiceDynamicInterceptor.java:107)
        at
org.springframework.osgi.service.importer.support.internal.support.RetryTem plate.execute(RetryTemplate.java:
83)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceDynam icInterceptor.lookupService(ServiceDynamicInterceptor.java:
430)
        - locked <0x00002aaab5d1d790> (a java.lang.Object)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceDynam icInterceptor.getTarget(ServiceDynamicInterceptor.java:
415)
        <snip />

The service will continue to be reloaded until useCount increments to
0! This explains the behavior shown in the graph where the performance
is restored.

</client email>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tara  
View profile  
 More options Jun 27 2011, 4:36 pm
From: Tara <t...@instilsoft.com>
Date: Mon, 27 Jun 2011 13:36:29 -0700 (PDT)
Local: Mon, Jun 27 2011 4:36 pm
Subject: Re: Spring DM performance problem
Correction:

On invocation of any service method, the proxy always get's the
service WITHOUT a corresponding unget.

(Well spotted NJB!)

On Jun 27, 9:24 pm, Tara <t...@instilsoft.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Costin Leau  
View profile  
 More options Jun 27 2011, 4:55 pm
From: Costin Leau <costin.l...@gmail.com>
Date: Mon, 27 Jun 2011 23:55:33 +0300
Local: Mon, Jun 27 2011 4:55 pm
Subject: Re: Spring DM performance problem
Sounds like an old bug that was fixed in the 2.x line (try M1 or better
yet Gemini Blueprint which had its RC last week).

Note that in 2.x you have the option to use sticky services (which gives
you the semantics you want) vs the highest priority one.

Cheers,

On 6/27/2011 11:36 PM, Tara wrote:

--
Costin

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »