Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

12
© copyright 2004 by OSGi Alliance All rights reserved. Evolving Communication Mechanisms of the OSGi Framework Xuejun Chen BMW Group Forschung und Technik Munich, Germany

Transcript of Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

Page 1: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance All rights reserved.

Evolving Communication Mechanisms of the OSGi Framework

Xuejun ChenBMW Group

Forschung und Technik Munich, Germany

Page 2: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Overview

• Motivation– Dynamic distribution of applications in vehicle– OSGi is being used in vehicles.

• Current solution to location transparence– Java RMI is used.– Performance problem

• New solution to location transparence– Automatically switching invocations from remote to

local and vice versa• Conclusion

Page 3: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

• Vehicle software systems– Controllers and sensors– Telematics systems– Management systems

• Distributed systems in vehicles– Today, approx. 70 ECUs in a BMW vehicle– In the future, maybe only several high

performance ECUs in vehicles

Motivation (1)

Page 4: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Motivation (2)

• Requirements of future vehicle software– Optimized system performance– Dynamic distribution of applications– Location transparence

• OSGi is being used in vehicle software– However, OSGi does not provide support for

location transparent communication.

Page 5: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Current solution to location transparence

• Java RMI is used for location transparent communication.

• System performance is degraded because RMI is used for local communication– Java RMI’s serialization takes at least 25% of the

costs of a remote method invocation.– The costs of serialization rise with growing object

structures.

A

OSGi Framework

BRMI

C

OSGi Framework

DRMIRMI

Page 6: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

New solution to location transparence

• Virtual stub based solution to location transparence• A virtual stub is a local object for a client component,

and forwards the invocations from the client to the server.

• A virtual stub is dynamically loaded and updated by a system service.

• The virtual stub can automatically switch invocations from remote to local and vice versa.

• The virtual stub is used like a normal Java RMI stub.

Page 7: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Virtual stub

• Components communicate with each other by using virtual stubs.

TestInterface v_Stub;v_Stub = (TestInterface)componentContext.lookup(”TestServer_B");try {

info = v_Stub.testMethod(”a test call");}

A B

Virtual stub of B

RMI stub of B

invoke, if B is remote

invoke

invoke

if B is local

invoke

Page 8: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Integrating virtual stub into OSGi

A B

Virtual Stub of B

RMI Stub of B

invoke, if B is remote

invokeinvoke

Java Naming Service

bCtx.getServiceReference(B)

Bundle Manager load, initialize,

update

Java RMI

1

2

3

45

(if required)lookup(B) 2

4

if B is local

• Implementing a bundle manager that registers the references of the local bundles, and loads, updates a required virtual stub for a client bundle.

Page 9: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Automatically switching invocations from remote to local and vice versa

if (local) /* A and B are local.*/

str = (String)ref.testMethod(clone(info));

else /* A and B are remote.*/

str = (String)ref.testMethod(info);

The method invocation in the virtual stub of B:

BundleManager

update

A B

Virtual stub of B

RMI Stub of B

invoke, if B is remote

invoke

invoke

if B is local

Bmigration

Call by value

Page 10: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Measurement results of local/remote invocations

2.7913

2.8356

Java RMI

Virtual Stub

Component A runs on a desktop, component B runs on a laptop, i.e. A and B are remote.

1.0114

0.0623

Java RMI

Virtual Stub

Two components run on a desktop PC.i.e. A and B are local.

Time (ms)MiddlewareRuntime environment

• When both components are local, the system performance of using virtual stub is significantly higher than using Java RMI.

• Overhead of virtual stub is only 0.0443 ms.

• When both components are local, the system performance of using virtual stub is significantly higher than using Java RMI.

• Overhead of virtual stub is only 0.0443 ms.

Test case: component A calls a method of component B, which returns a string. Test case: component A calls a method of component B, which returns a string.

The measurement results are cited from [Chen2002].

Page 11: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Conclusion

• By using virtual stub, communication between components is location transparent, and at the same time, the system performance is not degraded.

• For more detailed information, please see the following article:[Chen2002] Chen, Xuejun. Extending RMI to Support Dynamic Reconfiguration of Distributed Systems. In: Proceedings of the 22nd IEEE International Conference on Distributed Computing Systems (ICDCS 2002), pages 401 – 408, July, 2002.

Page 12: Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Research and Technology

© copyright 2004 by OSGi Alliance. All rights reserved.

Thank you for your attention!eMail: [email protected]