monitoring of resource consumption in java based application servers
Download
Skip this Video
Download Presentation
Monitoring of resource consumption in Java-based application servers

Loading in 2 Seconds...

play fullscreen
1 / 26

Monitoring of resource consumption in Java-based application servers - PowerPoint PPT Presentation


  • 110 Views
  • Uploaded on

Monitoring of resource consumption in Java-based application servers. Jarle Hulaas [email protected] Swiss Federal Institute of Technology in Lausanne (EPFL) Switzerland (Formerly at CUI, Uni Geneva) Dimitri Kalas [email protected] University of Geneva Switzerland.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Monitoring of resource consumption in Java-based application servers' - talia


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
monitoring of resource consumption in java based application servers

Monitoring of resource consumptionin Java-based application servers

Jarle [email protected]

Swiss Federal Institute of Technology in Lausanne (EPFL)

Switzerland

(Formerly at CUI, Uni Geneva)

Dimitri [email protected]

University of Geneva

Switzerland

10th HP-OVUA workshop, Geneva, Switzerland

July 7, 2003

overview
Overview
  • What is Resource Management ?
  • Our General Approach
  • Some Details on our J-RAF Tool
  • Management of a Servlet Engine
  • Adapting J-RAF to Tomcat
  • Assessment

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

what is resource management
What is Resource Management ?
  • Physical resources:
    • CPU
    • (Virtual) Memory
    • Network bandwidth
  • Management of resources:
    • Monitoring of consumption
    • Controlling (i.e. limiting) it

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

benefits of resource management
Benefits of Resource Management
  • Software development
    • Monitoring and profiling of distributed applications
  • Security
    • Prevention against Denial-of-Service attacks
  • Reliability
    • More robust behaviours in presence of resource shortage
    • Accountability (liability) for resource consumption
  • E-commerce
    • Billing for resource consumption
    • Quality-of-Service guarantees, load balancing

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

what about java

www.

.org

The Java Resource Accounting Framework, 2nd edition

What about Java ?
  • Problem: Java offers no support for resource management !
  • Our solution: portable resource management through byte-code rewriting schemes

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

general approach

Per-thread

accounting objects

Meta-level

Mem

CPU

Net

Execution

hooks

Rewrite

bytecode

Transformed, resource-aware version of Application

OriginalJava Application(compiled)

General Approach

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

Execute

our solution
Our Solution
  • Program transformations to expose resource consumption
    • Application classes and libraries, incl. JDK
  • Rewritten programs unknowingly update accounting objects
    • CPU: count the number of executed JVM instructions
    • Memory: redirection of memory allocations
    • Network bandwidth: wrapper libraries

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

class analysis for cpu monitoring

1

2

3

1 (size=2)

4

2 (size=3)

3 (size=6)

4 (size=3)

5

5 (size=3)

6

7 (size=3)

6 (size=2)

7

8

8 (size=1)

Class Analysis for CPU monitoring

0 bipush 10

2 istore_1

3 iconst_1

6 istore_3

7 goto 25

10 invokestatic #2 <Method java.lang.Thread currentThread()>

13 pop

14 ldc2_w #3 <Long 100>

17 bipush 100

19 invokestatic #5 <Method void sleep(long, int)>

22 iinc 3 1

25 iload_3

26 iconst_1

27 if_icmple 10

30 iload_2

31 iconst_1

32 if_icmpl1 3

35 iinc 2 -1

38 goto 44

41 astore_2

42 iconst_0

43 istore 3

44 return

Exception table:

from to target type

3 38 41 <Class java.lang.Exception>

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

method rewriting by j raf
Method Rewriting by J-RAF

Object f (int x, MemAccObj mem, CPUAccObj cpu) {

cpu.usage += 8;

if (x < 0) {

cpu.usage += 8;

return null;

} else {

cpu.usage += 26;

int y = g(x, mem, cpu);

mem.checkAllocation(SIZEOF_FOO);

Object o = new Foo(y, mem, cpu);

mem.register(o);

return o;

}

}

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

generic application structure

Resource-aware Application

High-level Resource

Accounting & Control

Low-level Resource

Acc&Control (Memory, CPU)

Resource-aware JDK

JVM Native Code

Generic Application Structure

Bytecode Rewriting

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

j raf in action
J-RAF in Action
  • CPU monitoring for some multi-threaded applet

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

validation of the j raf approach
Validation of the J-RAF approach
  • Tested on J2SE …
    • arbitrary applications, as well as applet and mobile agent environments
    • Sun 1.4.1 HotSpot Virtual Machine,IBM JDK 1.3.1
  • … and on J2ME (embedded devices) …
    • dedicated system with Java processor from aJile Systems

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

benchmarks for cpu accounting
Benchmarks for CPU accounting

SPEC JVM98

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

resource mgmt for servlet engines

Resource Mgmt for Servlet Engines

Resource Mgmt for Servlet Engines

Servlet Engines

Access rights

HTML, streams

Requests

Reporting

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

End-user

Provider’s Database

objectives
Objectives
  • Fine-grained basis for:
    • Usage-based billing(pricing policies are out of our scope)
    • Identification of bottlenecks
      • Badly programmed or malicious apps
    • Load-balancing on clusters of servers

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

required j raf extensions
Required J-RAF extensions
  • Define a servlet as a coherent set of threads
  • Flexible concept of client (end-user) context
  • Enhanced detection of bandwidth consumption
  • Remote reporting

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

servlets as sets of threads
Servlets as sets of threads
  • How to detect the start and end of a request processing ?
    • Special rewriting of methods like doGet and doPost, to cope with Tomcat’s thread pooling
    • Register and account for created sub-threads
    • Add a RequestAccount class for aggregating usage of all these threads

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

user level accounting
User-level accounting
  • Periodically do:
    • Summarize usage of all individual threads inside a servlet
    • Summarize usage of all servlets run on behalf of a given user
    • Report this usage to a database
  • Problems that had to be solved:
    • Overflow of counters at all levels
    • Calibration of timeslices according to processing power

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

user context
User context
  • Allow servlet programmers to define their own:
    • Authentication schemes, IP-based or password-based
      • Programmer must implement a ClientID interface
      • Read usage rights from database
    • User data reporting schemes
      • Allow extensible reporting of user data, e.g. session IDs

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

resulting servlet structure

Bytecode Rewriting

Resource-aware Servlet

High-level Resource

Accounting & Control

Low-level Resource

Acc&Control (Memory, CPU)

Resource-aware Servlet Engine

Resource-aware JDK

JVM Native Code

Resulting Servlet Structure

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

sample log for a given client
Sample Log for a Given Client

Servlet name

Timestamp

JVM ops/s

In+Out Bandwidth [Bytes/s]

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

performance testing
Performance Testing
  • Setting: Pentium-class PCs in a 100Mb LAN, Tomcat 4.1, MySQL 4.0.13
  • Generate many simultaneous connections with Jmeter 1.8.1
  • Different test servlets:
    • Output of an empty page
    • Streaming of factorials
    • Download, ZIP-compress, and output a web page

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

preliminary performance results
Preliminary Performance Results

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

Overhead due to CPU monitoring

  • Average overhead: same order of magnitude as for standard Java applications (~ 30 %)
slide24
Cons
  • Purely a Java-level framework:
    • Difficult to account for resources consumed by native code
    • No real-time / resource reservation capabilities
  • Increase of code size
  • Restrictions on what servlets may do
    • to play with thread priorities
    • to perform introspection to inspect or modify accounting objects

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

conclusions
Conclusions
  • Initial work towards fine-grained management of Java servers
  • Reasonable overheads
  • Future work:
    • Finalize management of memory
    • Improve control vs monitoring
    • Support for clusters of servers

www.jraf2.org

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

slide26
Thank you for your attention !

7/7/2003 10th HP-OVUA workshop, Geneva, Switzerland

ad