towards a garbage collector for distributed real-time java

30
Towards Distributed Garbage Collection for Distributed Real- Time Java Pablo Basanta Val and Marisol García Valls Universidad Carlos III de Madrid (SPAIN) www.it.uc3m.es/drequiem/

Upload: universidad-carlos-iii-de-madrid

Post on 29-Nov-2014

99 views

Category:

Science


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Towards a garbage collector for distributed real-time Java

Towards Distributed Garbage Collection for Distributed Real-Time Java

Pablo Basanta Val and Marisol García Valls Universidad Carlos III de Madrid (SPAIN) www.it.uc3m.es/drequiem/

Page 2: Towards a garbage collector for distributed real-time Java

2

Outline (概述 ) Context & Approach

Real-time Java status Motivations for having a DGC service

Strategies for a RT-DGC service Turning-off the DGC service Defining a simple RT-DGC service

Evaluation Priority inversion illustration Blocking time introduced in remote communications Leasing overhead

Conclusions and future work

Page 3: Towards a garbage collector for distributed real-time Java

3

Context Next generation real-time systems

More dynamic & complex

One approach to address this issue is to use high-level development languages like real-time Java Provide developers with libraries and potentially may reduce the development

cost of applications

However, Java was not initially designed for real-time systems Many features (e.g. garbage collectors collide with real-time performance) Research efforts are required to harmonize real-time performance with Java

Page 4: Towards a garbage collector for distributed real-time Java

4

State of the Art in Real-time Java Centralized systems

Java VM, Specifications (RTSJ), Running products (Oracle, IBM, Jamaica) Currently in refinement in JSR-282

Safety critical applications Ongoing specifications and implementations Active in JSR-302

Distributed real-time Java Ongoing specifications (DRTSJ), and partial implementations (based on Java’s RMI) Stalled in JSR-50 and relaunched in 2012

Page 5: Towards a garbage collector for distributed real-time Java

5

This work contribution Improves garbage collection mechanisms included in Java’s RMI with real-

time performance Characterization of messages Initial performance indicators and clues Evaluation of different alternatives

Benefits for the real-time Java community Useful for DRTSJ and other real-time RMI implementations

Currently they do not provide operative approaches Backward compatible with RTSJ (no changes required)

Page 6: Towards a garbage collector for distributed real-time Java

6

Distribution real-time Java model

Based on the DREQUIEMI’s framework for distributed real-time Java It runs directly on RTSJ It extends Java’s RMI (Remote Method Invocations)

with predictability It offers a predictable garbage collector for RMI

Predictable =

configurable priorities + scheduling parameterization

Page 7: Towards a garbage collector for distributed real-time Java

7

API of the scheduling service (in DREQUIEI)

package es.uc3m.it.drequiem.rtrmi.server.dgc;

import java.rmi.server.dgc.*;

public interface RTDGCInterface extends java.rmi.Remote{

public void referenced(java.rmi.server.ObjID objid)

throws java.rmi.RemoteException;

public void unreferenced(java.rmi.server.ObjID objid)

throws java.rmi.RemoteException;

}

Page 8: Towards a garbage collector for distributed real-time Java

8

Motivation for having a distributed garbage collector Java requires a garbage collector

50% of all Java methods may allocate objects Static allocation is not a practical solution

A distributed garbage collector is not mandatory in real-time Java It is not no so necessary as a local garbage collector (remote objects may be

removed manually like in CORBA) However, it may be beneficial in terms of collecting unused remote objects

RMI uses the model To remove unwanted remote objects

Page 9: Towards a garbage collector for distributed real-time Java

9

Memory Leaksavoided in Sun DGC DGC in RMI is based on

counting algorithms It is not able to remove

remote object cycles (to avoid problems)

Acyclic structures may be collected (like the one in the figure)

Page 10: Towards a garbage collector for distributed real-time Java

10Memory Leaksavoided in Sun DGC(2) Each potential invoation

to remoteObjectLeak creates a memory leak After n invocations, there

are n remote objects that may be collected

Page 11: Towards a garbage collector for distributed real-time Java

11

Relationship between the registry and the DGC service

The registry holds references to remote objects !!!

Page 12: Towards a garbage collector for distributed real-time Java

12

Sun’s DGC algorithm sketched-reference list Based in leasing and

reference lists Based on a algorithm

described by Birrell previously

Reference lists prevent remote object deallocation

Remote references avoid remote object destruction

Page 13: Towards a garbage collector for distributed real-time Java

13

Sun’s DGC algorithm sketched-Leasing Leasing

To deal with faulty scenarios

Basic idea to wait for an update periodically

Periodical renewal associated to a remote reference

Page 14: Towards a garbage collector for distributed real-time Java

14

Strategies for a real-time DGC serviceTwo approaches

To turn off DGC it requires new API methods to remove remote objects

To produce a predictable version of DGC Requires a clear definition of priorities, periods

(So that it may be schedulable as a real-time task)

Page 15: Towards a garbage collector for distributed real-time Java

15

Strategies for a real-time DGC serviceTurning DGC off

Remote objects may removed at the server (with current API).

00:UnicastRemoteObject01: static boolean 02: unexportObject03: (Remote r, bolean force)04: throws NoSuchObjectException;

But it could be extended with a method to list all objects

00: UnicastRealtimeRemoteObject01: static Vector 02: listExportedRemoteObjects();

Server node

Page 16: Towards a garbage collector for distributed real-time Java

16

Strategies for a real-time DGC serviceTurning DGC off (2)

To allow explicit deallocation from a client

00: RealtimeRemote01: boolean unReference(Remote r)02: throw NoSuchObjectException;

Page 17: Towards a garbage collector for distributed real-time Java

17

Strategies for a real-time DGC serviceTurning DGC off

Remote objects may removed at the server (with current API).

00:UnicastRemoteObject01: static boolean 02: unexportObject03: (Remote r, bolean force)04: throws NoSuchObjectException;

But it could be extended with a method to list all objects

00: UnicastRealtimeRemoteObject01: static Vector 02: listExportedRemoteObjects();

Server node

Page 18: Towards a garbage collector for distributed real-time Java

18

Strategies for a real-time DGC servicereal-time DGC

Based on the redefinition of: Reference method Unreference method Leasing mechanism

Page 19: Towards a garbage collector for distributed real-time Java

19

Strategies for a real-time DGC servicereal-time DGC- reference

Reference Invoked each time a remote reference abandons a node The priority of the transaction is the priority of the thread that carries out that action

Page 20: Towards a garbage collector for distributed real-time Java

20

Strategies for a real-time DGC servicereal-time DGC- unreference Reference

Invoked each time a remote reference is invoked

The priority of the transaction is the priority of the thread that carries out that action

Page 21: Towards a garbage collector for distributed real-time Java

21

Strategies for a real-time DGC servicereal-time DGC- lease

Lease Invoked periodically Modeled as periodic real-time invocation (T,D,C, Priority)

Page 22: Towards a garbage collector for distributed real-time Java

22

Strategies for a real-time DGC servicereal-time DGC- decoupled mechanisms

To avoid synchronous reference and unreference methods Able decouple cost from

remote invocations The reference and

unreference methods are modelled as T,D,C transactions

Page 23: Towards a garbage collector for distributed real-time Java

23

Performance evaluationgoals To build an scenario that illustrates that illustrates

performance trends of current

To evaluate the overhead introduced by the synchronous/asynchronous remote invocations

To evaluate the overhead introduced by the leasing mechanism

Reference software 796 Mhz machines x 1 real-time router (100 Mbits second)

Page 24: Towards a garbage collector for distributed real-time Java

24

Performance evaluationpriority inversion trends

A scenario that shows unbounded priority inversion was build Thread in client suffers

priority inversion of al

Page 25: Towards a garbage collector for distributed real-time Java

25

Performance evaluationpriority inversion due to DGC

The real-time garbage collector may handle the priority properly

Page 26: Towards a garbage collector for distributed real-time Java

26

Performance evaluationdeferred vs. synchronous costs

Defered DGC reduces response times

Page 27: Towards a garbage collector for distributed real-time Java

27

Performance evaluationleasing trends

Above 1 minute the cost reduces remarkably (RMI default is 5 mins)

Page 28: Towards a garbage collector for distributed real-time Java

28

Conclusions (结论 ) Distributed real-time Java applications require to deal with the garbage

collector issue (disabling the DGC) Illustrated empirically

The paper provides mechanisms to reduce the cost of garbage collection in distributed real-time Java Illustrated empirically

Page 29: Towards a garbage collector for distributed real-time Java

29

Ongoing work Extensive evaluation and formalization

Benchmarks and formalism for the real-time DGC

An extension to other real-time infrastructures Used to collect real-time SOA

Page 30: Towards a garbage collector for distributed real-time Java

30

Thank you (谢谢 )