How can I prevent Java from creating hsperfdata files?

后端 未结 8 1877
遥遥无期
遥遥无期 2020-12-24 02:15

I\'m writing a Java application that runs on Linux (using Sun\'s JDK). It keeps creating /tmp/hsperfdata_username directories, which I would like to prevent. Is

相关标签:
8条回答
  • 2020-12-24 02:36

    From svrist's link:

    The first item in http://java.sun.com/performance/jvmstat/faq.html mentions an option which you can turn off to disable the whole suite of features: -XX:-UsePerfData.

    0 讨论(0)
  • 2020-12-24 02:37

    EDIT: Cleanup info and summarize

    Summary:

    • Its a feature, not a bug
    • It can be turned of with -XX:-UsePerfData which might hurt performance

    Relevant info:

    • Sun forum
    • Bugreport
    0 讨论(0)
  • 2020-12-24 02:42

    There is also "-XX:+PerfDisableSharedMem" option (recommended by Sun) which should cause less performance issues than use of "-XX:-UsePerfData" option.

    0 讨论(0)
  • 2020-12-24 02:52

    According to the filed bug report there is a work-around:

    This undocumented option will disable the perfdata feature:
    -XX:-UsePerfData

    It's worth mentioning that it is a feature though, not a bug. The above work-around just disables the feature.

    0 讨论(0)
  • 2020-12-24 02:53

    Try JVM option -XX:-UsePerfData

    more info

    The following might be helpful that is from link https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html

    -XX:+UsePerfData
    
        Enables the perfdata feature. This option is enabled by default
        to allow JVM monitoring and performance testing. Disabling it 
        suppresses the creation of the hsperfdata_userid directories. 
        To disable the perfdata feature, specify -XX:-UsePerfData.
    
    0 讨论(0)
  • 2020-12-24 02:53

    Use the JVM option -XX:-UsePerfData.

    This will not have a negative effect on performance, as some other answers say.

    By default jvmstat instrumentation is turned on in the HotSpot JVM. The JVM option -XX:-UsePerfData turns it off. If anything, I would speculate, turning off the instrumentation would improve performance (a trivial amount).

    So the downside of turning off jvmstat instrumentation is that you lose the performance monitoring information.

    jvmstat is described here http://java.sun.com/performance/jvmstat/

    Here's a thread with someone who is worried that by turning on jvmstat - with the option -XX:+UsePerfData - will hurt performance. http://www.theserverside.com/discussions/thread.tss?thread_id=33833
    (It probably won't since jvmstat is designed to be "'always on', yet has negligible performance impact".)

    0 讨论(0)
提交回复
热议问题