Presentation is loading. Please wait.

Presentation is loading. Please wait.

0 0 Thread Management in Application Servers Wednesday, October 11, 2006 Nicolas DOLET Philippe MERLE

Similar presentations


Presentation on theme: "0 0 Thread Management in Application Servers Wednesday, October 11, 2006 Nicolas DOLET Philippe MERLE"— Presentation transcript:

1 0 0 Thread Management in Application Servers Wednesday, October 11, 2006 Nicolas DOLET (nicolas.dolet@inria.fr) Philippe MERLE (philippe.merle@inria.fr) Jacquard Project - INRIA Futurs, Laboratoire d‘Informatique Fondamentale de Lille (LIFL), Université des Sciences et Technologies de Lille (USTL), Villeneuve d’Ascq, France RNTL JOnES Meeting – Paris - France

2 1 1 Outline Context Problem & Motivation Objectives Control threading activity Our approach Thead Management Framework (TMF) Area Management Framework (AMF) Framework organization Conclusion Perspectives

3 2 2 Context Application servers host Application Components (AC): OSGi: –Bundles JOnAS: –EJBs –Servlets PEtALS: –JBI Binding Components –JBI Service Components

4 3 3 Context Application servers are composed of Middleware Components (MC): JOnAS = Web and EJB containers for application components + ( JacORB & Axis & JORAM for communication ) + ( JORM & JOTM/MEDOR/Speedo & C-JDBC for services ) + … PEtALS = Enterprise Service Bus (ESB), JBI compliant + JBI containers + JORAM for communication

5 4 4 Context MC2AC1AC3 hosted by composed of AC2MC3MC1 Application Server  Both AC & MC components can create Threads !

6 5 5 Problem & Motivation Problem: Creation of a large number of threads can cause: –Performance degradation due to thread context switches –Partial crash of the JVM / Application Server Motivation: need to control Thread allocation Ensure the property: “Never more than X threads simultaneously”

7 6 6 Objectives Monitor Thread allocation... of (embedded) Middleware Components of (user) Application Components... with several statistics: Number of active threads History of threads allocation List of classes using threads Protecting Application Servers against MC (e.g. JMS could create too many threads) –Thread pool solution drawback: ∑ MC thread pools > JVM Threads limit against AC (e.g. EJB should not create threads) –There is currently no solution for the control of AC threading activity –Future public Application Server could be hacked by a viral AC

8 7 7 Middleware Components Integration – The Pool Solution’s Drawbacks Application Server configures (in a property file) configures (via JMX) MC1 Configurable Thread Pool Thread how to configure ? MC2 Configurable Thread Control Thread MCn Thread Management ? Thread  Developpers have to implement the thread control for each new component...

9 8 8 Thread Management Framework with APIs Thread Management Framework MC2 Explicit Thread Management AC No Thread Management MC1 Configurable Thread Management MC2 Configurable Thread Management  Modify all MC for using TMF APIs Manual patches of source code of existing components Using Aspect Oriented Programming to modify existing components uses

10 9 9 Thread Management Framework TMF with the Thread Class Adaptation AC No Thread Management MC1 Configurable Thread Management MC2 Configurable Thread Management Java Thread Class Transparency: Do not have to change MC / AC Activation on demand

11 10 Our Approach Modification of the java.lang.Thread class Bytecode injection using the ASM tool Any thread includes these modifications and can be controlled by areas Area Management Framework Each thread is assigned to an area when it starts, according to a criterion –e.g., the package of the instance that create the thread Each area defines a manageable limit, and can trigger an alarm when the limit is reached

12 11 Area & Alarm Concepts An area is an entity for monitoring a pool of resources (eg. Threads) can support children areas counts the number of Threads for itself and each child recursively can block the execution of the thread can trigger alarms An alarm can have several behaviours: –save alarm messages in a log file –throw exceptions –send a mail to an administrator –composition of different features

13 12 Where to Adapt the Thread class ? Never more than X Threads After thread exits Before thread starts  Thread activity.

14 13 How to Rewrite the Thread Class ? Bytecode injection (ASM) org.objectweb.area.thread.AdaptThreadClass class Thread { public Area area; public void start(); private void exit(); } class Thread { public void start(); private void exit(); } ASM

15 14 Framework Organization API AreaProvider : management of the areas Area : management of the resources AreaProperties : management of the area features AreaStatistics : build statistics on the resources Alarm : send alerts Current implementation of TMF: lib –SingletonAreaProvider: JVM bootstrap –DefaultArea, DefaultAlarm, DefaultXXX,… : all interfaces default implementation –SAXHandler: area configuration –NoLimitArea, OutOfMemoryAlarm thread –AdaptThreadClass: ASM patch –ThreadManager: static class for the delegation of the management to AMF

16 15 TMF Default Implementation DefaultArea enter (resource) –parent.enter (resource) –If (counter == 0) –alarm.alert (this, resource) –wait () –counter = counter -1 exit (resource) –counter = counter + 1 –notify () –parent.exit (resource)

17 16 AMF Architecture Graph of Areas / Alarms Managed by an AreaProvider Configurable by users (XML) Global view from the root Area

18 17 Fractal Component Based Approach TMF can be built either in an Object version or in a Component one Area configuration via Fractal ADL

19 18 Integration into PEtALS Basic integration for monitoring Middleware Components (MC) activity Add TMF libraries in the java.endorsed.dirs property Fine grain integration for monitoring Application Components (AC) activity Modify the JBI Installer component in order to notify AMF for a reconfiguration of its Areas String componentClassName = componentDescription.getComponentClassName(); int lastSeparator = componentClassName.lastIndexOf('.'); String packageName = componentClassName.substring(0, lastSeparator + 1); PetalsService.addPackageInPetalsArea(packageName);

20 19 Conclusion Overhead < 1 sec Benchmark : + 20% when classical launch  + 4 % with a SingletonAreaProvider  Tested with RUBiS : non measurable overhead Threads allocation can be managed transparently inside the Application Server, for Middleware Components with minor modifications (of the Application Server source code) for Application Components Mean time is 13767 milliseconds. 14373 milliseconds. 16593 milliseconds.

21 20 Perspectives Other software monitoring  change the AreaProvider Integration into other middleware: JORAM DREAM Manage other resources, e.g. : Messages Sockets DBConnections  Requires ‘only’ to adapt the resource class, to use the Area Management Framework

22 21 Thank You Any questions ? TMF available at: http://tmf.gforge.inria.fr TMF for JOnAS available at: http://jonas.objectweb.org TMF for PEtALS (soon) available at: http://petals.objectweb.org


Download ppt "0 0 Thread Management in Application Servers Wednesday, October 11, 2006 Nicolas DOLET Philippe MERLE"

Similar presentations


Ads by Google