- 浏览: 125007 次
- 性别:
- 来自: 北京
最新评论
-
C_J:
有必要这么鸡冻咩?
编写自己的ClassLoader知识点 -
jason61719:
你这不是说了等于没说吗……就解析个loadClass(),谁不 ...
编写自己的ClassLoader知识点 -
jiming:
tedeyang 写道很好的改进,不过话说回来,mybatis ...
开源,从关注产品社区做起(ibatis3.x的最近一个issue展示) -
C_J:
独爱Java 写道好像实际用处并不是很大,只是多了解了有这个东 ...
Java内存模型笔记 -
独爱Java:
好像实际用处并不是很大,只是多了解了有这个东西而已。。。
Java内存模型笔记
题记:
总感觉JE讨论的帖子的东西都比较滞后,所以会有意多关注下infoQ上的东西,看看大洋彼岸的程序员们都在关心着什么。本文是说垃圾回收的,原文:http://www.infoq.com/articles/azul_gc_in_detail
根据个人体会和理解,筛选出了文章的重点.
Introduction
Automatic garbage collection frees the programmer from much of the worry about releasing objects that are no longer neededIt also prevents some kinds of common bugs occurring, including certain kinds of memory leaks, dangling pointer bugs (which occur when a piece of memory is freed while there are still pointers to it and one of those pointers is then used) and double free bugs (which occur when the program tries to free a region of memory that has already been freed and perhaps already been allocated again).
it does also have some problems. The most significant is that thus far, practical implementations of garbage collection in commercial Java runtimes have generally involved an unpredictable "pause" during collection.
但这种垃圾回收也存在一些问题,比如JVM的GC在垃圾回收过程中会不可预期地暂停应用线程#应该跟GC的单线程回收有关#
As Java programs have expanded in size and complexity, so the garbage collection pause has become an increasingly significant problem for Java software architects.
随着程序越来越复杂,这种回收的pause越来越频繁。
A widely used technique in enterprise Java to work around this is to distribute programs. This can both keep the heap size smaller, making the pauses shorter, and also allow some requests to continue whilst others are paused. Increasingly though, this means that Garbage Collector (GC) managed workloads are unable to take full advantage of the capabilities of the hardware on which they run.
一种普遍的解决方案是“云”,把程序拆分成集群,这样每台机器heap足够小,减少回收的次数,从而减少pause,且可持续响应用户的请求,但这样GC的回收从某种意义上来说没得到足够的利用。作者还认为当前GC的发展滞后于硬件的发展。
Collector Mechanisms
Common Tasks
要实现一个collector,必须要做到:
- Identifying the live objects in the memory heap 标记live内存
- Reclaiming the resources used by those objects that are not live (aka “dead” objects) 回收内存
- Periodically relocating live objects to create some amount of contiguous free space in order to accommodate the allocation of new objects of varying sizes – this process is referred to as either relocation or compaction
Parallelism and Concurrency
Garbage collectors can be either single-threaded or parallel:
回收可以是单线程,也可以是多线程的
- A single threaded collector uses at most one CPU core to perform garbage collection.
- A parallel collector uses multiple threads that can perform collection work at the same time, and can therefore make simultaneous use of more than one CPU core
They are also either Stop-the-world or Concurrent:
所以GC也可以是并发的
- A Stop the world collector performs garbage collection work with the application code stopped.
- A concurrent collector performs garbage collection work concurrently with program execution, allowing program execution to proceed while collection is done (potentially using separate CPU cores)这种并发的GC可以于业务代码同时运行,GC的回收不会打扰你程序的运行。
Responsiveness and Sensitivity
反应时间和敏感度
The Azul Garbage Collector
Azul's GPGC collector (which stands for Generational Pauseless Garbage Collector), included in its HotSpot-based JVM, is both parallel and concurrent. GPGC has been widely used in a number of production systems for several years now, and has been successful at removing or significantly reducing sensitivity to the factors that typically cause other concurrent collectors to pause.
说道这个GC在一些产品中应用了多年并成功避免了其他并发回收器的“失效”。
Azul用到的一些原理:
The Loaded Value Barrier
“Self Healing”
How the Azul Algorithm Works
详细没看了,估计看了也不太明白。
Comparison with existing Garbage Collectors
HotSpot’s Concurrent Mark Sweep (CMS) is a mostly concurrent collector. It performs some garbage collection operations concurrently with program execution, but leaves some operations to long stop-the-world pauses. Tene described it as follows:
Hotspot’s CMS collector uses a full, stop-the-world parallel new generation collector which compacts the new generation on every pass. Since young generation collection is very efficient, this stop-the-world pass typically completes very quickly - in the order of 100s of milliseconds or less.CMS uses a mostly-concurrent collector for OldGen. It has a mostly concurrent, multipass marker that marks the heap while the mutator is running, and tracks mutations as they happen. It then revisits these mutations and repeats the marking. CMS does a final stop-the-world “catch up” marking of mutations, and also processes all weak and soft refs in a stop-the-world pause.
CMS does not compact concurrently. Instead, it does concurrent sweeping, maintains a free-list, and attempts to satisfy old generation allocations from this free list. However, because the free list is not compacted, free space will inevitably be fragmented, and CMS falls back to a full stop-the-world to compact the heap.
Oracle’s experimental Garbage First (G1) collector, which is expected to ship as part of Java 7, is an incrementally compacting collector that uses a snapshot-at-the-beginning (henceforth SATB) concurrent marking algorithm and stop-the-world compaction pauses to compact only parts of the heap in each pause. G1 allows the user to set pause time goals, and uses these goal inputs along with topology information collected during its mark phase in order to compact a limited amount of heap space in each pause, in an attempt to contain the amount of the heap references that need to be scanned during each pause.
Tene explains that, given its experimental state, it is still early to tell how G1 will fare with real applications. According to Tene, while G1 is intended to incrementally improve upon CMS’s handling of fragmentation, its compactions are still performed in complete stop-the-world conditions, and its ability to limit the length of incremental compaction pauses strongly depends on an application’s specific heap topology and object relationships. Applications with popular objects or popular heap portions will still experience long stop-the-world pauses when the entire heap needs to be scanned for references that need remapping, and those long pauses, while less frequent, will be no shorter than those experienced by the current CMS collector. As Tene puts it:
If a collector includes code that performs a full heap scan in stop-the-world conditions, that code is intended to run at some point, and application should expect to eventually experience such pauses.
Whilst G1 attempts to improve determinism, it cannot guarantee it. Tene explained:
It does let the user set pause time goals, but will only “try” to follow those goals. Even if OS scheduling was perfect, G1 would not guarantee determinism as its ability to contain individual compaction pauses is inherently sensitive to heap shape. Popular objects and (more importantly) popular heap regions (regions referred to from many other regions, but do not necessarily need to have popular individual objects) will cause G1 to eventually perform a full heap compaction in a single pause if they were to be compacted… Real application patterns (such as slowly churning LRU caches that get lots of hits) will exhibit such heap relationships in the vast majority of the heap, forcing G1 to perform what is effectively full compaction remap scans in a single pause…
A previous InfoQ article provides more of the technical details.
Conclusion
With the introduction of Zing, Azul has made pauseless garbage collection available in a pure software product on commodity hardware, making it more consumable and much easier to adopt. Pauseless garbage collection can:
- Allow Java instances to make effective use of the abundant, cheap, commodity hardware capacities that are already available, and grow with future improvements to hardware.
- Allow Architects and developers to make aggressive use of memory capacity in their designs, applying techniques such large in-memory, in-process caching, as well as complete in-memory representations to new problem sets.
- Allow developers to avoid the fine tuning and re-tuning of current sensitive GC systems.
Azul提供了一个持续的有效的内存回收。更有效地利用硬件资源,鼓励开发者充分使用内存,避免GC的一些额外的优化设置。
上面说到了Java7推出的G1,稍后继续。。
发表评论
-
iOS入门(ongoing)
2012-09-13 11:32 1247Record it: The overview of ... -
Stuff about Android
2011-07-09 16:15 1029Foreword: long time ... -
JQuery初体验(Demo)
2011-05-22 13:43 1411Demo:Show <meta content ... -
Java内存模型笔记
2011-04-13 15:48 1507题记: 看到C/C++ ... -
Radiant_The Popular Ruby's CMS Demo篇
2011-04-02 14:49 1195题记: 上篇 记录我第一次安装Rodiant经过和 ... -
Radiant_The Popular Ruby’s CMS安装篇
2011-03-28 00:48 1234题记: 今天第一次参加JE的线下活动,robbin等 ... -
phpCMS & jQuery是我该做的(阉割了)
2011-02-27 23:02 81WD讲究以plugin挂载为结构,我需要构造一个p ... -
我的玩意:J2ME的Criteria初探
2011-01-20 21:59 981题记: 前几天跟初中同学聊天,他问我能不能做一个GP ... -
编写自己的ClassLoader知识点
2011-01-13 14:41 1841题记: 看到InfoQ关于ClassLoader的文 ... -
周末好玩,用短信控制你的计算机
2011-01-10 16:34 2906Snapshot: 详情 ... -
About Dock Plugin on Mac
2010-11-21 22:47 1430题记: 第一次接触MAC的开发..... ... -
可变hashcode的隐患和序列化安全
2010-10-25 00:55 1292可变hashcode的隐患 为识别对象,JDK ... -
体验OSGi(helloworld.jar)—富app的热拔插
2010-10-18 23:22 2376记得以前工作的时候,有天direct manager问 ... -
MongoDB on DAO with Java Language
2010-08-26 19:17 1396A Quick Tour Using the Java d ... -
Getting Start on Mongodb
2010-08-26 01:29 1453题记: 最近老和同学聊到non-relational ... -
Java Media Framework本地玩转摄像头
2010-08-04 00:57 16921、简介The JavaTM Media Framework ... -
从WeakLogHandler应用看Java的引用、引用队列
2010-06-14 00:58 1473题记: 前几天讨论到WeakHashMap(这个是个弱引用的 ... -
《重构》读书笔记
2010-05-09 00:05 1005Martin Fowler于2003年出版 ... -
RPC之WebServices&RMI&JMS,phprpc框架?(待续)
2010-05-06 22:31 55前段时间写过基本的WebServices,也没再做深入 ... -
Java应用中的SQL注入攻击和防范
2010-04-24 01:06 6657说说自己对注入的 ...
相关推荐
Azul Systems CTO & co...如果希望深入了解Java的垃圾回收机制,让自己对于Java语言与解释器性能有更全面的了解的话,一定不能错过这本77页的演讲资料。 本资料适合Senior Engineer类读者,需要有较为深厚的技术基础。
Doctor Azul
azul开发的非停机的jvm gc算法,交oracle和ibm的都更加先进,提高了jvm相应用户请求的能力。
关于 Azul是一个用于在Rust和C中创建图形用户界面的库。它将来自功能,响应式和面向数据的编程的范例与适用于开发跨平台桌面应用程序的API混合在一起。 Azul的两个核心原则是不渲染不可见的对象,并在继承上使用DOM...
Azul-桌面GUI框架警告:本自述文件中公告的功能可能尚不起作用。 Azul是一种免费的,功能齐全的即时模式GUI框架。Azul-桌面GUI框架警告:本...关于Azul的Discord聊天尚未准备好投入使用或生产。 有关项目和用法的描述
The-Pauseless-GC-Algorithm-Azul 无暂停垃圾手机算法,来源于业内著名的JVM开发商 Azul
Azul花砖物语游戏素材
weka-3-8-5-azul-zulu-windows
weka-3-8-5-azul-zulu-windows.exe
azul:桌面GUI框架
WEKA 的全名是怀卡托智能分析环境(Waikato Environment for Knowledge Analysis),同时 weka 也是新西兰的一种鸟名,而 WEKA 的主要开发者也来自新西兰。WEKA 作为一个公开的数据挖掘工作平台,集合了大量能承担...
Azul:Azul铺砌游戏
weka3.84版,数据挖掘很好的工具。需要的可以下载使用。
Azul是音乐组织者,可以自动提取档案,转换文件格式,按CUE分割音频,然后智能识别,标记和重命名。 只需告诉Azul要扫描的文件夹,其余的就可以完成。
Azul:著名的Azul游戏板的实现
Azul.js 记录器 的日志记录实用程序。 require ( 'azul-logger' ) ( db . query ) ;应用程序接口azulLogger(查询,[选项])询问类型: Query 应监视日志记录的 Azul.js 查询对象。 查询和从它派生的所有查询都将...
本系列基于炼数成金课程,为了更好的学习,做了系列的记录。 本文主要介绍 1.高并发的概念,为以后系列知识做铺垫。 2.两个重要的定理
AZUL-ai播放器棋盘游戏Azul的AI播放器
Azul.js 跟踪器 查询跟踪实用程序,可报告未执行的查询以帮助在开发过程中发现错误。 高架 使用此工具会产生大量开销,强烈建议永远不要在生产中启用它。 如果您有一个大型测试套件,您可能希望在测试时也禁用它。 ...
用于Express的中间件和装饰器 记录正在执行的查询 报告已创建但从未执行过的查询 测验 只需运行npm test即可运行完整的测试套件。 该版本当前连接到数据库以进行测试。 要将其复制到您的计算机上,请执行以下操作...