Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8295376

Improve debug agent virtual thread performance when no debugger is attached

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 20
    • 20
    • core-svc
    • b23

    Description

      Some customers like to launch (in production mode) the JVM with the debug agent enabled, but with no debugger attached. This usually has a very minimal performance impact as long as the debugger remains unattached. Launching the JVM in this manner allows a debugger to later be attached if there are issues.

      In the past the debug agent has always kept THREAD_START and THERAD_END events enabled, even when no debugger is attached. It does so to keep track of all existing threads, and this generally has minimal performance impact. However, with virtual theads there can be a very large number of virtual threads constantly being created and destroyed. With SkyNet, this results in as much as a 250x performance regression when the debug agent is enabled. A large part of this is due to all the VIRTUAL_THREAD_START and VIRTUAL_THREAD_END events the debug agent has to deal with. When these events are disabled, the performance slowdown is more like 10x. This remaining 10x comes from JVMTI and is not addressed in this CR.

      The suggested fix for this performance issue is to disable VIRTUAL_THREAD_START and VIRTUAL_THREAD_END when the debugger is not attached. This will also require forgetting about all known virtual threads when the debugger detaches since there will be no VIRTUAL_THREAD_END event to notify the debug agent when the virtual thread has died.

      Since the debug agent normally does not need to keep track of all virtual threads, this solution works well. However, in order to better support includevirtualthreads=y, this feature is disabled when includevirtualthreads=y is used. This way the debug agent won't forget about any virtual thread it has learned about, and will continue to learn about virtual threads when the debugger is detached.

      Attachments

        Issue Links

          Activity

            People

              cjplummer Chris Plummer
              cjplummer Chris Plummer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: