• No results found

Experimental Evaluation of Distributed Middleware with a Virtualized Java Environment

N/A
N/A
Protected

Academic year: 2021

Share "Experimental Evaluation of Distributed Middleware with a Virtualized Java Environment"

Copied!
37
0
0

Loading.... (view fulltext now)

Full text

(1)

Experimental Evaluation of Distributed Middleware

with a Virtualized Java Environment

Nuno A. Carvalho, João Bordalo, Filipe Campos and José Pereira

HASLab / INESC TEC

Universidade do Minho

MW4SOC’11

December 12, 2011

(2)

Motivation

Service oriented architectures span a wide range of

application scenarios

Geographically dispersed

Deployed outside enterprise information systems

Comprehensive evaluation requirements

Correctness

(3)

Motivation

Current evaluation solutions

Simulation models: useful while the whole system

isn’t available, but can only validate design and not

the middleware and service implementation

Actual deployment: most realistic but costly and time

consuming, also requires the availability of the entire

system

(4)

Overview

Traditional experimental middleware evaluation

Network

JVM n

Java Interpreter / JIT Compiler

Platform libraries (java.*)

Target middleware

Target application

JVM 2

Java Interpreter / JIT Compiler

Platform libraries (java.*)

Target middleware

Target application

JVM 1

Java Interpreter / JIT Compiler

Platform libraries (java.*)

Target middleware

Target application

(5)

Overview

Traditional experimental middleware evaluation

Network

JVM n

Java Interpreter / JIT Compiler Platform libraries (java.*)

Target middleware Target application JVM 2

Java Interpreter / JIT Compiler Platform libraries (java.*)

Target middleware Target application JVM 1

Java Interpreter / JIT Compiler Platform libraries (java.*)

Target middleware Target application

...

Multiple instances of an

application are deployed in

multiple JVMs

JVMs are scattered across

multiple physical hosts

The amount of the

required hardware

resources is o&en

prohibitive

(6)

Overview

M

INHA

middleware evaluation

JVM

Bytecode instrumentation

Java Interpreter / JIT Compiler

Platform libraries (java.*)

MINHA

Virtual JVM n

Target middleware

Target application

Virtual JVM 1

Target middleware

Target application

Virtual JVM 1

Target middleware

Target application

...

(7)

Overview

M

INHA

middleware evaluation

Reproduces the same

distributed run within a

single JVM

Application and middleware

classes for each vJVM are

automatically transformed

Some simulation models

are developed from scratch,

others are produced by

translating native libraries

JVM

Bytecode instrumentation

Java Interpreter / JIT Compiler Platform libraries (java.*)

MINHA Virtual JVM n Target middleware Target application Virtual JVM 1 Target middleware Target application Virtual JVM 1 Target middleware Target application ...

(8)

Overview

M

INHA

middleware evaluation advantages

Global observation without

interference

Simulated components

Large scale scenarios

Automated “What-If”

analysis

JVM

Bytecode instrumentation

Java Interpreter / JIT Compiler Platform libraries (java.*)

MINHA Virtual JVM n Target middleware Target application Virtual JVM 1 Target middleware Target application Virtual JVM 1 Target middleware Target application ...

(9)

Agenda

Simulation Kernel

Virtualized JVM

Input/Output Models

Calibration

Case Study

(10)

Simulation Kernel

Event-based simulation kernel

Abstract resource management primitives

JVM

Java Interpreter / JIT Compiler Platform libraries (java.*)

Virtual JVM n Target middleware Target application Virtual JVM 1 Target middleware Target application Virtual JVM 1 Target middleware Target application

...

(11)

Simulation Kernel

Combination of real and simulated code:

Measuring the time of execution and management of a

simulated processor

Allowing sequential Java code to execute by eliminating the

inversion of control resultant from the event simulation

JVM

Java Interpreter / JIT Compiler Platform libraries (java.*)

Virtual JVM n Target middleware Target application Virtual JVM 1 Target middleware Target application Virtual JVM 1 Target middleware Target application

...

Simulated events and resources Time virtualization

(12)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

(13)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

class load

JVM

start

(14)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

For simplicity, let’s assume

that this segment is a thread

class load

JVM

(15)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

start()

Thread

For simplicity, let’s assume

that this segment is a thread

class load

JVM

(16)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

start()

Thread

For simplicity, let’s assume

that this segment is a thread

class load

JVM

start

event.run()

(17)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

start()

Thread

For simplicity, let’s assume

that this segment is a thread

class load

JVM

start

event.run()

st.pause()

Simulation

Thread

startTime()

st.wakeup()

stopTime()

st.pause()

(18)

Simulation Kernel

public class Foo {

public static void main(...){

int i = 0;

while (i<100)

i++;

}

}

start()

Thread

For simplicity, let’s assume

that this segment is a thread

class load

JVM

start

event.run()

simulation

time delta

real

time delta

st.pause()

Simulation

Thread

startTime()

st.wakeup()

stopTime()

st.pause()

(19)

Virtualized JVM

Reflect real time of execution of a sequence of code in

the occupation of a simulated processor

Blocking operations (thread synchronization and I/O)

must be intercepted and translated into corresponding

simulation primitives

Code executing in different virtual instances cannot

interfere directly through shared variables

(20)

Virtualized JVM

Bytecode manipulation: custom class

loader that uses ASM Java bytecode

manipulation and analysis framework

to rewrite classes

Isolation: each virtual JVM has its own

separate instance of the class loader

acting like a sandbox

Interaction: A subset of classes,

containing the simulation kernel and

models, are kept global providing a

controlled channel for virtual JVMs to

JVM

Bytecode instrumentation Translated platform libraries Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*) Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Simulated events and resources Time virtualization

(21)

Virtualized JVM

Bytecode manipulation: custom class

loader that uses ASM Java bytecode

manipulation and analysis framework

to rewrite classes

Isolation: each virtual JVM has its own

separate instance of the class loader

acting like a sandbox

Interaction: A subset of classes,

containing the simulation kernel and

models, are kept global providing a

controlled channel for virtual JVMs to

interact

JVM

Bytecode instrumentation Translated platform libraries Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*) Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Simulated events and resources Time virtualization

(22)

Virtualized JVM

Bytecode manipulation: custom class

loader that uses ASM Java bytecode

manipulation and analysis framework

to rewrite classes

Isolation: each virtual JVM has its own

separate instance of the class loader

acting like a sandbox

Interaction: A subset of classes,

containing the simulation kernel and

models, are kept global providing a

controlled channel for virtual JVMs to

JVM

Bytecode instrumentation Translated platform libraries Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*) Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Simulated events and resources Time virtualization

(23)

Virtualized JVM

Bytecode manipulation: custom class

loader that uses ASM Java bytecode

manipulation and analysis framework

to rewrite classes

Isolation: each virtual JVM has its own

separate instance of the class loader

acting like a sandbox

Interaction: A subset of classes,

containing the simulation kernel and

models, are kept global providing a

controlled channel for virtual JVMs to

interact

JVM

Bytecode instrumentation Translated platform libraries Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*) Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Simulated events and resources Time virtualization

(24)

Virtualized JVM

Bytecode manipulation: custom class

loader that uses ASM Java bytecode

manipulation and analysis framework

to rewrite classes

Isolation: each virtual JVM has its own

separate instance of the class loader

acting like a sandbox

Interaction: A subset of classes,

containing the simulation kernel and

models, are kept global providing a

controlled channel for virtual JVMs to

JVM

Virtual JVM n

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*) Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Simulated events and resources

(25)

Virtualized JVM

Platform libraries

Java prohibits the transformation

of classes under java.* package

Rewrite classes that contains

native methods

Overwrite special static methods,

like System.nanoTime()

The remaining classes are

analyzed and processed

automatically

JVM

Bytecode instrumentation Translated platform libraries Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*)

Stubbed platform libraries Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Stubbed platform libraries (fake.java.*)

Translated platform libraries (moved.java.*)

Simulated events and resources Time virtualization

(26)

Virtualized JVM

Synchronization

Primitives in java.util.concurrent.*

Rewrite to fake.*

Java monitor operations and implicit

mutex/condition variables

Inject a special

fake.java.lang.Object

ancestor on all translated classes and

rewrite monitor operations to

invocations to methods on this class

static synchronized methods

JVM

Bytecode instrumentation Translated platform libraries Virtual JVM 2

Bytecode instrumentation Translated platform libraries

(moved.java.*)

Target middleware Target application

Java Interpreter / JIT Compiler Platform libraries (java.*)

Stubbed platform libraries Virtual JVM 1

Target middleware Target application

...

Bytecode instrumentation

Stubbed platform libraries (fake.java.*)

Translated platform libraries (moved.java.*)

Simulated events and resources Time virtualization

(27)

Input/Output Models

Filesystem

Reads and writes are intercepted in order to avoid direct

invocation of native methods, thus providing separate

filesystems to different virtual JVMs

Network

Modeled as a resource shared by all communication

channels with a finite capacity

Access control is performed by the leaky bucket algorithm

TCP and UDP sockets, including Multicast, supported

(28)

Calibration

Network

Bandwidth

Sending and receiving overheads

Latency

Performed by running two benchmarks:

Flood

(29)

Calibration

0

200

400

600

800

1000

1200

0

1000 2000 3000 4000 5000

BW (Mbit/s)

Size (bytes)

Real

Minha

0

200

400

600

800

1000

1200

0

1000 2000 3000 4000 5000

BW (Mbit/s)

Size (bytes)

Real

Minha

a) Writing

b) Reading

(30)

Calibration

c) Latency

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0

1000 2000 3000 4000 5000

Round Trip (ms)

Size (bytes)

Real

Minha

(31)

Case Study

Devices Profile for Web Services (DPWS)

Standard that defines a set of protocols for devices to achieve

seamless networking and interoperability through Web Services

Proposed as the base for large scale smart grids and safety

critical medical devices

Used on recent operating systems, home automation, assembly

lines and car industry

Web Services for Devices (WS4D-JMEDS)

Framework that implements DPWS standard

Supports J2SE and J2ME

(32)

Case Study

Membership notification

Manager finds peers through multicast

Manager sends producers addresses to peers

Peers register themselves on producers

Producers initiate notification rounds

Number of peers go from 10 to 300

Producer

Manager

(33)

Case Study

In a normal WS4D deploy we would have

Each peer on a different device

(34)

Case Study

In a normal WS4D deploy we would have

Each peer on a different device

Each device with only one CPU core

Due to hardware restrictions we deployed 300 devices on

multiple JVMs on a single host with 24 CPU cores

Localhost network with minimal latency

(35)

Case Study

0

250

500

750

1000

1250

1500

1750

2000

0

50

100 150 200 250 300

Duration (s)

Devices

Multiple JVMs

Minha (sim)

Minha (real)

0

50

100

150

200

250

300

0

50

100 150 200 250 300

Latency (ms)

Devices

Multiple JVMs

Minha

M

INHA

eliminates false latency when all peers run on a

single host

M

INHA

is faster than real deployments on I/O bound

(36)

Conclusion

Allows off-the-shelf code (bytecode) to run

unchanged including threading, concurrency control

and networking

Manages a simulated timeline which is updated using

accurate measurements of time spent executing real

code fragments

Provides simulation models of networking primitives

and an automatic calibrator

Allows off-the-shelf middleware stack evaluation

deployed on a large scale system with hundred of

(37)

Conclusion

References

Related documents