tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Millies, Sebastian" <Sebastian.Mill...@softwareag.com>
Subject RE: Performance optimization of binding.sca ?
Date Thu, 26 Jan 2012 13:29:19 GMT

From: Simon Laws [mailto:simonslaws@googlemail.com]
Sent: Tuesday, January 24, 2012 5:08 PM
To: user@tuscany.apache.org
Subject: Re: Performance optimization of binding.sca ?

>On Fri, Jan 20, 2012 at 4:01 PM, Millies, Sebastian
><Sebastian.Millies@softwareag.com> wrote:
>>>From: Simon Laws [mailto:simonslaws@googlemail.com]
>>>Sent: Friday, January 20, 2012 11:57 AM
>>>To: user@tuscany.apache.org
>>>Subject: Re: Performance optimization of binding.sca ?
>>>
>>>On Fri, Jan 20, 2012 at 8:10 AM, Millies, Sebastian <Sebastian.Millies@softwareag.com>
wrote:
>>>>Hello there,
>>>>
>>>>I have a question about the performance optimization of binding.sca in Tuscany
1.6.
>>>>Suppose I manually create and start two nodes in the same JVM, as follows:
>>>>
>>>>SCANodeFactory factory = SCANodeFactory.newInstance();
>>>>SCANode node_1 = factory.createSCANode( composite_1, contributions_1 );
>>>>SCANode node_2 = factory.createSCANode( composite_2, contributions_2 );
>>>>node_1.start();
>>>>node_2.start();
>>>>
>>>>Suppose further that component A in composite 1 references a service of component
B in
>>>>composite 2, and both the reference and service expose <binding.sca/>
.
>>>>
>>>>Will there be any internal emulation of a remote call, SOAP parsing etc? Or
will Tuscany make
>>>>a direct call, perhaps using Java reflection?
>>>>
>>>> -- Sebastian
>>>>
>>>Hi Sebastien.
>>>
>>>The idea was that an optimization would be used in that scenario where data is
serialized across class loaders but without the requirement for a full remote protocol transformation.
While we can detect the scenario I don't think the optimization is in place.
>>>
>>>Regards
>>>
>>>Simon
>>
>> Can you say something about HOW to detect that scenario and WHERE to apply the optimization?
>> In due course I might have occasion to look at implementing that.
>>
>
>Apologies for the delayed response Sebastien.
>
>The place to start is the SCA Binding provider on the reference side.
>You can see code here that is deciding whether it thinks the target is
>remote or not. In the case that that target isn't remote we'd then
>need to think about the optimization. I.e. can we detect the situation
>where the target component is in the same VM but in a different
>classloader say.


It is important to see that in my example the target is not only in a
different classloader but also in a different node, defined by a different
composite. Classloader separation will also occur between different
contributions to the same node, but that's node the only thing going on here.


>For a target component that is in the same VM but has
>a remotable interface there is some code that enforces pass by value
>semantics (I think by serializing the arguments using the databinding
>layer). Have a look in the code where the PassByValueInterceptor [2]
>is set up
>
>Simon
>
>[1] http://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
>[2] http://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java


This is getting more complicated than I thought it would be. I have experimented a
bit, and now I do no longer even understand what is meant by a "local interface".

The SCA assembly spec says "A service typed by a local interface can only be called by clients
that are running in the same process as the component that implements the local service".
Something similar is said in Tuscany in Action: "Services with local interfaces are to communicate
only with other components that are deployed locally and that are running within a single
JVM."

The emphasis here is quite clearly on operating system processes, which are equated with JVMs.
So in the code I posted originally (see above) it should be obvious that the services in node1
and node2 must be local with respect to each other, although defined in different composites.
But this is not how Tuscany seems to work.

For local services, I would expect to be able to use binding.sca with local URIs. For
example, I would expect to be able to reference service "Callee" in node2 from a
component in node1 using something like:

  <sca:reference name="callee" target="CalleeComponent/Callee">
    <sca:interface.java interface="caller.callee.api.Callee"/>
    <sca:binding.sca/>
  </sca:reference>

where the service in node2 is simply exposed by:

  <sca:service name="Callee">
    <sca:interface.java interface="caller.callee.api.Callee"/>
    <sca:binding.sca/>
  </sca:service>

I would further expect that the Callee-Interface may be non-remotable.

On the contrary, Tuscany forces me to make Callee remotable, and specify
non-local targets and Uris for the reference and service, e. g. something like
http://localhost:8090/ps.softwareag.com/callee/Callee", as if they were in
different processes.

The code that checks whether the target is remote or not will always conclude
that it's remote if it has a remotable interface.

Interestingly, the RMI-Binding is different: With the RMI-Binding I can
have a non-remotable interface. I will then get pass-by-reference as well,
i. e. no PassByValueInterceptor is inserted.  (The RMI-Binding has a different
bug: When I make the interface remotable, any @AllowsPassByReference on the
Callee-Implementation is ignored, which is also not according to spec, but
not bothersome.)

I believe the RMI approach will work for me. But I'd still be grateful for
some clarification. I could post illustrative code, if anyone is interested.

-- Sebastian


IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - Registergericht/Commercial
register: Saarbrücken HRB 19681
http://www.softwareag.com

Mime
View raw message