Skip to main content

Active Transaction

A transaction in progress is called "active transaction." A stack that has been regularly dumped by an active transaction is called active stack.

Note

The WhaTap agent dumps active stacks for active transactions every 10 seconds (optional) and sends them to the server. active_stack_second=10

Collecting the compact active stacks

Because the active stack regularly performs thread dumps, it can add lots of overheads to the agent if implemented incorrectly. WhaTap has various options to collect active stacks while minimizing the agent load.

Tip

In Instance Performance Management > Thread List/Dump, from the thread list, the overhead can be determined by checking the CPU time of the WhaTap-ActiveStackDump thread.

Active Stack Example

JAVA
java.lang.StringBuffer.append(StringBuffer.java:309)
java.util.regex.Matcher.appendReplacement(Matcher.java:839)
java.util.regex.Matcher.replaceAll(Matcher.java:906)
java.lang.String.replaceAll(String.java:2162)
core.log.triggers.TriggerRegister.changeNotify(TriggerRegister.java:114)
core.log.aop.handler.DaoInfo.log(DaoInfo.java:141)
core.log.aop.handler.DaoInfo.doAround(DaoInfo.java:102)
core.log.aop.reflection.profiler.AroundProfiler.invoke(AroundProfiler.java:19)
com.sun.proxy.$Proxy39.getUpdateCount(Unknown Source)
org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getNextResultSet(DefaultResultSetHandler.java:256)
org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:193)
org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)

* * *

sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)

Optimized data collection

  • Dump the stack only for the thread that is performing transactions.

  • You can adjust the active stack dump time interval.

    whatap.conf
    active_stack_second=10
  • It is limited to the maximum line of the active stack. It collects 50 lines from the top line by default.

    whatap.conf
    trace_active_callstack_depth=50
  • Each hashed line of the active stack is collected. Text is collected only once.

  • The maximum number of active stacks collected at a time is limited.

    whatap.conf
    active_stack_count=100

Active Stack for Background Threads

Basically, the active stack means the stack of the thread in which transactions are being processed. You may need to analyze the stack for some background threads as well. At this time, the ** for the background thread can be obtained using the option. It is available in the Java agent 1.6.2 or later.

  • If the value of async_stack_enabled is set to true, the function is enabled.

    whatap.conf
    async_stack_enabled=false
  • The stack dump interval depends on the foreground active stack setting.

    whatap.conf
    active_stack_second=10
  • When setting the target thread name, use * to specify the string pattern.

    whatap.conf
    async_thread_match=http*,abc*

    It identifies the stack dump target with the thread name. You can specify multiple matches using comma (,) as the delimiter.

  • When the Top method of the stack is a class or method registered in async_thread_parking, it determines that the thread has been parked and does not generate a dump.

    whatap.conf
    async_thread_parking_class=sun.misc.Unsafe
    async_thread_parking_method=park

References