+ All Categories
Home > Documents > A Bytecode Translator for Distributed Execution of “ Legacy ” Java Software

A Bytecode Translator for Distributed Execution of “ Legacy ” Java Software

Date post: 17-Jan-2016
Category:
Upload: winter
View: 30 times
Download: 0 times
Share this document with a friend
Description:
A Bytecode Translator for Distributed Execution of “ Legacy ” Java Software. Michiaki Tatsubori * , Toshiyuki Sasaki * , Shigeru Chiba ** , and Kozo Itano * * University of Tsukuba, Japan ** Tokyo Institute of Technology, Japan. Development of Distributed Java Software. An example scenario - PowerPoint PPT Presentation
25
June 18-22, 2001 ECOOP 2001, Budapest, Hun gary 1 A Bytecode Translator for Distributed Execution of “Legacy” Java Software Michiaki Tatsubori*, Toshiyuki Sasaki*, Shigeru Chiba**, and Kozo Itano* * University of Tsukuba, Japan ** Tokyo Institute of Technology, Japan
Transcript
Page 1: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 1

A Bytecode Translator for Distributed Execution of “Legacy” Java Software

Michiaki Tatsubori*, Toshiyuki Sasaki*, Shigeru Chiba**, and Kozo

Itano*

* University of Tsukuba, Japan** Tokyo Institute of Technology, Japan

Page 2: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 2

Developmentof Distributed Java Software

An example scenario “We have already got nice software.” “But we want to display GUI of the

software on a remote host.” Run GUI components on a remote host,

and run others on a local host

Page 3: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 3

Two Approaches

Use X Window No need to edit a program

Rewrite a program by hand Using Java RMI or CORBA

Page 4: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 4

X Window

Distribution by the Xlib Library Bad response time if GUI is complex

High communication overhead

“Draw a line”

“A mouse moved”

“A mouse-button pushed”

“A mouse-button released”

UserProgram

Xlib

Page 5: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 5

Rewrite a Program by Hand

Good response time The programmer can tune the code. Low communication overheads.

UserProgram

Show an internal-window

A click in a window

ORBLibrary

UserProgram

Higher-level commands

Page 6: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 6

Automation vs. Efficiency

X Window Fully automated, but Slow

By hand Many man-hours, though Fast

UserProgram

Xlib

UserProgram

GUI Module

Page 7: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 7

Automation vs. Efficiency

X Window Decomposition at

the library layer

For better performance,complex decomposition isnecessary.

UserProgram

Xlib

UserProgram

GUI Module

Page 8: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 8

Addistant – Our Solution

A Java program translator Translating a non-distributed program

to a distributed one Decomposing at anywhere

The user can specify the decomposition with a policy file.

UserProgram

GUI Module

Policy file

Page 9: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 9

Addistant is a Practical Tool!

Bytecode translation by a class-loader Using Javassist[Chiba00]. No source code, no custom JVM.

Addistant can process real applications. It can migrate Swing components to a

remote host.Standard

library for rich GUI

Page 10: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 10

Decomposition is Not Easy…

A simple proxy-master implementation NEVER works. Proxy-master – a typical

implementation technique for remote references

MasterProxyMethodInvocation

Network Communications

Page 11: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 11

JavaRMI’s Way Doesn’t Work

To be remotely accessible, We must translate …

class WidgetImpl { …}

implements Widget {

interface Widget { …}

class WidgetProxy implements Widget { …}

If WidgetImpl is a system class,we cannot modify the class declaration!The JVM prohibits it.

If WidgetImpl is a system class,we cannot modify the class declaration!The JVM prohibits it.

Page 12: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 12

In a Policy File of Addistant

Users choose one of four implementation techniques for each class. Those techniques modify code in

different ways. But they have different limitations in use.

Some techniques do not modify an original class, so they can be used for system classes.

Page 13: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 13

Distributed Swing Application

A policy file<policy> <import proxy="rename" from="display"> [email protected]   [email protected]   .. </import> <import proxy="rename" from="application"> [email protected].[InputStream|OutputStream|..] [email protected].* </import> <import proxy="subclass"> [email protected].[AbstractCollection|..] </import> <import proxy="writeBackCopy"> array@- </import> <import proxy="replace" from="application"> user@- </import> <import proxy="copy"> - </import></policy>

Page 14: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 14

“Rename” technique(e.g. for java.awt.Window)

It does not modify the original class. But local and remote references

cannot coexist on the same host.

Widget w = new Widget();w.show();

Widgetshow()

.. Show ..

Caller-side Class declaration

WidgetProxyshow()

.. Send ..

WidgetProxy w = new WidgetProxy();w.show();

Page 15: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 15

“Subclass” technique(e.g. for java.util.Vector)

Local and remote references can coexist on the same host.

But the original class must not be final. If final, it must be modifiable.

Widget w = new Widget();w.show();

Widgetshow()

.. Show ..

Caller-side Class declaration

WidgetProxyshow()

.. Send ..

Local referenceRemote reference

Page 16: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 16

Experiment: Response time

“Click” to “Pop-up a Window” Application Host

Sparc 440MHz GUI Host

PentiumII 500MHz Network

10Base-T Half 100Base-TX Full

Page 17: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 17

Experiment: Response time

“Click” to “Pop-up a Window” Application Host

Sparc 440MHz GUI Host

PentiumII 500MHz Network

10Base-T Half 100Base-TX Full

Page 18: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 18

Results of Experiments

Addistant showed good results. Response Time (sec.) 10base-t /

100base-tx

Transferred data size (kb)

(±0.1 sec.) X Window Rawt Addistant

1st pop-up 5.6 / 1.6 3.2 / 2.6 2.0 / 2.0

2nd pop-up 5.6 / 1.4 0.0 / 0.0 0.0 / 0.0

X Window Rawt Addistant

1st pop-up 3493.57 116.20 81.88

2nd pop-up 3438.96 10.95 0.06

IBM’s awt-compatiblelibrary for remote GUI

Page 19: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 19

Concluding Remarks

Addistant – an adapter of “legacy” Java programs for their distributed execution on multiple hosts A translator (automation) approach for

complex decomposition of a program A practical technology which can handles

Swing

Other Contribution A case-study of the usefulness of

Javassist[Chiba00]

Page 20: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 20

Question or Suggestion?

Page 21: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 21

System Classes

For implementing remote references, different way for a different class is used.Scopes of the required code modification are

different in each implementation Choosing implementation method avoiding

any modification of system classes “It’s no use kicking against bricks”

Declarative specification in a policy file “Replace”, “Rename”, “Subclass”, “Copy”

Page 22: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 22

“Replace” Approach(e.g. user classes)

Replaces the master class declaration with a proxy version When the target class is modifiableOnly one version exists on a single JVM.

Widget w = new Widget();w.show();

Widgetshow()

Make it distributed

Widgetshow()

.. Show ..

.. Send ..

Replace all

Page 23: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 23

“Copy” Approach(e.g. java.lang.String)

Does not create any proxy class, but transfers serialized objects to remote host at RMI Shallow copy

A Variation – “Write-back Copy” Approach For arrays

byte[] buf = …;istream.read(buf);

Page 24: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 25

Automating Development of Distributed Ver. of “Legacy” Soft

Less Developing Costs by AutomationReusing “Legacy”, Existing, Software

Ordinary Environments (Auto Remote GUI) X Window System 、 VNC 、 Rawt[IBM Haifa

98]

Ordinary Tools for (Semi-Auto) Distribution JavaRMI, ObjectSpace, Corba-compliant ORB… ”remotenew”[Nagaratnam 96] ,

JavaParty[Philippen 99] …、

Page 25: A Bytecode Translator for Distributed Execution of  “ Legacy ”  Java Software

June 18-22, 2001 ECOOP 2001, Budapest, Hungary 26

Distributed Execution of Software

For example,Separating GUI from application logic

Reduces administration costs, and Makes use of ubiquitous client-machines

“Zero Administration” “Thin Client”


Recommended