jvm

JVM性能监控工具

情到浓时终转凉″ 提交于 2021-02-09 20:23:34
性能监控工具 大纲: n 系统性能监控 – 确定系统运行的整体状态,基本定位问题所在 n Java自带的工具 – 查看Java程序运行细节,进一步定位问题 n 实战分析 – 案例问题 系统性能监控- linux uptime n uptime 作用:查找和定位问题进程 问题线程 – 系统时间 – 运行时间 • 例子中为7分钟(系统运行时间是指系统从开机到现在一共运行了多长时间。) – 连接数 • 每一个终端算一个连接 – 1,5,15分钟内的系统平均负载 • 运行队列中的平均进程数 Linux系统监控的过程中少不了对主机运行时间和系统负责等信息进行查询,这时候就可以使用Linux uptime命令。uptime命令可以显示系统运行多久、当前有多少的用户登录、在过去的1,5,15分钟里平均负载时多少。信息显示依次为:现在时间、系统已经运行了多长时间、目前有多少登陆用户、系统在过去的1分钟、5分钟和15分钟内的平均负载。 那么什么是系统平均负载呢? 系统平均负载是指在特定时间间隔内运行队列中的平均进程数。 如果每个CPU内核的当前活动进程数不大于3的话,那么系统的性能是良好的。如果每个CPU内核的任务数大于5,那么这台机器的性能有严重问题。 如果你的linux主机是1个双核CPU的话,当Load Average(系统平均负载) 为6的时候说明机器已经被充分使用了。 top n Top

jstat命令

天大地大妈咪最大 提交于 2021-02-09 08:59:00
Jstat是JDK自带的一个轻量级小工具。全称“Java Virtual Machine statistics monitoring tool”,它位于java的bin目录下,主要利用JVM内建的指令对Java应用程序的资源和性能进行实时的命令行的监控,包括了对 Heap size和垃圾回收状况的监控 。 语法结构: Usage: jstat -help|-options jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]] 参数解释: Options — 选项,我们一般使用 -gcutil 查看gc情况 vmid — VM的进程号,即当前运行的java进程号 interval– 间隔时间,单位为秒或者毫秒 count — 打印次数,如果缺省则打印无数次 S0 — Heap上的 Survivor space 0 区已使用空间的百分比 S1 — Heap上的 Survivor space 1 区已使用空间的百分比 E — Heap上的 Eden space 区已使用空间的百分比 O — Heap上的 Old space 区已使用空间的百分比 P — Perm space 区已使用空间的百分比 YGC — 从应用程序启动到采样时发生 Young GC 的次数 YGCT– 从应用程序启动到采样时 Young GC

What does the visitLocalVariable() method of the MethodVisitor class in the ASM bytecode engineering library do?

心已入冬 提交于 2021-02-09 05:38:23
问题 I am using ASM (for the first time) in an application to create Java class files. This is for the backend of a compiler I am writing. I read the relevant parts of the ASM documentation and have a question about stack map frames. ASM says it can automatically compute those frames if the class writer is initialized with the appropriate flags. My question is, does that mean I will not ever have to call the visitLocalVariable() method on the method visitors myself? I am not sure what that method

@Throws has no effect when the target is a property

我只是一个虾纸丫 提交于 2021-02-08 23:45:45
问题 While taking a look at this question, I noticed that applying @Throws to a get or set use-site has no effect. Additionally, the only valid targets for @Throws are AnnotationTarget.FUNCTION , AnnotationTarget.PROPERTY_GETTER , AnnotationTarget.PROPERTY_SETTER , and AnnotationTarget.CONSTRUCTOR . Other annotations, such as the JPA annotations and Deprecated work fine and are properly applied to the method! This is strange behavior. To demonstrate, I created a simple abstract class in Java, with

@Throws has no effect when the target is a property

你离开我真会死。 提交于 2021-02-08 23:44:10
问题 While taking a look at this question, I noticed that applying @Throws to a get or set use-site has no effect. Additionally, the only valid targets for @Throws are AnnotationTarget.FUNCTION , AnnotationTarget.PROPERTY_GETTER , AnnotationTarget.PROPERTY_SETTER , and AnnotationTarget.CONSTRUCTOR . Other annotations, such as the JPA annotations and Deprecated work fine and are properly applied to the method! This is strange behavior. To demonstrate, I created a simple abstract class in Java, with

Decompiling obfuscated java bytecode [closed]

余生颓废 提交于 2021-02-08 12:59:12
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago . I work on a platform which runs Java apps. Those apps are often obfuscated, most of them using ProGuard, which makes debugging issues

UseConcMarkSweepGC is deprecated, what is its replacement?

自闭症网瘾萝莉.ら 提交于 2021-02-08 12:18:53
问题 A java program is giving this warning, with JRE 10.0.2: Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. What is the recommended replacement for this switch? 回答1: Dropping support for CMS and then removing the CMS code, or at least more thoroughly segregating it, will reduce the maintenance burden of the GC code base and accelerate new development. The G1 garbage collector is intended, in the

What is shared in a JVM

天涯浪子 提交于 2021-02-08 10:20:14
问题 What do two different Java programs, running in one same Java Virtual Machine, share together? Something comes to my mind, regarding singleton classes: They can only be instantiated once per JVM. This means that if two different Java programs use one same class, they are both accessing the same instance of that Singleton class? What other things are shared? 回答1: If you run the java command multiple times, you get multiple instances of the JVM. In theory these are entirely separate with

How is JNI_CreateJavaVM invoked when running a java app from the command line

China☆狼群 提交于 2021-02-08 09:58:52
问题 I am trying to understand the point of entry into JVM . After doing my research I have learnt that JNI_CreateJavaVM (at least in HotSpot JVM ) is the method that is called to launch the JVM. My question now is who calls the JNI_CreateJavaVM method ? I tried looking at the JDK source here JDK7 Hotspot. But it is not very clear and I was not able to find any ' int main ' method. Lets say I create a simple java program and compile it to Hello.java . Now when I run ' java Hello ' from the command

How is JNI_CreateJavaVM invoked when running a java app from the command line

我是研究僧i 提交于 2021-02-08 09:58:03
问题 I am trying to understand the point of entry into JVM . After doing my research I have learnt that JNI_CreateJavaVM (at least in HotSpot JVM ) is the method that is called to launch the JVM. My question now is who calls the JNI_CreateJavaVM method ? I tried looking at the JDK source here JDK7 Hotspot. But it is not very clear and I was not able to find any ' int main ' method. Lets say I create a simple java program and compile it to Hello.java . Now when I run ' java Hello ' from the command