Poison


  • 首页

  • 归档

  • 标签

  • 搜索
close
Poison

一次线上 CPU 飙升问题的分析解决

发表于 2017-09-11

前几日,下了班在家时突然收到监控报警,线上一组业务机器 CPU 被打满至 100%,为了保持服务的稳定运行,临时采取了升级配置、加机器等粗暴的方法将当晚扛了过去。

阅读全文 »
Poison

Java 为什么对常量的修改没有生效?

发表于 2017-05-15

写这篇文章的起因是前几天同事改了一个常量类中的提示,发布到测试环境后没有生效,正好看 《Java 解惑(谜题 93: 类的战争)》 提到了这个问题,所以写篇文章记录一下。

以下均使用命令行进行演示,至于为什么没有使用 IDE 后面会提到。

先看一个简单的 Constants 类:

1
2
3
4
5
6
7
8
/**
* Created by Poison on 15/05/2017.
*/
public class Constants {

public static final String a = "before fixing";

}
阅读全文 »
Poison

Java Mission Control

发表于 2017-05-02

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collection framework built into the Oracle JDK. It allows Java administrators and developers to gather detailed low level information about how the Java Virtual Machine (JVM) and the Java application are behaving. Java Mission Control is an advanced set of tools that enables efficient and detailed analysis of the extensive of data collected by Java Flight Recorder. The tool chain enables developers and administrators to collect and analyze data from Java applications running locally or deployed in production environments.

Java Mission Control
题图为监测 pull-readhub.me 的示例数据。

阅读全文 »
Poison

Java 对象指针压缩

发表于 2017-04-23

很久之前就看到过 Java 对象指针压缩这个技术,只是一直没具体想为什么要偏移 3 位,好吧,最近才知道原因是因为大多数 JVM 实现都是采用 8 位对齐,所以二进制位中的后三位都是 0。

阅读全文 »
Poison

JOL

发表于 2017-04-19

我把示例代码放了一份在 Github 上,jol-samples,想看的同学可以 clone 下来把每个 example 跑一跑就能看到 JVM 对象在内存中布局的一些信息,包括对象头占多大、字节怎么对齐、字段在内存中的顺序不一定与声明的顺序一致、涉及到继承时字段是如何存放的、带 transient 修饰符的字段被特殊处理、Java8 新增的 @Contended 注解的作用、JVM 的平台相关性、对象头中的 mark word 及 class word、轻量锁、偏向锁、重量锁、Hashcode、GC 需要用到的对象引用图、哈希碰撞时转换为链表以及 Java8 中极端情况下转换为红黑树、观察 mark word 中的 age 字段的值在 GC 后的变化 等等,我没有一个一个写出来,因为 25 个例子太多了,设计到的知识点也比较多,需要一些前置知识才能理解。

阅读全文 »
1…212223

115 日志
128 标签
GitHub
© 2016 - 2022 Poison 蜀ICP备16000644号
由 Hexo 强力驱动
主题 - NexT.Mist