[OLD] JVM Crossing Invocation Sequences

Motivation

The usual Business Enterprise Application are running on more that one machine (virtual machine) because they are splitted into several parts (for example FrontEndServer, BackEndServer). InspectIT can monitore each part on its own. That means you are able to see invocation sequences for the FrontEndServer and you can see invocation sequences for the BackEndServer. But you can not combine them, because you do not know which one fits togehter. It is a natural appetence to combine these sequences automatically. If you are able to do this, you can see a whole transaction on different machines. This page discribes how InspectIT combines invocation sequences on different machines.

Considerations

  • in order to combine invocation sequences we need an identifier for each one
  • we need to send the identifier from one machine to another
  • JVM comunication based on different protocols (for example http, https, IIOP, ...)
  • We must add the identifier (invocation sequence ID) to the protocol
  • We must read the identifier on the other JVM
  • A general implementation seems unlikely, because each protocol is different
  • even the implementation of one protocol in different envirements are different (for example http on Apache Tomcat vs. JBoss vs Weblogic)
  • the implementation must work without invocation sequences (no invocation sequence is neccessary to capture remote call data)

 

In order to prove the considerations it is necessary to make a POC. For the first shot we try to expand the http header on an Apache Tomcat.

 

While implementation I decissed to implement a sensor for each protocol and each different implementation of the protocol. The following table shows an overview about the implemented protocols.The table is not complet. So feel free to add more.

 

 Apache TomcatJBossWeblogicGlasfish
HttpXXP 
RMIP   
     
     
     

Legend: X Done, P Planed

Http

Http is a common application protocol for distributed systems. Furthermore the header is expandable and plain text. Unfortunately Java does not provide a standart implementation of the http protocol. Java just provides the abstract class java.net.HttpURLConnection.This class provides the abstract methode connect(). This methode should open a communication link to the requested URL. This seems to be a good place to extend the http header. InspectIT already provides a mechanism to add some code before the methode body. We use this mechanism to expand the header before the methode body of the methode connect() will be execute.

Insertion of the InspectIT Header

Apache Tomcat

The implementation of the Apache Tomcate extends the abstract class java.net.HttpURLConnection with the class sun.net.www.protocol.http.HttpURLConnection

Sensor Configuration
method-sensor-type webrequestInApache info.novatec.inspectit.agent.sensor.method.webrequest.inserter.http.apache.WebrequestApacheHttpInserterSensor MAX
sensor webrequestInApache sun.net.www.protocol.http.HttpURLConnection connect() charting=true

The sensor works just on this specific implementation. The class info.novatec.inspectit.agent.sensor.method.webrequest.inserter.http.apache.WebrequestApacheHttpInserterSensor handles the sensor. The correspondig hook uses the methode addRequestProperty of the class sun.net.www.protocol.http.HttpURLConnection to add an specific inspectIT header to the http header attricbutes.

VersionTestedSupported
8.0XX
7.0XX
6.0XX

 

JBoss

The JBoss uses the org.jboss.ws.core.client.transport.NettyClient as implemetation for the http protocol. The methode invoke(java.lang.Object,java.lang.String,boolean,java.util.Map,java.util.Map) performs the http request. The 4. parameter of the methode is a Map of additional http headers to be added to the request. We just add the InspectIT header to this map.

VersionTestedSupportedKnow Problems
5.1XX 
 6.xXX 
7.0XInsert Header, but could not extract.Logging Problem
8.2 (Wildfly)XInsert Header, but could not extract.Logging Problem

 

Weblogic

not now.

Extraction of the InspectIT Header

Each http request will be compute in a subclass of javax.servlet.Servlet. So we can use the method service(javax.servlet.ServletRequest,javax.servlet.ServletResponse) to extract the InspectIT header.

 

Current UI Integration

At the moment the UI integration is very basic. In the navigation tree is a node called "Remote Call Data". If you open the node you are able to see all remote calls. Each remote call has several informations:

  • Platform ID - The ID of the platform which recorded the data
  • Start Time
  • Methode
  • Calling - Can have two values. True means this is the request. False means this is the response.
  • Identification - Is a unique (at the moment not really) identifier to connect a recorded request and a recorded response.
  • URL - The URL for the request. If it is a response the field is empty.
  • Response Code -  The response code for the request. If it is a response the field is empty

Remote Call Overview

The invocation sequence details shows if an remote call (request or response) is part of the invocation sequence.

Current Issues

Identification Problem

At the moment the identification of a remote call is the cpu time of the thread. I tested several calls at the same time and the identification was the same.

Ideas

  • Platform ID must be part of the identification (differentiate platform)
  • Method ID must be part of the identification (differentiate methods)

If the same method is called on the same platform, we still have a problem with the time stamp.